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

Commit 0754128d authored by Christopher Tate's avatar Christopher Tate Committed by android-build-merger
Browse files

Merge \"Let bmgr inspect the set of whitelisted transports\" into nyc-dev

am: 0f101342

Change-Id: I5249aed8cf49c0da111324d5c6ab43b46cdb1196
parents 9e984de0 0f101342
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -122,6 +122,11 @@ public final class Bmgr {
            return;
        }

        if ("whitelist".equals(op)) {
            doPrintWhitelist();
            return;
        }

        System.err.println("Unknown command");
        showUsage();
    }
@@ -604,6 +609,20 @@ public final class Bmgr {
        }
    }

    private void doPrintWhitelist() {
        try {
            final String[] whitelist = mBmgr.getTransportWhitelist();
            if (whitelist != null) {
                for (String transport : whitelist) {
                    System.out.println(transport);
                }
            }
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(BMGR_NOT_RUNNING_ERR);
        }
    }

    private String nextArg() {
        if (mNextArg >= mArgs.length) {
            return null;
+8 −0
Original line number Diff line number Diff line
@@ -217,6 +217,14 @@ interface IBackupManager {
     */
    String[] listAllTransports();

    /**
     * Retrieve the list of whitelisted transport components.  Callers do </i>not</i> need
     * any special permission.
     *
     * @return The names of all whitelisted transport components defined by the system.
     */
    String[] getTransportWhitelist();

    /**
     * Specify the current backup transport.  Callers must hold the
     * android.permission.BACKUP permission to use this method.
+9 −0
Original line number Diff line number Diff line
@@ -9598,6 +9598,15 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
        return list;
    }

    public String[] getTransportWhitelist() {
        // No permission check, intentionally.
        String[] whitelist = new String[mTransportWhitelist.size()];
        for (int i = mTransportWhitelist.size() - 1; i >= 0; i--) {
            whitelist[i] = mTransportWhitelist.valueAt(i).flattenToShortString();
        }
        return whitelist;
    }

    // Select which transport to use for the next backup operation.
    public String selectBackupTransport(String transport) {
        mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
+6 −0
Original line number Diff line number Diff line
@@ -274,6 +274,12 @@ public class Trampoline extends IBackupManager.Stub {
        return (svc != null) ? svc.listAllTransports() : null;
    }

    @Override
    public String[] getTransportWhitelist() {
        BackupManagerService svc = mService;
        return (svc != null) ? svc.getTransportWhitelist() : null;
    }

    @Override
    public String selectBackupTransport(String transport) throws RemoteException {
        BackupManagerService svc = mService;