需要修改关机弹窗界面,当前界面我已经按照客户需求去掉emergency
但是客户需要按其他区域可以实现返回,也就是点击黑色背景取消dialog
嗑代码发现黑色布局为:
<node index="0" text="" resource-id="com.android.systemui:id/global_actions_grid_root" class="android.widget.LinearLayout" package="com.android.systemui" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,200][1536,1964]"/>
</node>
监听它并取消弹窗:
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
index ff25439a5f9f..fd0c83a225ee 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
@@ -221,7 +221,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
protected final ArrayList<Action> mPowerItems = new ArrayList<>();
@VisibleForTesting
- protected ActionsDialog mDialog;
+ //protected ActionsDialog mDialog;
+ protected static ActionsDialog mDialog;
private Action mSilentModeAction;
private ToggleAction mAirplaneModeOn;
@@ -537,6 +538,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
mDialog.getWindow().setAttributes(attrs);
// Don't acquire soft keyboard focus, to avoid destroying state when capturing bugreports
mDialog.getWindow().setFlags(FLAG_ALT_FOCUSABLE_IM, FLAG_ALT_FOCUSABLE_IM);
+ android.util.Log.w("GlobalActionsDialog", "lqx handleShow ");
+ mDialog.setCanceledOnTouchOutside(true);
mDialog.show();
mWindowManagerFuncs.onGlobalActionsShown();
}
@@ -2335,6 +2340,22 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
return true;
}
});
+
+ //add lqx
+ ViewGroup test111 = findViewById(com.android.systemui.R.id.global_actions_grid_root);
+ android.util.Log.w("GlobalActionsDialog", "lqx ------- ");
+ test111.setClickable(true);
+ test111.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ // 关闭对话框 lqx
+ android.util.Log.w("GlobalActionsDialog", "lqx setOnClickListener onClick ");
+ if(mDialog != null) {
+ mDialog.dismiss();
+ }
+ }
+ });
+
mGlobalActionsLayout.setRotationListener(this::onRotate);
mGlobalActionsLayout.setAdapter(mAdapter);
mContainer = findViewById(com.android.systemui.R.id.global_actions_container);