Android 13 原生系统下拉状态栏中是没有快捷截图按钮,现在需要添加快捷截图功能。
添加快捷截图功能后的效果图:
涉及修改的文件如下:
modified: vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml
modified: vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
add: vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_screenshot.xml
add: vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tiles/ScreenShotTile.java
具体修改如下:
1.在config.xml中的quick_settings_tiles_default添加快捷截图配置
--- a/mtk/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml
+++ b/mtk/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml
@@ -74,7 +74,7 @@
<!-- The default tiles to display in QuickSettings -->
<string name="quick_settings_tiles_default" translatable="false">
- internet,bt,dnd,airplane,night,screenrecord,volume
+ internet,bt,dnd,airplane,night,screenrecord,volume,screenshot
</string>
<!-- The class path of the Safety Quick Settings Tile -->
2.在QSFactoryImpl.java中添加快捷截图功能
--- a/mtk/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
+++ b/mtk/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
@@ -54,6 +54,7 @@ import com.android.systemui.qs.tiles.QuickAccessWalletTile;
import com.android.systemui.qs.tiles.ReduceBrightColorsTile;
import com.android.systemui.qs.tiles.RotationLockTile;
import com.android.systemui.qs.tiles.ScreenRecordTile;
+import com.android.systemui.qs.tiles.ScreenShotTile;
import com.android.systemui.qs.tiles.UiModeNightTile;
import com.android.systemui.qs.tiles.WifiTile;
import com.android.systemui.qs.tiles.WorkModeTile;
@@ -100,6 +101,7 @@ public class QSFactoryImpl implements QSFactory {
private final Provider<GarbageMonitor.MemoryTile> mMemoryTileProvider