I've had an issue with my device-owner App : before Android 5.1 it was working nicely, but now after the update to Android 5.1, installing a device-owner App disables the Backup Service.
Now in the device settings, when going into the Backup & reset option, the Backup service is greyed out, saying this: Backup service is inactive. This is set by your device policy
I could find this source on the google git repository... The code is not very long and easy to understand, they use android.app.backup.IBackupManager to disable the service... But easier is the commit comment:
Shutdown backup manager service when device owner is set
Here is what they do:
import android.app.backup.IBackupManager;
// Shutting down backup manager service permanently.
long ident = Binder.clearCallingIdentity();
try {
IBackupManager ibm = IBackupManager.Stub.asInterface(
ServiceManager.getService(Context.BACKUP_SERVICE));
ibm.setBackupServiceActive(UserHandle.USER_OWNER, false);
} catch (RemoteException e) {
throw new IllegalStateException("Failed deactivating backup service.", e);
} finally {
Binder.restoreCallingIdentity(ident);
}
Wow... this makes a serious flaw for my project! No kidding: is it now really impossible for a user to have his data backed up while a device-owner App is installed ?
So, hopefully someone here could have infos or experience to share about this ? Sadly I'm not familiar with this but maybe with reflection this could be fixed afterwards ?
Thank you for reading!