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

Commit 90985605 authored by Aayush Gupta's avatar Aayush Gupta
Browse files

Merge branch 'backup_fix_pie' into 'v1-pie'

Settings: Hide Backup options on non test builds

See merge request !67
parents e034bd67 3cf405c5
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.app.FragmentManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.os.UserHandle;
import android.support.annotation.VisibleForTesting;
@@ -120,9 +121,9 @@ public class BackupSettingsActivity extends Activity implements Indexable {

                    // For non-primary user, no backup is available, so don't show it in search
                    // TODO: http://b/22388012
                    if (UserHandle.myUserId() != UserHandle.USER_SYSTEM) {
                    if (!Build.TAGS.equalsIgnoreCase("test-keys,test-release") || UserHandle.myUserId() != UserHandle.USER_SYSTEM) {
                        if (Log.isLoggable(TAG, Log.DEBUG)) {
                            Log.d(TAG, "Not a system user, not indexing the screen");
                            Log.d(TAG, "Build type is non-test or the UserID is not of a system user, not indexing the screen");
                        }
                        keys.add(BACKUP_SEARCH_INDEX_KEY);
                    }
+10 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
package com.android.settings.system;

import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.provider.SearchIndexableResource;
import android.support.v7.preference.Preference;
@@ -36,6 +37,7 @@ public class SystemDashboardFragment extends DashboardFragment {

    private static final String TAG = "SystemDashboardFrag";

    private static final String KEY_BACKUP = "backup_settings";
    private static final String KEY_RESET = "reset_dashboard";

    @Override
@@ -43,6 +45,13 @@ public class SystemDashboardFragment extends DashboardFragment {
        super.onCreate(icicle);

        final PreferenceScreen screen = getPreferenceScreen();

        // Remove backup options if we are not on a test build
        if (!Build.TAGS.equalsIgnoreCase("test-keys,test-release")) {
            Preference backup = findPreference(KEY_BACKUP);
            screen.removePreference(backup);
        }

        // We do not want to display an advanced button if only one setting is hidden
        if (getVisiblePreferenceCount(screen) == screen.getInitialExpandedChildrenCount() + 1) {
            screen.setInitialExpandedChildrenCount(Integer.MAX_VALUE);