Search in sources :

Example 21 with IBackupManager

use of android.app.backup.IBackupManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AutoRestorePreferenceController method setChecked.

@Override
public boolean setChecked(boolean isChecked) {
    final boolean nextValue = isChecked;
    boolean result = false;
    final IBackupManager backupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
    try {
        backupManager.setAutoRestore(nextValue);
        result = true;
    } catch (RemoteException e) {
        ((SwitchPreference) mPreference).setChecked(!nextValue);
        Log.e(TAG, "Error can't set setAutoRestore", e);
    }
    return result;
}
Also used : IBackupManager(android.app.backup.IBackupManager) RemoteException(android.os.RemoteException)

Example 22 with IBackupManager

use of android.app.backup.IBackupManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class PrivacySettingsUtils method getInvisibleKey.

private static Set<String> getInvisibleKey(final Context context) {
    final IBackupManager backupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
    boolean isServiceActive = false;
    try {
        isServiceActive = backupManager.isBackupServiceActive(UserHandle.myUserId());
    } catch (RemoteException e) {
        Log.w(TAG, "Failed querying backup manager service activity status. " + "Assuming it is inactive.");
    }
    boolean vendorSpecific = context.getPackageManager().resolveContentProvider(GSETTINGS_PROVIDER, 0) == null;
    final Set<String> inVisibleKeys = new TreeSet<>();
    if (vendorSpecific || isServiceActive) {
        inVisibleKeys.add(BACKUP_INACTIVE);
    }
    if (vendorSpecific || !isServiceActive) {
        inVisibleKeys.add(BACKUP_DATA);
        inVisibleKeys.add(AUTO_RESTORE);
        inVisibleKeys.add(CONFIGURE_ACCOUNT);
    }
    return inVisibleKeys;
}
Also used : TreeSet(java.util.TreeSet) IBackupManager(android.app.backup.IBackupManager) RemoteException(android.os.RemoteException)

Example 23 with IBackupManager

use of android.app.backup.IBackupManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class PrivacySettingsUtils method updatePrivacyBuffer.

public static void updatePrivacyBuffer(final Context context, PrivacySettingsConfigData data) {
    final IBackupManager backupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
    try {
        data.setBackupEnabled(backupManager.isBackupEnabled());
        String transport = backupManager.getCurrentTransport();
        data.setConfigIntent(validatedActivityIntent(context, backupManager.getConfigurationIntent(transport), "config"));
        data.setConfigSummary(backupManager.getDestinationString(transport));
        data.setManageIntent(validatedActivityIntent(context, backupManager.getDataManagementIntent(transport), "management"));
        data.setManageLabel(backupManager.getDataManagementLabelForUser(UserHandle.myUserId(), transport));
        data.setBackupGray(false);
    } catch (RemoteException e) {
        // leave it 'false' and disable the UI; there's no backup manager
        // mBackup.setEnabled(false);
        data.setBackupGray(true);
    }
}
Also used : IBackupManager(android.app.backup.IBackupManager) RemoteException(android.os.RemoteException)

Aggregations

IBackupManager (android.app.backup.IBackupManager)23 RemoteException (android.os.RemoteException)22 ActivityNotFoundException (android.content.ActivityNotFoundException)4 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)4 Point (android.graphics.Point)4 FileNotFoundException (java.io.FileNotFoundException)4 IOException (java.io.IOException)4 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)3 TransactionTooLargeException (android.os.TransactionTooLargeException)2 Intent (android.content.Intent)1 InstallerException (com.android.internal.os.InstallerConnection.InstallerException)1 InstallerException (com.android.server.pm.Installer.InstallerException)1 URISyntaxException (java.net.URISyntaxException)1 TreeSet (java.util.TreeSet)1