Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06e650cd authored by Felipe Leme's avatar Felipe Leme Committed by android-build-merger
Browse files

Merge "Revert warning logic so it has a "don\'t show again" message." into nyc-dev

am: 7fd1cbd4

* commit '7fd1cbd4':
  Revert warning logic so it has a "don't show again" message.

Change-Id: Ie2ca3b9be95991b8d0087bd83c49ed85df33b0c9
parents 7a65e3e7 7fd1cbd4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -38,5 +38,5 @@
        android:id="@android:id/checkbox"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/bugreport_confirm_repeat" />
        android:text="@string/bugreport_confirm_dont_repeat" />
</LinearLayout>
+3 −3
Original line number Diff line number Diff line
@@ -35,9 +35,9 @@
    <string name="bugreport_finished_pending_screenshot_text" product="default">Tap to share your bug report without a screenshot or wait for the screenshot to finish</string>

    <!-- Body of dialog informing user about contents of a bugreport. [CHAR LIMIT=NONE] -->
    <string name="bugreport_confirm">Bug reports contain data from the system\'s various log files, including personal and private information.  Only share bug reports with apps and people you trust.</string>
    <!-- Checkbox that indicates this dialog should be shown again when the next bugreport is taken. [CHAR LIMIT=50] -->
    <string name="bugreport_confirm_repeat">Show this message next time</string>
    <string name="bugreport_confirm">Bug reports contain data from the system\'s various log files, which may include data you consider sensitive (such as app-usage and location data). Only share bug reports with people and apps you trust.</string>
    <!-- Checkbox that indicates this dialog should not be shown again when the next bugreport is taken. [CHAR LIMIT=50] -->
    <string name="bugreport_confirm_dont_repeat">Don\'t show again</string>

    <!-- Title for documents backend that offers bugreports. -->
    <string name="bugreport_storage_title">Bug reports</string>
+9 −7
Original line number Diff line number Diff line
@@ -22,22 +22,24 @@ import android.content.SharedPreferences;
/**
 * Preferences related to bug reports.
 */
public class BugreportPrefs {
    private static final String PREFS_BUGREPORT = "bugreports";
final class BugreportPrefs {
    static final String PREFS_BUGREPORT = "bugreports";

    private static final String KEY_WARNING_STATE = "warning-state";

    public static final int STATE_UNKNOWN = 0;
    public static final int STATE_SHOW = 1;
    public static final int STATE_HIDE = 2;
    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;

    public static int getWarningState(Context context, int def) {
    static int getWarningState(Context context, int def) {
        final SharedPreferences prefs = context.getSharedPreferences(
                PREFS_BUGREPORT, Context.MODE_PRIVATE);
        return prefs.getInt(KEY_WARNING_STATE, def);
    }

    public static void setWarningState(Context context, int value) {
    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();
+3 −2
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@
package com.android.shell;

import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
import static com.android.shell.BugreportPrefs.STATE_SHOW;
import static com.android.shell.BugreportPrefs.STATE_HIDE;
import static com.android.shell.BugreportPrefs.STATE_UNKNOWN;
import static com.android.shell.BugreportPrefs.getWarningState;

import java.io.BufferedOutputStream;
@@ -927,7 +928,7 @@ public class BugreportProgressService extends Service {
        final Intent notifIntent;

        // Send through warning dialog by default
        if (getWarningState(mContext, STATE_SHOW) == STATE_SHOW) {
        if (getWarningState(mContext, STATE_UNKNOWN) != STATE_HIDE) {
            notifIntent = buildWarningIntent(mContext, sendIntent);
        } else {
            notifIntent = sendIntent;
+2 −2
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ 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);
        mConfirmRepeat.setChecked(getWarningState(this, STATE_UNKNOWN) != STATE_SHOW);

        setupAlert();
    }
@@ -68,7 +68,7 @@ public class BugreportWarningActivity extends AlertActivity
    public void onClick(DialogInterface dialog, int which) {
        if (which == AlertDialog.BUTTON_POSITIVE) {
            // Remember confirm state, and launch target
            setWarningState(this, mConfirmRepeat.isChecked() ? STATE_SHOW : STATE_HIDE);
            setWarningState(this, mConfirmRepeat.isChecked() ? STATE_HIDE : STATE_SHOW);
            startActivity(mSendIntent);
        }

Loading