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

Commit 9a2e77c3 authored by Annie Meng's avatar Annie Meng
Browse files

Add TestApis for updateTransportAttributes GTS tests

These TestApis are getters to access BackupManagerService transport
attributes. This is to validate that BackupManager.updateTransportAttributes
system api succeeds when testing in GTS (see ag/3615301).

Bug: 72485407
Test: gts-tradefed run gts -m GtsBackupHostTestCases -t com.google.android.gts.backup.BackupManagerTransportAttributesHostSideTest
Change-Id: I0edb1aa0fd776e062f800cf7a79de5cd2e2436df
parent bcaeb104
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -30,8 +30,8 @@ package android {
    field public static final java.lang.String BIND_RUNTIME_PERMISSION_PRESENTER_SERVICE = "android.permission.BIND_RUNTIME_PERMISSION_PRESENTER_SERVICE";
    field public static final java.lang.String BIND_RUNTIME_PERMISSION_PRESENTER_SERVICE = "android.permission.BIND_RUNTIME_PERMISSION_PRESENTER_SERVICE";
    field public static final java.lang.String BIND_SETTINGS_SUGGESTIONS_SERVICE = "android.permission.BIND_SETTINGS_SUGGESTIONS_SERVICE";
    field public static final java.lang.String BIND_SETTINGS_SUGGESTIONS_SERVICE = "android.permission.BIND_SETTINGS_SUGGESTIONS_SERVICE";
    field public static final java.lang.String BIND_TELEPHONY_DATA_SERVICE = "android.permission.BIND_TELEPHONY_DATA_SERVICE";
    field public static final java.lang.String BIND_TELEPHONY_DATA_SERVICE = "android.permission.BIND_TELEPHONY_DATA_SERVICE";
    field public static final java.lang.String BIND_TEXTCLASSIFIER_SERVICE = "android.permission.BIND_TEXTCLASSIFIER_SERVICE";
    field public static final java.lang.String BIND_TELEPHONY_NETWORK_SERVICE = "android.permission.BIND_TELEPHONY_NETWORK_SERVICE";
    field public static final java.lang.String BIND_TELEPHONY_NETWORK_SERVICE = "android.permission.BIND_TELEPHONY_NETWORK_SERVICE";
    field public static final java.lang.String BIND_TEXTCLASSIFIER_SERVICE = "android.permission.BIND_TEXTCLASSIFIER_SERVICE";
    field public static final java.lang.String BIND_TRUST_AGENT = "android.permission.BIND_TRUST_AGENT";
    field public static final java.lang.String BIND_TRUST_AGENT = "android.permission.BIND_TRUST_AGENT";
    field public static final java.lang.String BIND_TV_REMOTE_SERVICE = "android.permission.BIND_TV_REMOTE_SERVICE";
    field public static final java.lang.String BIND_TV_REMOTE_SERVICE = "android.permission.BIND_TV_REMOTE_SERVICE";
    field public static final java.lang.String BLUETOOTH_PRIVILEGED = "android.permission.BLUETOOTH_PRIVILEGED";
    field public static final java.lang.String BLUETOOTH_PRIVILEGED = "android.permission.BLUETOOTH_PRIVILEGED";
@@ -449,7 +449,11 @@ package android.app.backup {
    method public android.app.backup.RestoreSession beginRestoreSession();
    method public android.app.backup.RestoreSession beginRestoreSession();
    method public void cancelBackups();
    method public void cancelBackups();
    method public long getAvailableRestoreToken(java.lang.String);
    method public long getAvailableRestoreToken(java.lang.String);
    method public android.content.Intent getConfigurationIntent(java.lang.String);
    method public java.lang.String getCurrentTransport();
    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 isAppEligibleForBackup(java.lang.String);
    method public boolean isBackupEnabled();
    method public boolean isBackupEnabled();
    method public boolean isBackupServiceActive(android.os.UserHandle);
    method public boolean isBackupServiceActive(android.os.UserHandle);
+11 −0
Original line number Original line 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 {
package android.app.usage {


  public class StorageStatsManager {
  public class StorageStatsManager {
+87 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package android.app.backup;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.content.ComponentName;
import android.content.ComponentName;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
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
     * We wrap incoming binder calls with a private class implementation that
     * redirects them into main-thread actions.  This serializes the backup
     * redirects them into main-thread actions.  This serializes the backup