Skip to content

Commit 71027e1

Browse files
author
Xavier Ducrohet
committed
Provision the backup manager in the SDK System image.
Change-Id: Ib1c9ef22558e71452cf979e36dd1d1fdbf844ce8
1 parent 27626c0 commit 71027e1

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

apps/SdkSetup/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@
3131
</intent-filter>
3232
</activity>
3333
</application>
34+
<uses-permission android:name="android.permission.BACKUP" />
3435
</manifest>
3536

apps/SdkSetup/src/com/android/sdksetup/DefaultActivity.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@
1717
package com.android.sdksetup;
1818

1919
import android.app.Activity;
20+
import android.app.backup.IBackupManager;
2021
import android.content.ComponentName;
22+
import android.content.Context;
2123
import android.content.pm.PackageManager;
2224
import android.location.LocationManager;
2325
import android.os.Bundle;
26+
import android.os.RemoteException;
27+
import android.os.ServiceManager;
2428
import android.provider.Settings;
2529

2630
/**
@@ -43,6 +47,16 @@ protected void onCreate(Bundle icicle) {
4347
// enable install from non market
4448
Settings.Secure.putInt(getContentResolver(), Settings.Secure.INSTALL_NON_MARKET_APPS, 1);
4549

50+
// provision the backup manager.
51+
IBackupManager bm = IBackupManager.Stub.asInterface(
52+
ServiceManager.getService(Context.BACKUP_SERVICE));
53+
if (bm != null) {
54+
try {
55+
bm.setBackupProvisioned(true);
56+
} catch (RemoteException e) {
57+
}
58+
}
59+
4660
// remove this activity from the package manager.
4761
PackageManager pm = getPackageManager();
4862
ComponentName name = new ComponentName(this, DefaultActivity.class);

0 commit comments

Comments
 (0)