diff options
Diffstat (limited to 'services/java/com')
8 files changed, 95 insertions, 54 deletions
diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java index 6bf7102..981cc93 100644 --- a/services/java/com/android/server/AppWidgetService.java +++ b/services/java/com/android/server/AppWidgetService.java @@ -855,7 +855,7 @@ class AppWidgetService extends IAppWidgetService.Stub out.startTag(null, "p"); out.attribute(null, "pkg", p.info.provider.getPackageName()); out.attribute(null, "cl", p.info.provider.getClassName()); - out.endTag(null, "h"); + out.endTag(null, "p"); p.tag = providerIndex; providerIndex++; } diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index e2e0ba9..afcba47 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -855,12 +855,26 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } + private void finishSession(SessionState sessionState) { + if (sessionState != null && sessionState.session != null) { + try { + sessionState.session.finishSession(); + } catch (RemoteException e) { + Log.w(TAG, "Session failed to close due to remote exception", e); + } + } + } + void clearCurMethodLocked() { if (mCurMethod != null) { for (ClientState cs : mClients.values()) { cs.sessionRequested = false; + finishSession(cs.curSession); cs.curSession = null; } + + finishSession(mEnabledSession); + mEnabledSession = null; mCurMethod = null; } mStatusBar.setIconVisibility(mInputMethodIcon, false); diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java index 024d8da..d679a5e 100644 --- a/services/java/com/android/server/LocationManagerService.java +++ b/services/java/com/android/server/LocationManagerService.java @@ -552,10 +552,8 @@ public class LocationManagerService extends ILocationManager.Stub implements Run } // Use system settings ContentResolver resolver = mContext.getContentResolver(); - String allowedProviders = Settings.Secure.getString(resolver, - Settings.Secure.LOCATION_PROVIDERS_ALLOWED); - return ((allowedProviders != null) && (allowedProviders.contains(provider))); + return Settings.Secure.isLocationProviderEnabled(resolver, provider); } private void checkPermissionsSafe(String provider) { @@ -1204,8 +1202,9 @@ public class LocationManagerService extends ILocationManager.Stub implements Run // Remove expired alerts if (intentsToRemove != null) { for (PendingIntent i : intentsToRemove) { - ProximityAlert alert = mProximityAlerts.remove(i); + ProximityAlert alert = mProximityAlerts.get(i); mProximitiesEntered.remove(alert); + removeProximityAlertLocked(i); } } } diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java index 6df9f2b..cc78300 100644 --- a/services/java/com/android/server/PackageManagerService.java +++ b/services/java/com/android/server/PackageManagerService.java @@ -1861,7 +1861,7 @@ class PackageManagerService extends IPackageManager.Stub { && (p.applicationInfo.flags&ApplicationInfo.FLAG_PERSISTENT) != 0 && (!mSafeMode || (p.applicationInfo.flags &ApplicationInfo.FLAG_SYSTEM) != 0)) { - finalList.add(p.applicationInfo); + finalList.add(PackageParser.generateApplicationInfo(p, flags)); } } } @@ -1977,12 +1977,6 @@ class PackageManagerService extends IPackageManager.Stub { } PackageParser.Package pkg = scanPackageLI(file, file, resFile, flags|PackageParser.PARSE_MUST_BE_APK, scanMode); - // Don't mess around with apps in system partition. - if (pkg == null && (flags & PackageParser.PARSE_IS_SYSTEM) == 0) { - // Delete the apk - Log.w(TAG, "Cleaning up failed install of " + file); - file.delete(); - } } } @@ -2177,13 +2171,6 @@ class PackageManagerService extends IPackageManager.Stub { File scanFile, File destCodeFile, File destResourceFile, PackageParser.Package pkg, int parseFlags, int scanMode) { - if (scanFile == null || destCodeFile == null || - destResourceFile == null) { - // Bail out. The resource and code paths haven't been set. - Log.w(TAG, " Code and resource paths haven't been set correctly"); - mLastScanError = PackageManager.INSTALL_FAILED_INVALID_APK; - return null; - } mScanningPath = scanFile; if (pkg == null) { mLastScanError = PackageManager.INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME; diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 24caf1f..b90b03b 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -5478,7 +5478,7 @@ public class WindowManagerService extends IWindowManager.Stub + " fin=" + finished + " gfw=" + gotFirstWindow + " ed=" + eventDispatching + " tts=" + timeToSwitch + " wf=" + wasFrozen + " fp=" + focusPaused - + " mcf=" + mCurrentFocus + "}}"; + + " mcf=" + curFocus + "}}"; } }; private DispatchState mDispatchState = null; @@ -6435,18 +6435,30 @@ public class WindowManagerService extends IWindowManager.Stub case RawInputEvent.CLASS_KEYBOARD: KeyEvent ke = (KeyEvent)ev.event; if (ke.isDown()) { - lastKey = ke; - downTime = curTime; - keyRepeatCount = 0; lastKeyTime = curTime; - nextKeyTime = lastKeyTime - + ViewConfiguration.getLongPressTimeout(); - if (DEBUG_INPUT) Log.v( - TAG, "Received key down: first repeat @ " - + nextKeyTime); + if (lastKey != null && + ke.getKeyCode() == lastKey.getKeyCode()) { + keyRepeatCount++; + // Arbitrary long timeout to block + // repeating here since we know that + // the device driver takes care of it. + nextKeyTime = lastKeyTime + LONG_WAIT; + if (DEBUG_INPUT) Log.v( + TAG, "Received repeated key down"); + } else { + downTime = curTime; + keyRepeatCount = 0; + nextKeyTime = lastKeyTime + + ViewConfiguration.getLongPressTimeout(); + if (DEBUG_INPUT) Log.v( + TAG, "Received key down: first repeat @ " + + nextKeyTime); + } + lastKey = ke; } else { lastKey = null; downTime = 0; + keyRepeatCount = 0; // Arbitrary long timeout. lastKeyTime = curTime; nextKeyTime = curTime + LONG_WAIT; @@ -6454,7 +6466,12 @@ public class WindowManagerService extends IWindowManager.Stub TAG, "Received key up: ignore repeat @ " + nextKeyTime); } - dispatchKey((KeyEvent)ev.event, 0, 0); + if (keyRepeatCount > 0) { + dispatchKey(KeyEvent.changeTimeRepeat(ke, + ke.getEventTime(), keyRepeatCount), 0, 0); + } else { + dispatchKey(ke, 0, 0); + } mQueue.recycleEvent(ev); break; case RawInputEvent.CLASS_TOUCHSCREEN: @@ -8520,7 +8537,8 @@ public class WindowManagerService extends IWindowManager.Stub final int N = allAppWindows.size(); for (int i=0; i<N; i++) { WindowState win = allAppWindows.get(i); - if (win == startingWindow || win.mAppFreezing) { + if (win == startingWindow || win.mAppFreezing + || win.mAttrs.type == TYPE_APPLICATION_STARTING) { continue; } if (DEBUG_VISIBILITY) { @@ -10985,6 +11003,7 @@ public class WindowManagerService extends IWindowManager.Stub try { mDimSurface = new Surface(session, 0, -1, 16, 16, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM); + mDimSurface.setAlpha(0.0f); } catch (Exception e) { Log.e(TAG, "Exception creating Dim surface", e); } diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 5f6356d..9e9552a 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -3566,7 +3566,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen if (DEBUG_TASKS) Log.v(TAG, "Starting new activity " + r + " in new task " + r.task); newTask = true; - addRecentTask(r.task); + addRecentTaskLocked(r.task); } else if (sourceRecord != null) { if (!addingToTask && @@ -3855,7 +3855,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } } - private final void addRecentTask(TaskRecord task) { + private final void addRecentTaskLocked(TaskRecord task) { // Remove any existing entries that are the same kind of task. int N = mRecentTasks.size(); for (int i=0; i<N; i++) { @@ -4931,9 +4931,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen Intent intent = new Intent(Intent.ACTION_PACKAGE_DATA_CLEARED, Uri.fromParts("package", packageName, null)); intent.putExtra(Intent.EXTRA_UID, pkgUid); - broadcastIntentLocked(null, null, intent, - null, null, 0, null, null, null, - false, false, MY_PID, Process.SYSTEM_UID); + synchronized (this) { + broadcastIntentLocked(null, null, intent, + null, null, 0, null, null, null, + false, false, MY_PID, Process.SYSTEM_UID); + } } catch (RemoteException e) { } } finally { @@ -5668,7 +5670,9 @@ public final class ActivityManagerService extends ActivityManagerNative implemen ArrayList<ProcessRecord> procs = new ArrayList<ProcessRecord>(mProcessesOnHold); for (int ip=0; ip<NP; ip++) { - this.startProcessLocked(procs.get(ip), "on-hold", null); + synchronized (this) { + this.startProcessLocked(procs.get(ip), "on-hold", null); + } } } if (mFactoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) { @@ -6887,7 +6891,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen taskTopI = -1; } replyChainEnd = -1; - addRecentTask(target.task); + addRecentTaskLocked(target.task); } else if (forceReset || finishOnTaskLaunch || clearWhenTaskReset) { // If the activity should just be removed -- either @@ -7109,7 +7113,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen moved.add(0, r); top--; if (first) { - addRecentTask(r.task); + addRecentTaskLocked(r.task); first = false; } } @@ -7134,11 +7138,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen mWindowManager.validateAppTokens(mHistory); } - finishTaskMove(task); + finishTaskMoveLocked(task); EventLog.writeEvent(LOG_TASK_TO_FRONT, task); } - private final void finishTaskMove(int task) { + private final void finishTaskMoveLocked(int task) { resumeTopActivityLocked(null); } @@ -7256,7 +7260,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen mWindowManager.validateAppTokens(mHistory); } - finishTaskMove(task); + finishTaskMoveLocked(task); return true; } @@ -7879,9 +7883,14 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } public static final void installSystemProviders() { - ProcessRecord app = mSelf.mProcessNames.get("system", Process.SYSTEM_UID); - List providers = mSelf.generateApplicationProvidersLocked(app); - mSystemThread.installSystemProviders(providers); + List providers = null; + synchronized (mSelf) { + ProcessRecord app = mSelf.mProcessNames.get("system", Process.SYSTEM_UID); + providers = mSelf.generateApplicationProvidersLocked(app); + } + if (providers != null) { + mSystemThread.installSystemProviders(providers); + } } // ========================================================= @@ -8156,11 +8165,15 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } public void registerActivityWatcher(IActivityWatcher watcher) { - mWatchers.register(watcher); + synchronized (this) { + mWatchers.register(watcher); + } } public void unregisterActivityWatcher(IActivityWatcher watcher) { - mWatchers.unregister(watcher); + synchronized (this) { + mWatchers.unregister(watcher); + } } public final void enterSafeMode() { @@ -11564,7 +11577,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen // BROADCASTS // ========================================================= - private final List getStickies(String action, IntentFilter filter, + private final List getStickiesLocked(String action, IntentFilter filter, List cur) { final ContentResolver resolver = mContext.getContentResolver(); final ArrayList<Intent> list = mStickyBroadcasts.get(action); @@ -11616,10 +11629,10 @@ public final class ActivityManagerService extends ActivityManagerNative implemen if (actions != null) { while (actions.hasNext()) { String action = (String)actions.next(); - allSticky = getStickies(action, filter, allSticky); + allSticky = getStickiesLocked(action, filter, allSticky); } } else { - allSticky = getStickies(null, filter, allSticky); + allSticky = getStickiesLocked(null, filter, allSticky); } // The first sticky in the list is returned directly back to @@ -13357,7 +13370,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen /** * Returns true if things are idle enough to perform GCs. */ - private final boolean canGcNow() { + private final boolean canGcNowLocked() { return mParallelBroadcasts.size() == 0 && mOrderedBroadcasts.size() == 0 && (mSleeping || (mResumedActivity != null && @@ -13373,7 +13386,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen if (N <= 0) { return; } - if (canGcNow()) { + if (canGcNowLocked()) { while (mProcessesToGc.size() > 0) { ProcessRecord proc = mProcessesToGc.remove(0); if (proc.curRawAdj > VISIBLE_APP_ADJ || proc.reportLowMemory) { @@ -13401,7 +13414,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen * If all looks good, perform GCs on all processes waiting for them. */ final void performAppGcsIfAppropriateLocked() { - if (canGcNow()) { + if (canGcNowLocked()) { performAppGcsLocked(); return; } diff --git a/services/java/com/android/server/am/ServiceRecord.java b/services/java/com/android/server/am/ServiceRecord.java index 89761a8..2f2cc32 100644 --- a/services/java/com/android/server/am/ServiceRecord.java +++ b/services/java/com/android/server/am/ServiceRecord.java @@ -29,6 +29,7 @@ import android.os.Binder; import android.os.IBinder; import android.os.RemoteException; import android.os.SystemClock; +import android.util.Log; import java.io.PrintWriter; import java.util.ArrayList; @@ -267,6 +268,9 @@ class ServiceRecord extends Binder { int[] outId = new int[1]; inm.enqueueNotification(localPackageName, localForegroundId, localForegroundNoti, outId); + } catch (RuntimeException e) { + Log.w(ActivityManagerService.TAG, "Error showing notification for service", + e); } catch (RemoteException e) { } } @@ -288,6 +292,9 @@ class ServiceRecord extends Binder { } try { inm.cancelNotification(localPackageName, localForegroundId); + } catch (RuntimeException e) { + Log.w(ActivityManagerService.TAG, "Error canceling notification for" + + " service", e); } catch (RemoteException e) { } } diff --git a/services/java/com/android/server/status/StatusBarPolicy.java b/services/java/com/android/server/status/StatusBarPolicy.java index bee0930..9a3baff 100644 --- a/services/java/com/android/server/status/StatusBarPolicy.java +++ b/services/java/com/android/server/status/StatusBarPolicy.java @@ -843,7 +843,9 @@ public class StatusBarPolicy { && ((mServiceState.getRadioTechnology() == ServiceState.RADIO_TECHNOLOGY_EVDO_0) || (mServiceState.getRadioTechnology() - == ServiceState.RADIO_TECHNOLOGY_EVDO_A))); + == ServiceState.RADIO_TECHNOLOGY_EVDO_A) + || (mServiceState.getRadioTechnology() + == ServiceState.RADIO_TECHNOLOGY_EVDO_B))); } private boolean hasService() { @@ -958,7 +960,6 @@ public class StatusBarPolicy { } private final void updateDataNetType(int net) { - switch (net) { case TelephonyManager.NETWORK_TYPE_EDGE: mDataIconList = sDataNetType_e; @@ -984,6 +985,7 @@ public class StatusBarPolicy { break; case TelephonyManager.NETWORK_TYPE_EVDO_0: //fall through case TelephonyManager.NETWORK_TYPE_EVDO_A: + case TelephonyManager.NETWORK_TYPE_EVDO_B: mDataIconList = sDataNetType_3g; break; default: |