bug:
3511123
Now the core settins are stored in the ActivityThread
instad in the AppBindData of the currently bound app.
Also the settings are pushed to the system process on
init.
Change-Id: I100bb7dc80d0d4548def22c328427bbef1694eb7
static Handler sMainThreadHandler; // set once in main()
static Handler sMainThreadHandler; // set once in main()
+ Bundle mCoreSettings = null;
+
private static final class ActivityClientRecord {
IBinder token;
int ident;
private static final class ActivityClientRecord {
IBinder token;
int ident;
boolean restrictedBackupMode;
Configuration config;
boolean handlingProfiling;
boolean restrictedBackupMode;
Configuration config;
boolean handlingProfiling;
public String toString() {
return "AppBindData{appInfo=" + appInfo + "}";
}
public String toString() {
return "AppBindData{appInfo=" + appInfo + "}";
}
ServiceManager.initServiceCache(services);
}
ServiceManager.initServiceCache(services);
}
+ setCoreSettings(coreSettings);
+
AppBindData data = new AppBindData();
data.processName = processName;
data.appInfo = appInfo;
AppBindData data = new AppBindData();
data.processName = processName;
data.appInfo = appInfo;
data.debugMode = debugMode;
data.restrictedBackupMode = isRestrictedBackupMode;
data.config = config;
data.debugMode = debugMode;
data.restrictedBackupMode = isRestrictedBackupMode;
data.config = config;
- data.coreSettings = coreSettings;
queueOrSendMessage(H.BIND_APPLICATION, data);
}
queueOrSendMessage(H.BIND_APPLICATION, data);
}
pw.println(String.format(format, objs));
}
pw.println(String.format(format, objs));
}
- public void setCoreSettings(Bundle settings) {
- queueOrSendMessage(H.SET_CORE_SETTINGS, settings);
+ public void setCoreSettings(Bundle coreSettings) {
+ queueOrSendMessage(H.SET_CORE_SETTINGS, coreSettings);
}
private void handleSetCoreSettings(Bundle coreSettings) {
}
private void handleSetCoreSettings(Bundle coreSettings) {
- if (mBoundApplication != null) {
- synchronized (mBoundApplication) {
- mBoundApplication.coreSettings = coreSettings;
- }
+ synchronized (mPackages) {
+ mCoreSettings = coreSettings;
}
public int getIntCoreSetting(String key, int defaultValue) {
}
public int getIntCoreSetting(String key, int defaultValue) {
- if (mBoundApplication == null) {
- return defaultValue;
- }
- synchronized (mBoundApplication) {
- Bundle coreSettings = mBoundApplication.coreSettings;
- if (coreSettings != null) {
- return coreSettings.getInt(key, defaultValue);
+ synchronized (mPackages) {
+ if (mCoreSettings != null) {
+ return mCoreSettings.getInt(key, defaultValue);
} else {
return defaultValue;
}
} else {
return defaultValue;
}
super(activityManagerService.mHandler);
mActivityManagerService = activityManagerService;
beginObserveCoreSettings();
super(activityManagerService.mHandler);
mActivityManagerService = activityManagerService;
beginObserveCoreSettings();
- populateCoreSettings(mCoreSettings);
}
public Bundle getCoreSettingsLocked() {
}
public Bundle getCoreSettingsLocked() {
@Override
public void onChange(boolean selfChange) {
synchronized (mActivityManagerService) {
@Override
public void onChange(boolean selfChange) {
synchronized (mActivityManagerService) {
- populateCoreSettings(mCoreSettings);
- mActivityManagerService.onCoreSettingsChange(mCoreSettings);
+ private void sendCoreSettings() {
+ populateCoreSettings(mCoreSettings);
+ mActivityManagerService.onCoreSettingsChange(mCoreSettings);
+ }
+
private void beginObserveCoreSettings() {
for (String setting : sCoreSettingToTypeMap.keySet()) {
Uri uri = Settings.Secure.getUriFor(setting);
private void beginObserveCoreSettings() {
for (String setting : sCoreSettingToTypeMap.keySet()) {
Uri uri = Settings.Secure.getUriFor(setting);