Change settings only for emulator
am: c91a33d3df
Change-Id: Ie630b302fff2235977d512ca77e49abc3fd54895
This commit is contained in:
@@ -25,6 +25,7 @@ import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
|
||||
/**
|
||||
@@ -37,6 +38,8 @@ public class DefaultActivity extends Activity {
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
// Edit Settings only for Emulator
|
||||
if (Build.IS_EMULATOR) {
|
||||
// Add a persistent setting to allow other apps to know the device has been provisioned.
|
||||
Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1);
|
||||
|
||||
@@ -56,6 +59,8 @@ public class DefaultActivity extends Activity {
|
||||
// enable install from non market
|
||||
Settings.Global.putInt(getContentResolver(), Settings.Global.INSTALL_NON_MARKET_APPS, 1);
|
||||
|
||||
Settings.Secure.putInt(getContentResolver(),Settings.Secure.ADB_ENABLED, 1);
|
||||
|
||||
// provision the backup manager.
|
||||
IBackupManager bm = IBackupManager.Stub.asInterface(
|
||||
ServiceManager.getService(Context.BACKUP_SERVICE));
|
||||
@@ -65,12 +70,12 @@ public class DefaultActivity extends Activity {
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// remove this activity from the package manager.
|
||||
PackageManager pm = getPackageManager();
|
||||
ComponentName name = new ComponentName(this, DefaultActivity.class);
|
||||
pm.setComponentEnabledSetting(name, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
Settings.Secure.putInt(getContentResolver(),Settings.Secure.ADB_ENABLED, 1);
|
||||
|
||||
// terminate the activity.
|
||||
finish();
|
||||
|
||||
Reference in New Issue
Block a user