0%

Algorithm

Title: Longest Common Prefix
Solution: Java

Review

I always want to change the mind of my loves, but I didn’t use the good way to do it. So I read How to Change a Mind this week.

To be honesty, I can’t get this article well, it is a little hard to me. But I got the following opinions from this topic.

  1. Firstly we should think or do like the people who we want to change.
  2. For scams, we should let the people lose the faith in the person not in the scams, it will be a better way. Quote the sentence:

    “Dylan did not need to lose his faith in what his elders were saying; he needed to lose his faith in them.”

    Read more »

android 源码中,主要用 RepoGit 来进行版本管理。Repo 是一个由谷歌构建,运行在 Git 之上的仓库管理工具,其让多项目管理变得更容易,尤其对于基本的网络操作,譬如,下载由上百个项目组成的 Android 源码。

Repo 的组成和基本使用

Repo launcher

Repo 的第一部分,其是一个 Python 脚本,主要用来获取完整的 Repo 工具并转发接收到的命令 .

Repo Tool

Repo 的第二部分,由 Repo launcher 下载到 $srcDir/.repo/repo,其是主要功能部分,处理 Repo launcher 转发的命令。

Read more »

Algorithm

Title:Palindrome Number
Solution:C solution

Review

I always don’t kwnow enough about repo, so I read some articles about repo this week. These articles describe the repo Manifest format, usage of repo, repo && git , etc in detail. It helps me a lot. But I have not absorbed them yet, I need more time.

The links are as follows:
repo

Read more »

I don’t know what to share for ARTS this week. So I summarize a little knowledge of the shell.

What is a shell

A shell is a software interface that is ofthen a command line interface that enables the user to interact with the computer. In linux, we can check all supported shell via the following way.

Read more »

Algorithm

Title:Reverse Integer
Solution:C solution

Review

Because I am learnning python, I was attracted by the Learning Python: From Zero to Hero article of Medium.

This article is very good , it almost show all the python-related knowledge in a limited page. Such as , variables, conditional statements, looping, collection/array, key-value collection, iterate , classes and objects, encapsulation, inheritance, etc.

Read more »

没有太多时间去查看详细源代码,所以仍然有很多不清晰或者理解不到位的地方,后续将 Linux 相关知识学习得更深入的时候再来更新一次。

进程与线程

在 Linux 中,进程和线程几乎没有什么区别,主要的区别就是线程共享同样的虚拟内存地址空间。对于 kernel 来说,进程和线程都是一个可运行的 task 。

线程创建函数 pthread_create() 会调用 clone(), 而进程创建函数 fork() 最终也是调用 clone()。我们查看clone函数的介绍时,可以看到 clone() 的参数 flags 用来指明子‘进程’和父‘进程’共享什么,所以可以说进程就是不共享任何东西的一个典型线程(一个不成熟的观点,不一定正确)。
process_thread_to_task

摘录线程库发展史:Linux threading libraries evolution: Linux Threads, NGPT, NPTL. The library is part of gilbc, programmer interface is POSIX pthreads.

线程模型

Read more »

ARTS 简单介绍

Algorithm:
主要是为了编程训练和学习。每周至少做一个 leetcode 的算法题(先从Easy开始,然后再Medium,最后才Hard)。进行编程训练,如果不训练你看再多的算法书,你依然不会做算法题,看完书后,你需要训练。

Review:
主要是为了学习英文,如果你的英文不行,你基本上无缘技术高手。所以,需要你阅读并点评至少一篇英文技术文章,我个人最喜欢去的地方是 Medium(需要梯子)以及各个公司的技术 blog,如 Netflix 的。

Tip:
主要是为了总结和归纳你在是常工作中所遇到的知识点。学习至少一个技术技巧。你在工作中遇到的问题,踩过的坑,学习的点滴知识。

Share:
主要是为了建立你的影响力,能够输出价值观。分享一篇有观点和思考的技术文章。

Read more »

Term

  • DFP - Downstream Facing Port
    下行端口,可以理解为 Host 的 Type-c 端口或者作为 Host 的 hub ,DFP 提供 VBUS,可以提供数据。在协议规范中 DFP 特指数据的下行传输,笼统意义上指的是数据下行和对外提供电源的设备。典型的 DFP 设备是电源适配器。

  • UFP - Upstream Facing port
    上行端口,可以理解为 Device 上的 Type-c 端口或者连接到 Host/DFP of a hub ,UFP 从 VBUS 中取电,并可提供数据。典型设备是 U 盘,移动硬盘。

  • DRP - DUal Role Port (DFP + UFP)
    双角色端口,DRP 既可以做 DFP(Host),也可以做 UFP(Device),也可以在 DFP 与 UFP 间动态切换。典型的DRP设备是笔记本电脑。

引用摘录:A DRP port is a port that can operate as either a sink or source.

source - takes the data role of a DFP.
sink - take the data role of a UFP.

A current sink is a port or circuit point that accepts negative current, e.g. current into the circuit which it drains to ground.
A current source is a port or circuit point that provides positive current. A good example of a current source is a DC power supply

Description

逻辑:USB 默认为 UFP,不能使用 OTG ;若要使用需要通过 node 将其设为 DRP , 但是在拔出后需要将其设回 UFP。

问题: 当拔掉 OTG 之后,USB 仍然为 DRP ,导致不用设置 node 即可连接 OTG。

Solution

Read more »

从 Android P 开始,Google 开始推荐厂家再定制一个 health 。前不久遇到一个定制 health 中的信息未成功反应到 Framework 的问题,在分析解决问题的过程中,学习到了一点新知识,所以就在这篇文章里根据解决问题的流程做一个小小的记录。

问题:定制 health service 中的一些 health 信息未成功反应到 Framework。

已知:定制 health 和 Google healthd 进程都运行于设备中,定制 health 主要重写 healthd_board_battery_update 函数,会通过库文件引用原生代码(system/core/healthd/)中的实现。

初步方案

简单介绍

服务创建时都编写了一个 x.rc 文件,用来描述 health service 的一些特点,其中就包括其启动时机。如下:

1
2
3
4
5
6
7
8
# system/core/healthd/android.hardware.health@2.0-service.rc
/* sevice 类型的 setction 表示一个可执行程序(进程) */
service health-hal-2-0 /vendor/bin/hw/android.hardware.health@2.0-service or healthd.rc
class hal
user system
group system
file /dev/kmsg w

启动顺序: hal-> core-> main -> later

Read more »