am 71027e1b: Provision the backup manager in the SDK System image.

Merge commit '71027e1b75951c90c22c9979a505381fae843ed3' into kraken

* commit '71027e1b75951c90c22c9979a505381fae843ed3':
  Provision the backup manager in the SDK System image.
This commit is contained in:
Xavier Ducrohet
2010-06-09 10:34:33 -07:00
committed by Android Git Automerger
2 changed files with 15 additions and 0 deletions

View File

@@ -31,5 +31,6 @@
</intent-filter> </intent-filter>
</activity> </activity>
</application> </application>
<uses-permission android:name="android.permission.BACKUP" />
</manifest> </manifest>

View File

@@ -17,10 +17,14 @@
package com.android.sdksetup; package com.android.sdksetup;
import android.app.Activity; import android.app.Activity;
import android.app.backup.IBackupManager;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.location.LocationManager; import android.location.LocationManager;
import android.os.Bundle; import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings; import android.provider.Settings;
/** /**
@@ -43,6 +47,16 @@ public class DefaultActivity extends Activity {
// enable install from non market // enable install from non market
Settings.Secure.putInt(getContentResolver(), Settings.Secure.INSTALL_NON_MARKET_APPS, 1); Settings.Secure.putInt(getContentResolver(), Settings.Secure.INSTALL_NON_MARKET_APPS, 1);
// provision the backup manager.
IBackupManager bm = IBackupManager.Stub.asInterface(
ServiceManager.getService(Context.BACKUP_SERVICE));
if (bm != null) {
try {
bm.setBackupProvisioned(true);
} catch (RemoteException e) {
}
}
// remove this activity from the package manager. // remove this activity from the package manager.
PackageManager pm = getPackageManager(); PackageManager pm = getPackageManager();
ComponentName name = new ComponentName(this, DefaultActivity.class); ComponentName name = new ComponentName(this, DefaultActivity.class);