diff options
| author | 2016-04-26 17:40:27 +0000 | |
|---|---|---|
| committer | 2016-04-26 17:40:29 +0000 | |
| commit | 34510eb2933b98f0c8c73f9a7be5eae911a14210 (patch) | |
| tree | 6e9c27e38c59f0b70c2116d42aa3e22128cae9e6 | |
| parent | 69582262f0dfa8cdca232d03ff3239fa026326ab (diff) | |
| parent | af096719c0e45a2b7d67e9267b40cffdc16f441a (diff) | |
Merge "Don't opt-out of warning dialog by default on user builds." into nyc-dev
| -rw-r--r-- | packages/Shell/src/com/android/shell/BugreportWarningActivity.java | 11 | ||||
| -rw-r--r-- | packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java | 10 |
2 files changed, 19 insertions, 2 deletions
diff --git a/packages/Shell/src/com/android/shell/BugreportWarningActivity.java b/packages/Shell/src/com/android/shell/BugreportWarningActivity.java index da33a654f910..2426ba099dce 100644 --- a/packages/Shell/src/com/android/shell/BugreportWarningActivity.java +++ b/packages/Shell/src/com/android/shell/BugreportWarningActivity.java @@ -25,6 +25,7 @@ import static com.android.shell.BugreportPrefs.setWarningState; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; +import android.os.Build; import android.os.Bundle; import android.view.LayoutInflater; import android.widget.CheckBox; @@ -59,7 +60,15 @@ public class BugreportWarningActivity extends AlertActivity ap.mNegativeButtonListener = this; mConfirmRepeat = (CheckBox) ap.mView.findViewById(android.R.id.checkbox); - mConfirmRepeat.setChecked(getWarningState(this, STATE_UNKNOWN) != STATE_SHOW); + + final int state = getWarningState(this, STATE_UNKNOWN); + final boolean checked; + if (Build.TYPE.equals("user")) { + checked = state == STATE_HIDE; // Only checks if specifically set to. + } else { + checked = state != STATE_SHOW; // Checks by default. + } + mConfirmRepeat.setChecked(checked); setupAlert(); } diff --git a/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java b/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java index 07c154645e44..44e956abeb02 100644 --- a/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java +++ b/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java @@ -63,6 +63,7 @@ import android.app.NotificationManager; import android.content.Context; import android.content.Intent; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.SystemProperties; import android.service.notification.StatusBarNotification; @@ -517,7 +518,14 @@ public class BugreportReceiverTest extends InstrumentationTestCase { mUiBot.getVisibleObject(mContext.getString(R.string.bugreport_confirm_dont_repeat)); final boolean firstTime = propertyState == null || propertyState == STATE_UNKNOWN; if (firstTime) { - assertTrue("Checkbox should be checked by default", dontShowAgain.isChecked()); + if (Build.TYPE.equals("user")) { + assertFalse("Checkbox should NOT be checked by default on user builds", + dontShowAgain.isChecked()); + mUiBot.click(dontShowAgain, "dont-show-again"); + } else { + assertTrue("Checkbox should be checked by default on build type " + Build.TYPE, + dontShowAgain.isChecked()); + } } else { assertFalse("Checkbox should not be checked", dontShowAgain.isChecked()); mUiBot.click(dontShowAgain, "dont-show-again"); |