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

Commit 69ad4a15 authored by Annie Meng's avatar Annie Meng Committed by Android (Google) Code Review
Browse files

Merge "Add TestApis for updateTransportAttributes GTS tests"

parents acd4e6de 9a2e77c3
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -469,7 +469,11 @@ package android.app.backup {
    method public android.app.backup.RestoreSession beginRestoreSession();
    method public void cancelBackups();
    method public long getAvailableRestoreToken(java.lang.String);
    method public android.content.Intent getConfigurationIntent(java.lang.String);
    method public java.lang.String getCurrentTransport();
    method public android.content.Intent getDataManagementIntent(java.lang.String);
    method public java.lang.String getDataManagementLabel(java.lang.String);
    method public java.lang.String getDestinationString(java.lang.String);
    method public boolean isAppEligibleForBackup(java.lang.String);
    method public boolean isBackupEnabled();
    method public boolean isBackupServiceActive(android.os.UserHandle);
+11 −0
Original line number Diff line number Diff line
@@ -167,6 +167,17 @@ package android.app.admin {

}

package android.app.backup {

  public class BackupManager {
    method public android.content.Intent getConfigurationIntent(java.lang.String);
    method public android.content.Intent getDataManagementIntent(java.lang.String);
    method public java.lang.String getDataManagementLabel(java.lang.String);
    method public java.lang.String getDestinationString(java.lang.String);
  }

}

package android.app.usage {

  public class StorageStatsManager {
+87 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.app.backup;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -715,6 +716,92 @@ public class BackupManager {
        }
    }

    /**
     * Returns an {@link Intent} for the specified transport's configuration UI.
     * This value is set by {@link #updateTransportAttributes(ComponentName, String, Intent, String,
     * Intent, String)}.
     * @param transportName The name of the registered transport.
     * @hide
     */
    @SystemApi
    @TestApi
    @RequiresPermission(android.Manifest.permission.BACKUP)
    public Intent getConfigurationIntent(String transportName) {
        if (sService != null) {
            try {
                return sService.getConfigurationIntent(transportName);
            } catch (RemoteException e) {
                Log.e(TAG, "getConfigurationIntent() couldn't connect");
            }
        }
        return null;
    }

    /**
     * Returns a {@link String} describing where the specified transport is sending data.
     * This value is set by {@link #updateTransportAttributes(ComponentName, String, Intent, String,
     * Intent, String)}.
     * @param transportName The name of the registered transport.
     * @hide
     */
    @SystemApi
    @TestApi
    @RequiresPermission(android.Manifest.permission.BACKUP)
    public String getDestinationString(String transportName) {
        if (sService != null) {
            try {
                return sService.getDestinationString(transportName);
            } catch (RemoteException e) {
                Log.e(TAG, "getDestinationString() couldn't connect");
            }
        }
        return null;
    }

    /**
     * Returns an {@link Intent} for the specified transport's data management UI.
     * This value is set by {@link #updateTransportAttributes(ComponentName, String, Intent, String,
     * Intent, String)}.
     * @param transportName The name of the registered transport.
     * @hide
     */
    @SystemApi
    @TestApi
    @RequiresPermission(android.Manifest.permission.BACKUP)
    public Intent getDataManagementIntent(String transportName) {
        if (sService != null) {
            try {
                return sService.getDataManagementIntent(transportName);
            } catch (RemoteException e) {
                Log.e(TAG, "getDataManagementIntent() couldn't connect");
            }
        }
        return null;
    }

    /**
     * Returns a {@link String} describing what the specified transport's data management intent is
     * used for.
     * This value is set by {@link #updateTransportAttributes(ComponentName, String, Intent, String,
     * Intent, String)}.
     *
     * @param transportName The name of the registered transport.
     * @hide
     */
    @SystemApi
    @TestApi
    @RequiresPermission(android.Manifest.permission.BACKUP)
    public String getDataManagementLabel(String transportName) {
        if (sService != null) {
            try {
                return sService.getDataManagementLabel(transportName);
            } catch (RemoteException e) {
                Log.e(TAG, "getDataManagementLabel() couldn't connect");
            }
        }
        return null;
    }

    /*
     * We wrap incoming binder calls with a private class implementation that
     * redirects them into main-thread actions.  This serializes the backup