diff options
author | Hui Wang <huiwang@google.com> | 2021-11-08 23:28:43 +0000 |
---|---|---|
committer | Hui Wang <huiwang@google.com> | 2021-11-08 23:28:43 +0000 |
commit | 5b74f78a2787f1d337592e459cfb1dcc5a3d4b7e (patch) | |
tree | b6c2ef548b8c9b00be02f2b4f5335bb069d3afb2 | |
parent | d18021184ebe5a2120e3da9a909b4c1dab1c7a39 (diff) | |
download | CellBroadcastReceiver-5b74f78a2787f1d337592e459cfb1dcc5a3d4b7e.tar.gz |
Revert "Disable navigation bar and quick settings for Chile"
Revert submission 16198654-disable_sys_ui
Reason for revert: cause aosp bootup failure
Reverted Changes:
I9baf3c191:Add android.permission.STATUS_BAR for cellbroadcas...
I3d9ceac46:Disable navigation bar and quick settings for Chil...
Id17fcb858:Disable navigation bar and quick settings for Chil...
Change-Id: I859fc557d95436f4a01134be32982096ab25c9de
-rw-r--r-- | AndroidManifest.xml | 1 | ||||
-rw-r--r-- | AndroidManifest_Platform.xml | 1 | ||||
-rw-r--r-- | res/values-mcc730/config.xml | 3 | ||||
-rw-r--r-- | res/values/config.xml | 5 | ||||
-rw-r--r-- | src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java | 57 |
5 files changed, 1 insertions, 66 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 41b6cda9f..00fa2a44d 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -42,7 +42,6 @@ <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" /> <uses-permission android:name="android.permission.MODIFY_CELL_BROADCASTS" /> <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> - <uses-permission android:name="android.permission.STATUS_BAR" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" /> <uses-permission android:name="android.permission.MANAGE_USERS" /> diff --git a/AndroidManifest_Platform.xml b/AndroidManifest_Platform.xml index 97fe7231a..4e2992b08 100644 --- a/AndroidManifest_Platform.xml +++ b/AndroidManifest_Platform.xml @@ -28,7 +28,6 @@ <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" /> <uses-permission android:name="android.permission.MODIFY_CELL_BROADCASTS" /> <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> - <uses-permission android:name="android.permission.STATUS_BAR" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" /> <uses-permission android:name="android.permission.MANAGE_USERS" /> diff --git a/res/values-mcc730/config.xml b/res/values-mcc730/config.xml index 50f0f641f..f7396f5ef 100644 --- a/res/values-mcc730/config.xml +++ b/res/values-mcc730/config.xml @@ -66,9 +66,6 @@ <string name="link_method" translatable="false">none</string> <!-- Whether the user can mute the alert by physical button --> <bool name="mute_by_physical_button">false</bool> - <!-- Whether to disable the status bar while alert is showing, not allow - users to interact with other activities until pressing the "ok" button --> - <bool name="disable_status_bar">true</bool> <!-- Whether to disable the opt-out dialog for all channels --> <bool name="disable_opt_out_dialog">true</bool> <bool name="show_main_switch_settings">false</bool> diff --git a/res/values/config.xml b/res/values/config.xml index 9c2c0c2f6..de63dfa54 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -261,11 +261,6 @@ KR carriers mandate to always show notifications along with alert dialog. --> <bool name="show_alert_dialog_with_notification">false</bool> - <!-- Whether to disable status bar while alert dialog is showing. - Some carriers mandate this to make sure users do not switch to other activities - until pressing the "ok" button --> - <bool name="disable_status_bar">false</bool> - <!-- Whether to show the alert dialog at the bottom of the screen in order to avoid blocking other content --> <bool name="alert_dialog_bottom">false</bool> diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java index 7a5b22813..551429969 100644 --- a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java +++ b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java @@ -24,7 +24,6 @@ import android.app.KeyguardManager; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.RemoteAction; -import android.app.StatusBarManager; import android.content.BroadcastReceiver; import android.content.ClipData; import android.content.ClipboardManager; @@ -73,8 +72,6 @@ import com.android.internal.annotations.VisibleForTesting; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; @@ -374,9 +371,7 @@ public class CellBroadcastAlertDialog extends Activity { // Disable home button when alert dialog is showing if mute_by_physical_button is false. if (!CellBroadcastSettings.getResourcesForDefaultSubId(getApplicationContext()) - .getBoolean(R.bool.mute_by_physical_button) && !CellBroadcastSettings - .getResourcesForDefaultSubId(getApplicationContext()) - .getBoolean(R.bool.disable_status_bar)) { + .getBoolean(R.bool.mute_by_physical_button)) { final View decorView = win.getDecorView(); decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); } @@ -472,10 +467,6 @@ public class CellBroadcastAlertDialog extends Activity { mAnimationHandler.startIconAnimation(subId); } } - // Some LATAM carriers mandate to disable navigation bars, quick settings etc when alert - // dialog is showing. This is to make sure users to ack the alert before switching to - // other activities. - setStatusBarDisabledIfNeeded(true); } /** @@ -486,7 +477,6 @@ public class CellBroadcastAlertDialog extends Activity { public void onPause() { Log.d(TAG, "onPause called"); mAnimationHandler.stopIconAnimation(); - setStatusBarDisabledIfNeeded(false); super.onPause(); } @@ -1171,49 +1161,4 @@ public class CellBroadcastAlertDialog extends Activity { } return dialogMessageList; } - - /** - * To disable navigation bars, quick settings etc. Force users to engage with the alert dialog - * before switching to other activities. - * - * @param disable if set to {@code true} to disable the status bar. {@code false} otherwise. - */ - private void setStatusBarDisabledIfNeeded(boolean disable) { - if (!CellBroadcastSettings.getResourcesForDefaultSubId(getApplicationContext()) - .getBoolean(R.bool.disable_status_bar)) { - return; - } - try { - // TODO change to system API in future. - StatusBarManager statusBarManager = getSystemService(StatusBarManager.class); - Method disableMethod = StatusBarManager.class.getDeclaredMethod( - "disable", int.class); - Method disableMethod2 = StatusBarManager.class.getDeclaredMethod( - "disable2", int.class); - if (disable) { - // flags to be disabled - int disableHome = StatusBarManager.class.getDeclaredField("DISABLE_HOME") - .getInt(null); - int disableRecent = StatusBarManager.class - .getDeclaredField("DISABLE_RECENT").getInt(null); - int disableBack = StatusBarManager.class.getDeclaredField("DISABLE_BACK") - .getInt(null); - int disableQuickSettings = StatusBarManager.class.getDeclaredField( - "DISABLE2_QUICK_SETTINGS").getInt(null); - int disableNotificationShaded = StatusBarManager.class.getDeclaredField( - "DISABLE2_NOTIFICATION_SHADE").getInt(null); - disableMethod.invoke(statusBarManager, disableHome | disableBack | disableRecent); - disableMethod2.invoke(statusBarManager, disableQuickSettings - | disableNotificationShaded); - } else { - int disableNone = StatusBarManager.class.getDeclaredField("DISABLE_NONE") - .getInt(null); - disableMethod.invoke(statusBarManager, disableNone); - disableMethod2.invoke(statusBarManager, disableNone); - } - } catch (NoSuchFieldException | IllegalAccessException - | NoSuchMethodException | InvocationTargetException e) { - Log.e(TAG, "Failed to disable navigation when showing alert: " + e); - } - } } |