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

Commit f1221273 authored by Jason Macnak's avatar Jason Macnak Committed by Android (Google) Code Review
Browse files

Merge "Revert "- Allow disabling framework Backup scheduling""

parents 07bdb616 223ae986
Loading
Loading
Loading
Loading
+0 −29
Original line number Diff line number Diff line
@@ -195,35 +195,10 @@ public class Bmgr {
            return;
        }

        if ("scheduling".equals(op)) {
            setSchedulingEnabled(userId);
            return;
        }

        System.err.println("Unknown command");
        showUsage();
    }

    private void setSchedulingEnabled(int userId) {
        String arg = nextArg();
        if (arg == null) {
            showUsage();
            return;
        }

        try {
            boolean enable = Boolean.parseBoolean(arg);
            mBmgr.setFrameworkSchedulingEnabledForUser(userId, enable);
            System.out.println(
                    "Backup scheduling is now "
                            + (enable ? "enabled" : "disabled")
                            + " for user "
                            + userId);
        } catch (RemoteException e) {
            handleRemoteException(e);
        }
    }

    private void handleRemoteException(RemoteException e) {
        System.err.println(e.toString());
        System.err.println(BMGR_NOT_RUNNING_ERR);
@@ -969,7 +944,6 @@ public class Bmgr {
        System.err.println("       bmgr activate BOOL");
        System.err.println("       bmgr activated");
        System.err.println("       bmgr autorestore BOOL");
        System.err.println("       bmgr scheduling BOOL");
        System.err.println("");
        System.err.println("The '--user' option specifies the user on which the operation is run.");
        System.err.println("It must be the first argument before the operation.");
@@ -1047,9 +1021,6 @@ public class Bmgr {
        System.err.println("");
        System.err.println("The 'autorestore' command enables or disables automatic restore when");
        System.err.println("a new package is installed.");
        System.err.println("");
        System.err.println("The 'scheduling' command enables or disables backup scheduling in the");
        System.err.println("framework.");
    }

    private static class BackupMonitor extends IBackupManagerMonitor.Stub {
+3 −27
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.app.backup;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
@@ -37,6 +38,8 @@ import android.os.UserHandle;
import android.util.Log;
import android.util.Pair;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;

/**
@@ -406,33 +409,6 @@ public class BackupManager {
        }
    }

    /**
     * Enable/disable the framework backup scheduling entirely for the current user. When disabled,
     * no Key/Value or Full backup jobs will be scheduled by the Android framework.
     *
     * <p>Note: This does not disable backups: only their scheduling is affected and backups can
     * still be triggered manually.
     *
     * <p>Callers must hold the android.permission.BACKUP permission to use this method.
     *
     * @hide
     */
    @RequiresPermission(allOf = {android.Manifest.permission.BACKUP,
            android.Manifest.permission.INTERACT_ACROSS_USERS_FULL}, conditional = true)
    public void setFrameworkSchedulingEnabled(boolean isEnabled) {
        checkServiceBinder();
        if (sService == null) {
            Log.e(TAG, "setFrameworkSchedulingEnabled() couldn't connect");
            return;
        }

        try {
            sService.setFrameworkSchedulingEnabledForUser(mContext.getUserId(), isEnabled);
        } catch (RemoteException e) {
            Log.e(TAG, "setFrameworkSchedulingEnabled() couldn't connect");
        }
    }

    /**
     * Report whether the backup mechanism is currently enabled.
     *
+0 −16
Original line number Diff line number Diff line
@@ -155,22 +155,6 @@ interface IBackupManager {
     */
    void setBackupEnabledForUser(int userId, boolean isEnabled);


    /**
     * Enable/disable the framework backup scheduling entirely. When disabled, no Key/Value or Full
     * backup jobs will be scheduled by the Android framework.
     *
     * <p>Note: This does not disable backups: only their scheduling is affected and backups can
     * still be triggered manually.
     *
     * <p>Callers must hold the android.permission.BACKUP permission to use this method. If
     * {@code userId} is different from the calling user id, then the caller must additionally hold
     * the android.permission.INTERACT_ACROSS_USERS_FULL permission.
     *
     * @param userId The user for which backup scheduling should be enabled/disabled.
     */
    void setFrameworkSchedulingEnabledForUser(int userId, boolean isEnabled);

    /**
     * {@link android.app.backup.IBackupManager.setBackupEnabledForUser} for the calling user id.
     */
+0 −6
Original line number Diff line number Diff line
@@ -8659,12 +8659,6 @@ public final class Settings {
        @Readable
        public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
        /**
         * Controls whether framework backup scheduling is enabled.
         * @hide
         */
        public static final String BACKUP_SCHEDULING_ENABLED = "backup_scheduling_enabled";
        /**
         * Indicates whether settings backup has been fully provisioned.
         * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
+0 −1
Original line number Diff line number Diff line
@@ -695,7 +695,6 @@ public class SettingsBackupTest {
                 Settings.Secure.BACKUP_AUTO_RESTORE,
                 Settings.Secure.BACKUP_ENABLED,
                 Settings.Secure.BACKUP_PROVISIONED,
                 Settings.Secure.BACKUP_SCHEDULING_ENABLED,
                 Settings.Secure.BACKUP_TRANSPORT,
                 Settings.Secure.CALL_SCREENING_DEFAULT_COMPONENT,
                 Settings.Secure.CAMERA_LIFT_TRIGGER_ENABLED, // Candidate for backup?
Loading