NotoSansTeluguUI-Regular.ttf
-------------------------------------------------------------------------------------------------
NotoSansThaiUI-Bold.ttf 泰语字库
NotoSansThaiUI-Regular.ttf
=======================================================
2.Android手机做热点时,如何获取连过来设备的具体信息?
1、连接过来的设备的信息存放在/data/misc/dhcp/dnsmasq.leases中
2、它的格式是:
/系统id,不需取值/client mac地址/client ip地址/ client device name/加权后mac地址,也不需取值
1357041758 88:00:12:34:56:78 192.168.43.133 android-184cc6c105d7a3b 01:88:00:12:34:56:78
3、参考WifiServie.java的getClientIp()方法,可以自定义这个方法取得device name,具体如下:
public String getClientDeviceName(String deviceAddress) {//传mac地址进来
enforceAccessPermission();
if (TextUtils.isEmpty(deviceAddress)) {
return null;
}
//读取对应的文件信息
for (String s : readClientList("/data/misc/dhcp/dnsmasq.leases")) {
if (s.indexOf(deviceAddress) != -1) {
String[] fields = s.split(" ");
//校验数据是否破损
if (fields.length > 4) {
//返回第4个栏位
return fields[3];
}
}
}
return null;
}
3.在Fastboot里添加命令
fastboot 是android 默认的一种debug 方法,它的好处是在进入linux kernel 之前
即可操作。
默认fastboot 支持的命令:
usage: fastboot [ ]
commands:
update reflash device from
update.zip
flashall flash boot
- recovery + system
flash [ ] write a file to a flash
partition
erase erase a flash
partition
format format a flash
partition
getvar display a
bootloader variable
boot [ ] download and boot kernel
flash:raw boot [ ] create bootimage and flash it
devices list all
connected devices
continue continue
with autoboot
reboot reboot
device normally
reboot-bootloader reboot device
into bootloader
help show this
help message
options:
-w erase userdata and cache (and
format if supported by partition type)
-u do not first erase partition
before formatting
-s specify device serial number or path to
device port
-l with “devices”, lists device
paths
-p specify product name
-c override kernel commandline
-i specify a custom USB vendor id
-b <base_addr> specify a custom kernel base
address
-n specify the nand page size.
default: 2048
-S [K|M|G] automatically sparse files
greater than size. 0 to disable
fastboot 提供了扩展的命令符号
fastboot oem command args
下面以fastboot oem hello test 来说明如何扩展
(1).在bootable/bootloader/lk/app/mt_boot/fastboot.c
的fastboot_init 函数中添加一个新的register
//第一个参数是命令的名称
//第二个参数是命令的执行函数
//第三个参数是在security IC 中是否还提供此命令
fastboot_register(“oem hello”, cmd_oem_hello, FALSE);
(2). 实现cmd_oem_hello 函数
void cmd_oem_hello(const char *arg, void *data, unsigned size) {
//注意args 是以command 结束开始,即" args"
if(!strncmp(arg, " OK", strlen(" OK"))){
fastboot_okey(“OK”);
}else{
fastboot_fail(“Not OK”);
}
}
(3). 与PC 端交互
您可以使用下面已经定义好的三个函数与PC 端交互
fastboot_okey(const char* result);
fastboot_fail(const char* reason);
fastboot_info(const char* reason);
注意这三个打印字符串的长度都不能超过64-1-4 = 59 个字
4.在任意界面按某个实体键进入某个Activity
有些手机会有附加的功能键,比如拍照实体键,甚至有两端式的,轻按聚焦,深按拍照。那么类似功能是如何在Android手机上实现的呢?
可以修改源码下
frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java文件中的如下方法:
public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event,int policyFlags)
找到如下代码段:
else if (keyCode == KeyEvent.KEYCODE_APP_SWITCH) {
if (down && repeatCount == 0 && !keyguardOn) {
showOrHideRecentAppsDialog(RECENT_APPS_BEHAVIOR_SHOW_OR_DISMISS);
}
return -1;
}
在这个else if后面增加相应代码:
else if (keyCode == KeyEvent.KEYCODE_APP_SWITCH) {
if (down && repeatCount == 0 && !keyguardOn) {
showOrHideRecentAppsDialog(RECENT_APPS_BEHAVIOR_SHOW_OR_DISMISS);
}
return -1;
} //add begin
else if (keyCode == KeyEvent.KEYCODE_XXX) {
if (down && repeatCount == 0 && !keyguardOn) {
mContext.startActivity(new Intent(“intent.xxx”)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}
return -1;