Merge "Propagating core settings to the system process." into honeycomb-mr1
This commit is contained in:
committed by
Android (Google) Code Review
commit
1e158e9ce7
@ -200,6 +200,8 @@ public final class ActivityThread {
|
|||||||
|
|
||||||
static Handler sMainThreadHandler; // set once in main()
|
static Handler sMainThreadHandler; // set once in main()
|
||||||
|
|
||||||
|
Bundle mCoreSettings = null;
|
||||||
|
|
||||||
private static final class ActivityClientRecord {
|
private static final class ActivityClientRecord {
|
||||||
IBinder token;
|
IBinder token;
|
||||||
int ident;
|
int ident;
|
||||||
@ -354,7 +356,6 @@ public final class ActivityThread {
|
|||||||
boolean restrictedBackupMode;
|
boolean restrictedBackupMode;
|
||||||
Configuration config;
|
Configuration config;
|
||||||
boolean handlingProfiling;
|
boolean handlingProfiling;
|
||||||
Bundle coreSettings;
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "AppBindData{appInfo=" + appInfo + "}";
|
return "AppBindData{appInfo=" + appInfo + "}";
|
||||||
}
|
}
|
||||||
@ -559,6 +560,8 @@ public final class ActivityThread {
|
|||||||
ServiceManager.initServiceCache(services);
|
ServiceManager.initServiceCache(services);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setCoreSettings(coreSettings);
|
||||||
|
|
||||||
AppBindData data = new AppBindData();
|
AppBindData data = new AppBindData();
|
||||||
data.processName = processName;
|
data.processName = processName;
|
||||||
data.appInfo = appInfo;
|
data.appInfo = appInfo;
|
||||||
@ -570,7 +573,6 @@ public final class ActivityThread {
|
|||||||
data.debugMode = debugMode;
|
data.debugMode = debugMode;
|
||||||
data.restrictedBackupMode = isRestrictedBackupMode;
|
data.restrictedBackupMode = isRestrictedBackupMode;
|
||||||
data.config = config;
|
data.config = config;
|
||||||
data.coreSettings = coreSettings;
|
|
||||||
queueOrSendMessage(H.BIND_APPLICATION, data);
|
queueOrSendMessage(H.BIND_APPLICATION, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -898,8 +900,8 @@ public final class ActivityThread {
|
|||||||
pw.println(String.format(format, objs));
|
pw.println(String.format(format, objs));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCoreSettings(Bundle settings) {
|
public void setCoreSettings(Bundle coreSettings) {
|
||||||
queueOrSendMessage(H.SET_CORE_SETTINGS, settings);
|
queueOrSendMessage(H.SET_CORE_SETTINGS, coreSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2720,10 +2722,8 @@ public final class ActivityThread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleSetCoreSettings(Bundle coreSettings) {
|
private void handleSetCoreSettings(Bundle coreSettings) {
|
||||||
if (mBoundApplication != null) {
|
synchronized (mPackages) {
|
||||||
synchronized (mBoundApplication) {
|
mCoreSettings = coreSettings;
|
||||||
mBoundApplication.coreSettings = coreSettings;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3990,13 +3990,9 @@ public final class ActivityThread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getIntCoreSetting(String key, int defaultValue) {
|
public int getIntCoreSetting(String key, int defaultValue) {
|
||||||
if (mBoundApplication == null) {
|
synchronized (mPackages) {
|
||||||
return defaultValue;
|
if (mCoreSettings != null) {
|
||||||
}
|
return mCoreSettings.getInt(key, defaultValue);
|
||||||
synchronized (mBoundApplication) {
|
|
||||||
Bundle coreSettings = mBoundApplication.coreSettings;
|
|
||||||
if (coreSettings != null) {
|
|
||||||
return coreSettings.getInt(key, defaultValue);
|
|
||||||
} else {
|
} else {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class CoreSettingsObserver extends ContentObserver {
|
|||||||
super(activityManagerService.mHandler);
|
super(activityManagerService.mHandler);
|
||||||
mActivityManagerService = activityManagerService;
|
mActivityManagerService = activityManagerService;
|
||||||
beginObserveCoreSettings();
|
beginObserveCoreSettings();
|
||||||
populateCoreSettings(mCoreSettings);
|
sendCoreSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bundle getCoreSettingsLocked() {
|
public Bundle getCoreSettingsLocked() {
|
||||||
@ -62,10 +62,14 @@ class CoreSettingsObserver extends ContentObserver {
|
|||||||
@Override
|
@Override
|
||||||
public void onChange(boolean selfChange) {
|
public void onChange(boolean selfChange) {
|
||||||
synchronized (mActivityManagerService) {
|
synchronized (mActivityManagerService) {
|
||||||
|
sendCoreSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendCoreSettings() {
|
||||||
populateCoreSettings(mCoreSettings);
|
populateCoreSettings(mCoreSettings);
|
||||||
mActivityManagerService.onCoreSettingsChange(mCoreSettings);
|
mActivityManagerService.onCoreSettingsChange(mCoreSettings);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void beginObserveCoreSettings() {
|
private void beginObserveCoreSettings() {
|
||||||
for (String setting : sCoreSettingToTypeMap.keySet()) {
|
for (String setting : sCoreSettingToTypeMap.keySet()) {
|
||||||
|
Reference in New Issue
Block a user