安卓系统开发笔记(二)

1.ClientID相关

1.1.查看ClientID的命令

adb shell getprop  ro.com.google.clientidbase

adb shell getprop |findstr ro.com.google.clientidbase

1.2根据客户提供的文档客制化ClientID

platform/build / tools/buildinfo_telcel.sh (每个项目对应的文件不同)

#!/bin/bash

echo "ro.com.google.clientidbase=android-oppo"

echo "ro.com.google.clientidbase.ms=android-americamovil-{country}-revc"

echo "ro.com.google.clientidbase.am=android-americamovil-{country}"

echo "ro.com.google.rlz_ap_whitelist=YG"

echo "ro.com.google.rlzbrandcode=OPPO"

echo "ro.product.locale=es-US

    


2.查看亮屏问题

关键词:sysui_status_bar_state  screen_toggled  onAuthenticated  keyguardGoingAway

方法:

sysui_status_bar_state(state|1,keyguardShowing|1,keyguardOccluded|1,bouncerShowing|1,secure|1,currentlyInsecure|1)

state:状态(0屏幕关闭1屏幕打开2锁屏)   

keyguardShowing:是否显示给用户(1显示0不显示) 

keyguardOccluded:是否属于活动状态(1:keyguard处于活动状态,但另一个活动正在遮挡它)

bouncerShowing:当前解锁界面是否先是给用户:1是0否 

secure:用户是否设置安全解锁方法(PIN,密码):1是0否  

currentlyInsecure:当前是否解锁:1是0否

screen_toggled:0表示屏幕关闭,1表示屏幕打开,2表示已锁屏   

onAuthenticated ture指纹验证成功,false表示验证失败  

keyguardGoingAway:表示锁屏界面隐藏

powerkey

WindowManager: Receive Input KeyEvent of Powerkey up

WindowManager: Started going to sleep... (why=OFF_BECAUSE_OF_USER)

WindowManager: Screen turned off...

screen_toggled: 0

WindowManager: wake Up From Power Key

screen_toggled: 1

Started going to sleep|screen_toggled|wake Up From Power Key|Waking up from Asleep

Started going to sleep|screen_toggled|wake Up From Power Key|Receive Input KeyEvent of Powerkey up

WindowManager: Receive Input KeyEvent of Powerkey up


3.修改设置状态栏颜色与主界面颜色一致


platform/packages/apps/Settings / res/values/themes.xml

<style name="Theme.Settings" parent="Theme.SettingsBase">
<item name="android:statusBarColor">@android:color/white</item>

 

<style name="Theme.Settings.Home" parent="Theme.Settings.HomeBase">
<item name="android:statusBarColor">@android:color/white</item>

 

4.切换成深色主题后,点进设置中,状态栏为空白


修改对应项目values-night文件中themes属性 :/apps/Settings/res/values-night/themes.xml


 <style name="Theme.SettingsBase" parent="@android:style/Theme.DeviceDefault.Settings" > 如果没有这个属性就增加
白天修改:/apps/Settings/res/values/themes.xml


 <style name="Theme.SettingsBase" parent="@android:style/Theme.DeviceDefault.Settings">
 <item name="android:statusBarColor">@android:color/white</item>

 

 

5.修改充电动效View的位置


有时候动效很快,为了方便抓动效的view在开发者模式中调低窗口动画,过度动画

Animator时长缩放   NotificationShade

6.暗黑模式


mContext.getResources().getConfiguration().uiMode   获取当前Activity的模式
public static final int UI_MODE_NIGHT_YES = 0x20; 暗黑模式   UI_MODE_NIGHT_NO = 0x10;亮色模式
onConfigurationChanged 监听系统暗黑模式状态
public static boolean isNightMode(Context context) {
    final int currentNightMode =
            context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
    return currentNightMode == Configuration.UI_MODE_NIGHT_YES;
    


7.【需求】【设置页面色差】标题栏和内容界面存在色差

      
修改类:com.android.settings.widget.EntityHeaderController


import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
        int color = Color.parseColor("#ffffff");
        ColorDrawable drawable = new ColorDrawable(color);
        actionBar.setBackgroundDrawable(drawable);

 

其他

拨号快捷键
*#6776# 查询PCB Number,手机的专案号就是PCB中00后面的一串值
*#8011# 启动oppo 的usb调试
*#391#  查询国家码

查看手机版本:adb shell getprop ro.boot.product.prjversion
adb shell getprop | findstr 217
adb shell cat /proc/oppoVersion/prjName
查看分辨率:adb shell wm size

查看当前焦点:adb shell dumpsys window  |findstr mCurrent
adb shell dumpsys activity |findstr “mResume”
adb shell dumpsys window |findstr "mCurrentFocus"
adb shell dumpsys SurfaceFlinger :获取桌面显示数据

path:要查找的目录路径。 
       ~ 表示$HOME目录
       . 表示当前目录
       / 表示根目录
1、按名字查找 
      在当前目录及子目录中,查找大写字母开头的txt文件   $ find . -name '[A-Z]*.txt' -print   
      在/etc及其子目录中,查找host开头的文件   $ find /etc -name 'host*' -print   
      在$HOME目录及其子目录中,查找所有文件   $ find ~ -name '*' -print 
      在当前目录及子目录中,查找不是out开头的txt文件  $ find . -name "out*" -prune -o -name "*.txt" -print  

2、按目录查找   
      在当前目录除aa之外的子目录内搜索 txt文件         $ find . -path "./aa" -prune -o -name "*.txt" -print   
      在当前目录及除aa和bb之外的子目录中查找txt文件    $ find . −path′./dir0′−o−path′./dir1′−path′./dir0′−o−path′./dir1′ -a -prune -o -name '*.txt' -print
      
获取手机Settings.Secure.ANDROID_ID:adb shell settings get secure android_id
系统属性:adb shell getprop | findstr product
查看机型:adb shell getprop ro.product.model
获取系统版本:adb shell getprop ro.build.version.release
获取系统api版本:adb shell getprop ro.build.version.sdk
查看手机分辨率:adb shell dumpsys window displays(详细) adb shell wm size(简单)
获取设备名称:adb shell cat /system/build.prop
单编framework下的资源文件       make framework-res       adb push framework-res.apk /system/framework 

查看通知栏消息:adb shell dumpsys notification
对内容做查找:adb shell dumpsys notification | findstr tickerText
adb logcat -b all |grep notification
1.adb root
2.adb remount
3.adb shell pm enable com.android.systemui/com.android.systemui.tuner.TunerActivity
4.adb shell am start -n com.android.systemui/com.android.systemui.tuner.TunerActivity
5.此时进入了System UI Tuner界面,点击status bar,滑动到页面底部,点击time,选择显示时分秒,此时状态栏上的时间会显示“秒”
adb shell pm clear com.android.launcher3   清空桌面布局缓存

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值