Fix issue #2438980: Implement package watcher for voice recognizer service setting
I am getting tired of writing package monitor code, realized this is missing in a number of places, and at this point it has gotten complicated enough that I don't think anyone actually does it 100% right so: Introducing PackageMonitor. Yes there are no Java docs. I am still playing around with just what this thing is to figure out what makes sense and how people will use it. It is being used to fix this bug for monitoring voice recognizers (integrating the code from the settings provider for setting an initial value), to replace the existing code for monitoring input methods (and fix the bug where we wouldn't remove an input method from the enabled list when it got uninstalled), to now monitor live wallpaper package changes (now allowing us to avoid reverting back to the default live wallpaper when the current one is updated!), and to monitor device admin changes. Also includes a fix so you can't uninstall an .apk that is currently enabled as a device admin. Also includes a fix where the default time zone was not initialized early enough which should fix issue #2455507 (Observed Google services frame work crash). In addition, this finally introduces a mechanism to determine if the "force stop" button should be enabled, with convenience in PackageMonitor for system services to handle it. All services have been updated to support this. There is also new infrastructure for reporting battery usage as an applicatin error report.
This commit is contained in:
@@ -97,6 +97,7 @@ class ServerThread extends Thread {
|
||||
BluetoothA2dpService bluetoothA2dp = null;
|
||||
HeadsetObserver headset = null;
|
||||
DockObserver dock = null;
|
||||
RecognitionManagerService recognition = null;
|
||||
|
||||
// Critical services...
|
||||
try {
|
||||
@@ -376,6 +377,13 @@ class ServerThread extends Thread {
|
||||
Log.e(TAG, "Failure starting AppWidget Service", e);
|
||||
}
|
||||
|
||||
try {
|
||||
Log.i(TAG, "Recognition Service");
|
||||
recognition = new RecognitionManagerService(context);
|
||||
} catch (Throwable e) {
|
||||
Log.e(TAG, "Failure starting Recognition Service", e);
|
||||
}
|
||||
|
||||
try {
|
||||
com.android.server.status.StatusBarPolicy.installIcons(context, statusBar);
|
||||
} catch (Throwable e) {
|
||||
@@ -435,6 +443,7 @@ class ServerThread extends Thread {
|
||||
final AppWidgetService appWidgetF = appWidget;
|
||||
final WallpaperManagerService wallpaperF = wallpaper;
|
||||
final InputMethodManagerService immF = imm;
|
||||
final RecognitionManagerService recognitionF = recognition;
|
||||
|
||||
// We now tell the activity manager it is okay to run third party
|
||||
// code. It will call back into us once it has gotten to the state
|
||||
@@ -449,6 +458,7 @@ class ServerThread extends Thread {
|
||||
if (batteryF != null) batteryF.systemReady();
|
||||
if (connectivityF != null) connectivityF.systemReady();
|
||||
if (dockF != null) dockF.systemReady();
|
||||
if (recognitionF != null) recognitionF.systemReady();
|
||||
Watchdog.getInstance().start();
|
||||
|
||||
// It is now okay to let the various system services start their
|
||||
|
||||
Reference in New Issue
Block a user