Merge "Setting a system property when device goes into demo mode" into nyc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
24db3ab8b9
@@ -51,6 +51,7 @@ import android.os.Message;
|
|||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
import android.os.SystemProperties;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
@@ -78,6 +79,7 @@ public class RetailDemoModeService extends SystemService {
|
|||||||
private static final String DEMO_USER_NAME = "Demo";
|
private static final String DEMO_USER_NAME = "Demo";
|
||||||
private static final String ACTION_RESET_DEMO =
|
private static final String ACTION_RESET_DEMO =
|
||||||
"com.android.server.retaildemo.ACTION_RESET_DEMO";
|
"com.android.server.retaildemo.ACTION_RESET_DEMO";
|
||||||
|
private static final String SYSTEM_PROPERTY_RETAIL_DEMO_ENABLED = "sys.retaildemo.enabled";
|
||||||
|
|
||||||
private static final int MSG_TURN_SCREEN_ON = 0;
|
private static final int MSG_TURN_SCREEN_ON = 0;
|
||||||
private static final int MSG_INACTIVITY_TIME_OUT = 1;
|
private static final int MSG_INACTIVITY_TIME_OUT = 1;
|
||||||
@@ -220,11 +222,15 @@ public class RetailDemoModeService extends SystemService {
|
|||||||
if (mDeviceDemoModeUri.equals(uri)) {
|
if (mDeviceDemoModeUri.equals(uri)) {
|
||||||
mDeviceInDemoMode = UserManager.isDeviceInDemoMode(getContext());
|
mDeviceInDemoMode = UserManager.isDeviceInDemoMode(getContext());
|
||||||
if (mDeviceInDemoMode) {
|
if (mDeviceInDemoMode) {
|
||||||
|
SystemProperties.set(SYSTEM_PROPERTY_RETAIL_DEMO_ENABLED, "1");
|
||||||
mHandler.sendEmptyMessage(MSG_START_NEW_SESSION);
|
mHandler.sendEmptyMessage(MSG_START_NEW_SESSION);
|
||||||
} else if (mWakeLock.isHeld()) {
|
} else {
|
||||||
|
SystemProperties.set(SYSTEM_PROPERTY_RETAIL_DEMO_ENABLED, "0");
|
||||||
|
if (mWakeLock.isHeld()) {
|
||||||
mWakeLock.release();
|
mWakeLock.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// If device is provisioned and left demo mode - run the cleanup in demo folder
|
// If device is provisioned and left demo mode - run the cleanup in demo folder
|
||||||
if (!mDeviceInDemoMode && isDeviceProvisioned()) {
|
if (!mDeviceInDemoMode && isDeviceProvisioned()) {
|
||||||
// Run on the bg thread to not block the fg thread
|
// Run on the bg thread to not block the fg thread
|
||||||
@@ -470,6 +476,7 @@ public class RetailDemoModeService extends SystemService {
|
|||||||
|
|
||||||
if (UserManager.isDeviceInDemoMode(getContext())) {
|
if (UserManager.isDeviceInDemoMode(getContext())) {
|
||||||
mDeviceInDemoMode = true;
|
mDeviceInDemoMode = true;
|
||||||
|
SystemProperties.set(SYSTEM_PROPERTY_RETAIL_DEMO_ENABLED, "1");
|
||||||
mHandler.sendEmptyMessage(MSG_START_NEW_SESSION);
|
mHandler.sendEmptyMessage(MSG_START_NEW_SESSION);
|
||||||
}
|
}
|
||||||
SettingsObserver settingsObserver = new SettingsObserver(mHandler);
|
SettingsObserver settingsObserver = new SettingsObserver(mHandler);
|
||||||
|
|||||||
Reference in New Issue
Block a user