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;
}
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;
}
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);
}
}
Aggregations