Loading core/res/res/values/config.xml +15 −0 Original line number Diff line number Diff line Loading @@ -7352,6 +7352,21 @@ default on this device--> <string-array translatable="false" name="config_notificationDefaultUnsupportedAdjustments" /> <!-- Preference name of bugreport--> <string name="prefs_bugreport" translatable="false">bugreports</string> <!-- key value of warning state stored in bugreport preference--> <string name="key_warning_state" translatable="false">warning-state</string> <!-- Bugreport warning dialog state unknown--> <integer name="bugreport_state_unknown">0</integer> <!-- Bugreport warning dialog state shows the warning dialog--> <integer name="bugreport_state_show">1</integer> <!-- Bugreport warning dialog state skips the warning dialog--> <integer name="bugreport_state_hide">2</integer> <!-- By default ActivityOptions#makeScaleUpAnimation is only used between activities. This config enables OEMs to support its usage across tasks.--> <bool name="config_enableCrossTaskScaleUpAnimation">false</bool> Loading core/res/res/values/symbols.xml +6 −0 Original line number Diff line number Diff line Loading @@ -5906,6 +5906,12 @@ <java-symbol type="string" name="usb_apm_usb_suspicious_activity_notification_title" /> <java-symbol type="string" name="usb_apm_usb_suspicious_activity_notification_text" /> <java-symbol type="string" name="prefs_bugreport" /> <java-symbol type="string" name="key_warning_state" /> <java-symbol type="integer" name="bugreport_state_unknown" /> <java-symbol type="integer" name="bugreport_state_show" /> <java-symbol type="integer" name="bugreport_state_hide" /> <!-- Enable OEMs to support scale up anim across tasks.--> <java-symbol type="bool" name="config_enableCrossTaskScaleUpAnimation" /> Loading packages/Shell/src/com/android/shell/BugreportPrefs.java +14 −15 Original line number Diff line number Diff line Loading @@ -23,25 +23,24 @@ import android.content.SharedPreferences; * Preferences related to bug reports. */ final class BugreportPrefs { static final String PREFS_BUGREPORT = "bugreports"; private static final String KEY_WARNING_STATE = "warning-state"; static final int STATE_UNKNOWN = 0; // Shows the warning dialog. static final int STATE_SHOW = 1; // Skips the warning dialog. static final int STATE_HIDE = 2; static int getWarningState(Context context, int def) { final SharedPreferences prefs = context.getSharedPreferences( PREFS_BUGREPORT, Context.MODE_PRIVATE); return prefs.getInt(KEY_WARNING_STATE, def); String prefsBugreport = context.getResources().getString( com.android.internal.R.string.prefs_bugreport); String keyWarningState = context.getResources().getString( com.android.internal.R.string.key_warning_state); final SharedPreferences prefs = context.getSharedPreferences(prefsBugreport, Context.MODE_PRIVATE); return prefs.getInt(keyWarningState, def); } static void setWarningState(Context context, int value) { final SharedPreferences prefs = context.getSharedPreferences( PREFS_BUGREPORT, Context.MODE_PRIVATE); prefs.edit().putInt(KEY_WARNING_STATE, value).apply(); String prefsBugreport = context.getResources().getString( com.android.internal.R.string.prefs_bugreport); String keyWarningState = context.getResources().getString( com.android.internal.R.string.key_warning_state); final SharedPreferences prefs = context.getSharedPreferences(prefsBugreport, Context.MODE_PRIVATE); prefs.edit().putInt(keyWarningState, value).apply(); } } packages/Shell/src/com/android/shell/BugreportProgressService.java +5 −3 Original line number Diff line number Diff line Loading @@ -21,8 +21,6 @@ import static android.content.pm.PackageManager.FEATURE_LEANBACK; import static android.content.pm.PackageManager.FEATURE_TELEVISION; import static android.os.Process.THREAD_PRIORITY_BACKGROUND; import static com.android.shell.BugreportPrefs.STATE_HIDE; import static com.android.shell.BugreportPrefs.STATE_UNKNOWN; import static com.android.shell.BugreportPrefs.getWarningState; import static com.android.shell.flags.Flags.handleBugreportsForWear; Loading Loading @@ -1347,7 +1345,11 @@ public class BugreportProgressService extends Service { } private boolean hasUserDecidedNotToGetWarningMessage() { return getWarningState(mContext, STATE_UNKNOWN) == STATE_HIDE; int bugreportStateUnknown = mContext.getResources().getInteger( com.android.internal.R.integer.bugreport_state_unknown); int bugreportStateHide = mContext.getResources().getInteger( com.android.internal.R.integer.bugreport_state_hide); return getWarningState(mContext, bugreportStateUnknown) == bugreportStateHide; } private void maybeShowWarningMessageAndCloseNotification(int id) { Loading packages/Shell/src/com/android/shell/BugreportWarningActivity.java +16 −7 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ package com.android.shell; import static com.android.shell.BugreportPrefs.STATE_HIDE; import static com.android.shell.BugreportPrefs.STATE_SHOW; import static com.android.shell.BugreportPrefs.STATE_UNKNOWN; import static com.android.shell.BugreportPrefs.getWarningState; import static com.android.shell.BugreportPrefs.setWarningState; import static com.android.shell.BugreportProgressService.sendShareIntent; Loading Loading @@ -69,12 +66,19 @@ public class BugreportWarningActivity extends AlertActivity mConfirmRepeat = (CheckBox) ap.mView.findViewById(android.R.id.checkbox); final int state = getWarningState(this, STATE_UNKNOWN); int bugreportStateUnknown = getResources().getInteger( com.android.internal.R.integer.bugreport_state_unknown); int bugreportStateHide = getResources().getInteger( com.android.internal.R.integer.bugreport_state_hide); int bugreportStateShow = getResources().getInteger( com.android.internal.R.integer.bugreport_state_show); final int state = getWarningState(this, bugreportStateUnknown); final boolean checked; if (Build.IS_USER) { checked = state == STATE_HIDE; // Only checks if specifically set to. checked = state == bugreportStateHide; // Only checks if specifically set to. } else { checked = state != STATE_SHOW; // Checks by default. checked = state != bugreportStateShow; // Checks by default. } mConfirmRepeat.setChecked(checked); Loading @@ -83,9 +87,14 @@ public class BugreportWarningActivity extends AlertActivity @Override public void onClick(DialogInterface dialog, int which) { int bugreportStateHide = getResources().getInteger( com.android.internal.R.integer.bugreport_state_hide); int bugreportStateShow = getResources().getInteger( com.android.internal.R.integer.bugreport_state_show); if (which == AlertDialog.BUTTON_POSITIVE) { // Remember confirm state, and launch target setWarningState(this, mConfirmRepeat.isChecked() ? STATE_HIDE : STATE_SHOW); setWarningState(this, mConfirmRepeat.isChecked() ? bugreportStateHide : bugreportStateShow); if (mSendIntent != null) { sendShareIntent(this, mSendIntent); } Loading Loading
core/res/res/values/config.xml +15 −0 Original line number Diff line number Diff line Loading @@ -7352,6 +7352,21 @@ default on this device--> <string-array translatable="false" name="config_notificationDefaultUnsupportedAdjustments" /> <!-- Preference name of bugreport--> <string name="prefs_bugreport" translatable="false">bugreports</string> <!-- key value of warning state stored in bugreport preference--> <string name="key_warning_state" translatable="false">warning-state</string> <!-- Bugreport warning dialog state unknown--> <integer name="bugreport_state_unknown">0</integer> <!-- Bugreport warning dialog state shows the warning dialog--> <integer name="bugreport_state_show">1</integer> <!-- Bugreport warning dialog state skips the warning dialog--> <integer name="bugreport_state_hide">2</integer> <!-- By default ActivityOptions#makeScaleUpAnimation is only used between activities. This config enables OEMs to support its usage across tasks.--> <bool name="config_enableCrossTaskScaleUpAnimation">false</bool> Loading
core/res/res/values/symbols.xml +6 −0 Original line number Diff line number Diff line Loading @@ -5906,6 +5906,12 @@ <java-symbol type="string" name="usb_apm_usb_suspicious_activity_notification_title" /> <java-symbol type="string" name="usb_apm_usb_suspicious_activity_notification_text" /> <java-symbol type="string" name="prefs_bugreport" /> <java-symbol type="string" name="key_warning_state" /> <java-symbol type="integer" name="bugreport_state_unknown" /> <java-symbol type="integer" name="bugreport_state_show" /> <java-symbol type="integer" name="bugreport_state_hide" /> <!-- Enable OEMs to support scale up anim across tasks.--> <java-symbol type="bool" name="config_enableCrossTaskScaleUpAnimation" /> Loading
packages/Shell/src/com/android/shell/BugreportPrefs.java +14 −15 Original line number Diff line number Diff line Loading @@ -23,25 +23,24 @@ import android.content.SharedPreferences; * Preferences related to bug reports. */ final class BugreportPrefs { static final String PREFS_BUGREPORT = "bugreports"; private static final String KEY_WARNING_STATE = "warning-state"; static final int STATE_UNKNOWN = 0; // Shows the warning dialog. static final int STATE_SHOW = 1; // Skips the warning dialog. static final int STATE_HIDE = 2; static int getWarningState(Context context, int def) { final SharedPreferences prefs = context.getSharedPreferences( PREFS_BUGREPORT, Context.MODE_PRIVATE); return prefs.getInt(KEY_WARNING_STATE, def); String prefsBugreport = context.getResources().getString( com.android.internal.R.string.prefs_bugreport); String keyWarningState = context.getResources().getString( com.android.internal.R.string.key_warning_state); final SharedPreferences prefs = context.getSharedPreferences(prefsBugreport, Context.MODE_PRIVATE); return prefs.getInt(keyWarningState, def); } static void setWarningState(Context context, int value) { final SharedPreferences prefs = context.getSharedPreferences( PREFS_BUGREPORT, Context.MODE_PRIVATE); prefs.edit().putInt(KEY_WARNING_STATE, value).apply(); String prefsBugreport = context.getResources().getString( com.android.internal.R.string.prefs_bugreport); String keyWarningState = context.getResources().getString( com.android.internal.R.string.key_warning_state); final SharedPreferences prefs = context.getSharedPreferences(prefsBugreport, Context.MODE_PRIVATE); prefs.edit().putInt(keyWarningState, value).apply(); } }
packages/Shell/src/com/android/shell/BugreportProgressService.java +5 −3 Original line number Diff line number Diff line Loading @@ -21,8 +21,6 @@ import static android.content.pm.PackageManager.FEATURE_LEANBACK; import static android.content.pm.PackageManager.FEATURE_TELEVISION; import static android.os.Process.THREAD_PRIORITY_BACKGROUND; import static com.android.shell.BugreportPrefs.STATE_HIDE; import static com.android.shell.BugreportPrefs.STATE_UNKNOWN; import static com.android.shell.BugreportPrefs.getWarningState; import static com.android.shell.flags.Flags.handleBugreportsForWear; Loading Loading @@ -1347,7 +1345,11 @@ public class BugreportProgressService extends Service { } private boolean hasUserDecidedNotToGetWarningMessage() { return getWarningState(mContext, STATE_UNKNOWN) == STATE_HIDE; int bugreportStateUnknown = mContext.getResources().getInteger( com.android.internal.R.integer.bugreport_state_unknown); int bugreportStateHide = mContext.getResources().getInteger( com.android.internal.R.integer.bugreport_state_hide); return getWarningState(mContext, bugreportStateUnknown) == bugreportStateHide; } private void maybeShowWarningMessageAndCloseNotification(int id) { Loading
packages/Shell/src/com/android/shell/BugreportWarningActivity.java +16 −7 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ package com.android.shell; import static com.android.shell.BugreportPrefs.STATE_HIDE; import static com.android.shell.BugreportPrefs.STATE_SHOW; import static com.android.shell.BugreportPrefs.STATE_UNKNOWN; import static com.android.shell.BugreportPrefs.getWarningState; import static com.android.shell.BugreportPrefs.setWarningState; import static com.android.shell.BugreportProgressService.sendShareIntent; Loading Loading @@ -69,12 +66,19 @@ public class BugreportWarningActivity extends AlertActivity mConfirmRepeat = (CheckBox) ap.mView.findViewById(android.R.id.checkbox); final int state = getWarningState(this, STATE_UNKNOWN); int bugreportStateUnknown = getResources().getInteger( com.android.internal.R.integer.bugreport_state_unknown); int bugreportStateHide = getResources().getInteger( com.android.internal.R.integer.bugreport_state_hide); int bugreportStateShow = getResources().getInteger( com.android.internal.R.integer.bugreport_state_show); final int state = getWarningState(this, bugreportStateUnknown); final boolean checked; if (Build.IS_USER) { checked = state == STATE_HIDE; // Only checks if specifically set to. checked = state == bugreportStateHide; // Only checks if specifically set to. } else { checked = state != STATE_SHOW; // Checks by default. checked = state != bugreportStateShow; // Checks by default. } mConfirmRepeat.setChecked(checked); Loading @@ -83,9 +87,14 @@ public class BugreportWarningActivity extends AlertActivity @Override public void onClick(DialogInterface dialog, int which) { int bugreportStateHide = getResources().getInteger( com.android.internal.R.integer.bugreport_state_hide); int bugreportStateShow = getResources().getInteger( com.android.internal.R.integer.bugreport_state_show); if (which == AlertDialog.BUTTON_POSITIVE) { // Remember confirm state, and launch target setWarningState(this, mConfirmRepeat.isChecked() ? STATE_HIDE : STATE_SHOW); setWarningState(this, mConfirmRepeat.isChecked() ? bugreportStateHide : bugreportStateShow); if (mSendIntent != null) { sendShareIntent(this, mSendIntent); } Loading