为了方便以后一些地方的寻找和copy
https://blog.csdn.net/Mis_wenwen/article/details/73468788
看着详细,直接拿过来,后续会继续添加
1.下拉状态栏的亮度条:
frameworks/base/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
mBrightnessView
对应布局文件:quick_settings_brightness_dialog.xml
2.滑动亮度条后过渡到桌面的亮度条
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
protected void inflateStatusBarWindow(Context context) {
mStatusBarWindow = (StatusBarWindowView) View.inflate(context,
R.layout.super_status_bar, null);
}
mStatusBarWindow
对应布局文件:super_status_bar.xml
布局文件中对应项:
3.亮度条中的滑动条样式修改
frameworks/base/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java
布局文件:status_bar_toggle_slider.xml
4.下拉状态栏的图标块 ------ 这个
有两处
/frameworks/base/packages/SystemUI/src/com/android/systemui/qs/tiles/***Tile.java
对应的Vector矢量图文件命名为ic_qs_xxx.xml
AirplaneModeTile:飞行模式,默认有动画的。用图片替换要把动画在代码中注释掉。
BatteryTile:电池。用BatteryMeterDrawable自定义view画出来的。
BluetoothTile:蓝牙
CastTile:投射
CellularTile:移动数据网络,无sim卡
ColorInversionTile:反色
DataSaverTile:流量节省程序
DataUsageDetailView:默认没显示,数据使用细节
DndTile:勿扰donot disturb
FlashlightTile:手电筒
HotspotTile:热点
IntentTile:默认没显示,不知道长啥样
LocationTile:位置信息
RotationLockTile:自动旋转,纵向
ScreenShotTile:截图
UserDetailItemView:默认没显示,不知道长啥样
UserDetailView:默认没显示,不知道长啥样
UserTile:默认没显示,不知道长啥样
WifiTile:Wlan
WorkModeTile:默认没显示,不知道长啥样
还有MTK的
/frameworks/base/packages/SystemUI/src/com/mediatek/systemui/qs/tiles/***Tile.java
HotKnotTile
ApnSettingsTile
DualSimSettingsTile
MobileDataTile
QsIconWrapper
SimDataConnectionTile
5.增删下拉状态栏的图标块,顺序和字符串顺序有关系
frameworks/base/packages/SystemUI/res/values/config.xml中修改
wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotknot,screenshot
//这个是右上角 调整按钮顺序时,需要显示的项
wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotknot,screenshot
6.WLAN图标块点击后信号强度
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/AccessPointControllerImpl.java
private static final int[] ICONS = {
R.drawable.ic_qs_wifi_full_0,
R.drawable.ic_qs_wifi_full_1,
R.drawable.ic_qs_wifi_full_2,
R.drawable.ic_qs_wifi_full_3,
R.drawable.ic_qs_wifi_full_4,
};
7.修改手机信号强度图
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
static final int[][] QS_TELEPHONY_SIGNAL_STRENGTH = {
{ R.drawable.ic_qs_signal_0,
R.drawable.ic_qs_signal_1,
R.drawable.ic_qs_signal_2,
R.drawable.ic_qs_signal_3,
R.drawable.ic_qs_signal_4 },
{ R.drawable.ic_qs_signal_full_0,
R.drawable.ic_qs_signal_full_1,
R.drawable.ic_qs_signal_full_2,
R.drawable.ic_qs_signal_full_3,
R.drawable.ic_qs_signal_full_4 }
};
8.通知栏的 单条通知栏 UI 修改, 修改背景为圆角
8.1
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
protectedvoid onFinishInflate() {}中
修改下面两句 --- 设置背景
mBackgroundNormal.setCustomBackground
mBackgroundDimmed.setCustomBackground
同时让下面两个方法为空
privatevoid updateOutlineAlpha() {}
publicvoid setFakeShadowIntensity(float shadowIntensity, floatoutlineAlpha, int shadowYEnd, intoutlineTranslation) {}
8.2
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
这个是个ViewGroup,它在onDraw里面还画了次背景。需要干掉这个背景。
让下面这个方法为空。
privatevoid updateBackground() {}
protectedvoid onDraw(Canvas canvas) {
//中注销掉下面这句
canvas.drawRect(0,mCurrentBounds.top, getWidth(), mCurrentBounds.bottom,mBackgroundPaint);
}
9.多条通知栏的背景修改
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView
默认背景就是当前界面截图加了个黑色透明度。
这个要谨改,因为会影响到按下power键唤醒屏幕时候的锁屏。如果把背景设成黑色,可能power键唤醒屏幕后,多条通知栏的背景是黑的。
10.删除修改显示布局边界,GPU呈现模式分析,Nearby 等快捷开关 tile
10.1 GPU呈现模式分析,显示布局边界都是packages/apps/Settings中的
10.2
android:label="@string/debug_layout"
android:icon="@drawable/tile_icon_show_layout"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:enabled="false">
android:label="@string/track_frame_time"
android:icon="@drawable/tile_icon_graphics"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:enabled="false">
label对应的string在framework/base/packages/SettingsLib中
icon对应的drawable在packages/apps/Settings中
packages/apps/Settings/src/com/android/settings/qstile/DevelopmentTiles.java
Nearby是谷歌的玩意,修改的话也能修改,就是加判定在TileQueryHelper.java中修改,当然上面的
GPU呈现模式分析,显示布局边界也可以这么修改。只不过不建议用这种方式修改。
删除这三个东西:
frameworks/base/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java 中
private class QueryTilesTask extends AsyncTask
doInBackground{
List
new Intent(TileService.ACTION_QS_TILE), 0, ActivityManager.getCurrentUser());
这句注释掉,不查询这些tiles
//List
// new Intent(TileService.ACTION_QS_TILE), 0, ActivityManager.getCurrentUser());
}
}
11.为原生android下拉状态栏新增自动调节亮度开关
alps/frameworks/base/packages/SystemUI/bird/res/layout/ui_icon_qs_brightness_dialog.xml
alps/frameworks/base/packages/SystemUI/bird/res/values-zh-rCN/strings.xml
alps/frameworks/base/packages/SystemUI/bird/res/values/strings.xml
alps/frameworks/base/packages/SystemUI/bird/src/com/bird/systemui/BirdFeatureOption.java
alps/frameworks/base/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml
alps/frameworks/base/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
.../base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
alps/packages/apps/Settings/src/com/android/settings/DisplaySettings.java
三个地方需要同步,设置中的显示DisplaySettings.下拉状态栏的图标处QSPanel,点击滑条后的PhoneStatusBar。
在Switch进行操作后需要变更Settings.System.SCREEN_BRIGHTNESS_MODE值。在值变化后Switch控件状态需要同步变化。
QSPanel.java中代码:
public QSPanel(Context context, AttributeSet attrs) {
//liuqipeng add 20170619 BUG #26165
if(BirdFeatureOption.BIRD_SHOW_AUTO_BRIGHT_SWITCH){
View mAutoBrightRl=findViewById(R.id.auto_bright_rl);
mAutoBrightRl.setVisibility(View.VISIBLE);
Switch mAutoBright=(Switch)findViewById(R.id.auto_bright_switch);
int brightnessMode = Settings.System.getInt(context.getContentResolver(),
SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_MANUAL);
mAutoBright.setChecked(brightnessMode != SCREEN_BRIGHTNESS_MODE_MANUAL);
mAutoBright.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Settings.System.putInt(context.getContentResolver(), SCREEN_BRIGHTNESS_MODE,
isChecked ? SCREEN_BRIGHTNESS_MODE_AUTOMATIC : SCREEN_BRIGHTNESS_MODE_MANUAL);
}
});
ContentObserver BrightnessMode = new ContentObserver(new Handler()) {
@Override
public void onChange(boolean selfChange) {
super.onChange(selfChange);
int brightnessMode = Settings.System.getInt(context.getContentResolver(),
SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_MANUAL);
mAutoBright.setChecked(brightnessMode != SCREEN_BRIGHTNESS_MODE_MANUAL);
}
};
context.getContentResolver().registerContentObserver(Settings.System.getUriFor(Settings.System.SCREEN_BRIGHTNESS_MODE),true, BrightnessMode);
}
}