diff options
14 files changed, 157 insertions, 75 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index f239cc5997c2..199e5b1d6d37 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -1487,6 +1487,9 @@ <!-- default window inset isRound property --> <bool name="config_windowIsRound">false</bool> + <!-- default device has recents property --> + <bool name="config_hasRecents">true</bool> + <!-- Defines the default set of global actions. Actions may still be disabled or hidden based on the current state of the device. Each item must be one of the following strings: @@ -1505,4 +1508,6 @@ <item>users</item> </string-array> + <bool name="config_networkSamplingWakesDevice">true</bool> + </resources> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index c5b8a5a82054..79dcde999983 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -258,6 +258,7 @@ <java-symbol type="bool" name="config_enable_emergency_call_while_sim_locked" /> <java-symbol type="bool" name="config_enable_puk_unlock_screen" /> <java-symbol type="bool" name="config_mms_content_disposition_support" /> + <java-symbol type="bool" name="config_networkSamplingWakesDevice" /> <java-symbol type="bool" name="config_showMenuShortcutsWhenKeyboardPresent" /> <java-symbol type="bool" name="config_sip_wifi_only" /> <java-symbol type="bool" name="config_sms_capable" /> @@ -290,6 +291,7 @@ <java-symbol type="bool" name="config_forceDefaultOrientation" /> <java-symbol type="bool" name="config_wifi_batched_scan_supported" /> <java-symbol type="bool" name="config_windowIsRound" /> + <java-symbol type="bool" name="config_hasRecents" /> <java-symbol type="integer" name="config_cursorWindowSize" /> <java-symbol type="integer" name="config_extraFreeKbytesAdjust" /> diff --git a/core/tests/bluetoothtests/src/android/bluetooth/BluetoothInstrumentation.java b/core/tests/bluetoothtests/src/android/bluetooth/BluetoothInstrumentation.java index 22dce393f67d..411a3f894965 100644 --- a/core/tests/bluetoothtests/src/android/bluetooth/BluetoothInstrumentation.java +++ b/core/tests/bluetoothtests/src/android/bluetooth/BluetoothInstrumentation.java @@ -20,6 +20,8 @@ import android.app.Instrumentation; import android.content.Context; import android.os.Bundle; +import junit.framework.Assert; + import java.util.Set; public class BluetoothInstrumentation extends Instrumentation { @@ -70,6 +72,8 @@ public class BluetoothInstrumentation extends Instrumentation { getAddress(); } else if ("getBondedDevices".equals(command)) { getBondedDevices(); + } else if ("enableBtSnoop".equals(command)) { + enableBtSnoop(); } else { finish(null); } @@ -112,6 +116,12 @@ public class BluetoothInstrumentation extends Instrumentation { finish(mSuccessResult); } + public void enableBtSnoop() { + Assert.assertTrue("failed to enable snoop log", + getBluetoothAdapter().configHciSnoopLog(true)); + finish(mSuccessResult); + } + public void finish(Bundle result) { if (result == null) { result = new Bundle(); diff --git a/docs/html/images/ui/sample-linearlayout.png b/docs/html/images/ui/sample-linearlayout.png Binary files differindex c4beb93a6d07..04c9259ddf23 100644 --- a/docs/html/images/ui/sample-linearlayout.png +++ b/docs/html/images/ui/sample-linearlayout.png diff --git a/docs/html/tools/publishing/preparing.jd b/docs/html/tools/publishing/preparing.jd index 7192aa83df8a..5265fce93d91 100644 --- a/docs/html/tools/publishing/preparing.jd +++ b/docs/html/tools/publishing/preparing.jd @@ -191,6 +191,13 @@ were created in your project.</p> added to your code, such as {@link android.os.Debug#startMethodTracing()} and {@link android.os.Debug#stopMethodTracing()} method calls.</p> +<p class="caution"><strong>Important:</strong> Ensure that you disable debugging for +your app if using {@link android.webkit.WebView} to display paid for content or if using JavaScript +interfaces, since debugging allows users to inject scripts and extract content using Chrome +DevTools. To disable debugging, use the +{@link android.webkit.WebView#setWebContentsDebuggingEnabled(boolean) WebView.setWebContentsDebuggingEnabled()} +method.</p> + <h4>Clean up your project directories</h4> <p>Clean up your project and make sure it conforms to the directory structure described in <a diff --git a/packages/Shell/res/values/strings.xml b/packages/Shell/res/values/strings.xml index e5606c78ec06..51e2c951a2a5 100644 --- a/packages/Shell/res/values/strings.xml +++ b/packages/Shell/res/values/strings.xml @@ -19,8 +19,12 @@ <!-- Title of notification indicating a bugreport has been successfully captured. [CHAR LIMIT=50] --> <string name="bugreport_finished_title">Bug report captured</string> + + <!-- Text of notification indicating that swipe left will share the captured bugreport. [CHAR LIMIT=100] --> + <string name="bugreport_finished_text" product="watch">Swipe left to share your bug report</string> <!-- Text of notification indicating that touching will share the captured bugreport. [CHAR LIMIT=100] --> - <string name="bugreport_finished_text">Touch to share your bug report</string> + <string name="bugreport_finished_text" product="default">Touch to share your bug report</string> + <!-- Body of dialog informing user about contents of a bugreport. [CHAR LIMIT=NONE] --> <string name="bugreport_confirm">Bug reports contain data from the system\'s various log files, including personal and private information. Only share bug reports with apps and people you trust.</string> diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index 610f6cfc126e..fe3021b009c0 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -69,6 +69,7 @@ import android.util.SparseArray; import android.util.TypedValue; import android.view.ActionMode; import android.view.ContextThemeWrapper; +import android.view.Display; import android.view.Gravity; import android.view.IRotationWatcher; import android.view.IWindowManager; @@ -88,6 +89,7 @@ import android.view.ViewParent; import android.view.ViewRootImpl; import android.view.ViewStub; import android.view.Window; +import android.view.WindowInsets; import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; @@ -2094,6 +2096,22 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } @Override + public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) { + if (mOutsetBottom != null) { + final DisplayMetrics metrics = getContext().getResources().getDisplayMetrics(); + int bottom = (int) mOutsetBottom.getDimension(metrics); + WindowInsets newInsets = insets.replaceSystemWindowInsets( + insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), + insets.getSystemWindowInsetRight(), + insets.getSystemWindowInsetBottom() + bottom); + return super.dispatchApplyWindowInsets(newInsets); + } else { + return super.dispatchApplyWindowInsets(insets); + } + } + + + @Override public boolean onTouchEvent(MotionEvent event) { return onInterceptTouchEvent(event); } @@ -2924,9 +2942,17 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { a.getValue(com.android.internal.R.styleable.Window_windowFixedHeightMinor, mFixedHeightMinor); } - if (a.hasValue(com.android.internal.R.styleable.Window_windowOutsetBottom)) { - if (mOutsetBottom == null) mOutsetBottom = new TypedValue(); - a.getValue(com.android.internal.R.styleable.Window_windowOutsetBottom, mOutsetBottom); + + final WindowManager windowService = (WindowManager) getContext().getSystemService( + Context.WINDOW_SERVICE); + if (windowService != null) { + final Display display = windowService.getDefaultDisplay(); + if (display.getDisplayId() == Display.DEFAULT_DISPLAY && + a.hasValue(com.android.internal.R.styleable.Window_windowOutsetBottom)) { + if (mOutsetBottom == null) mOutsetBottom = new TypedValue(); + a.getValue(com.android.internal.R.styleable.Window_windowOutsetBottom, + mOutsetBottom); + } } final Context context = getContext(); diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 8e085839795b..aa14da136b31 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -5038,8 +5038,18 @@ public class ConnectivityService extends IConnectivityManager.Stub { setAlarm(samplingIntervalInSeconds * 1000, mSampleIntervalElapsedIntent); } + /** + * Sets a network sampling alarm. + */ void setAlarm(int timeoutInMilliseconds, PendingIntent intent) { long wakeupTime = SystemClock.elapsedRealtime() + timeoutInMilliseconds; - mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, wakeupTime, intent); + int alarmType; + if (Resources.getSystem().getBoolean( + R.bool.config_networkSamplingWakesDevice)) { + alarmType = AlarmManager.ELAPSED_REALTIME_WAKEUP; + } else { + alarmType = AlarmManager.ELAPSED_REALTIME; + } + mAlarmManager.set(alarmType, wakeupTime, intent); } } diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index d09ee967fa1e..a6deed54eab3 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -340,28 +340,6 @@ public final class ActivityManagerService extends ActivityManagerNative // devices. private boolean mShowDialogs = true; - /** - * Description of a request to start a new activity, which has been held - * due to app switches being disabled. - */ - static class PendingActivityLaunch { - final ActivityRecord r; - final ActivityRecord sourceRecord; - final int startFlags; - final ActivityStack stack; - - PendingActivityLaunch(ActivityRecord _r, ActivityRecord _sourceRecord, - int _startFlags, ActivityStack _stack) { - r = _r; - sourceRecord = _sourceRecord; - startFlags = _startFlags; - stack = _stack; - } - } - - final ArrayList<PendingActivityLaunch> mPendingActivityLaunches - = new ArrayList<PendingActivityLaunch>(); - BroadcastQueue mFgBroadcastQueue; BroadcastQueue mBgBroadcastQueue; // Convenient for easy iteration over the queues. Foreground is first @@ -1074,6 +1052,9 @@ public final class ActivityManagerService extends ActivityManagerNative */ private boolean mUserIsMonkey; + /** Flag whether the device has a recents UI */ + final boolean mHasRecents; + final ServiceThread mHandlerThread; final MainHandler mHandler; @@ -1320,7 +1301,7 @@ public final class ActivityManagerService extends ActivityManagerNative } break; case DO_PENDING_ACTIVITY_LAUNCHES_MSG: { synchronized (ActivityManagerService.this) { - doPendingActivityLaunchesLocked(true); + mStackSupervisor.doPendingActivityLaunchesLocked(true); } } break; case KILL_APPLICATION_MSG: { @@ -1941,6 +1922,9 @@ public final class ActivityManagerService extends ActivityManagerNative mConfigurationSeq = mConfiguration.seq = 1; mProcessCpuTracker.init(); + mHasRecents = mContext.getResources().getBoolean( + com.android.internal.R.bool.config_hasRecents); + mCompatModePackages = new CompatModePackages(this, systemDir, mHandler); mIntentFirewall = new IntentFirewall(new IntentFirewallInterface(), mHandler); mStackSupervisor = new ActivityStackSupervisor(this); @@ -3028,19 +3012,6 @@ public final class ActivityManagerService extends ActivityManagerNative mProcessObservers.finishBroadcast(); } - final void doPendingActivityLaunchesLocked(boolean doResume) { - final int N = mPendingActivityLaunches.size(); - if (N <= 0) { - return; - } - for (int i=0; i<N; i++) { - PendingActivityLaunch pal = mPendingActivityLaunches.get(i); - mStackSupervisor.startActivityUncheckedLocked(pal.r, pal.sourceRecord, pal.startFlags, - doResume && i == (N-1), null); - } - mPendingActivityLaunches.clear(); - } - @Override public final int startActivity(IApplicationThread caller, String callingPackage, Intent intent, String resolvedType, IBinder resultTo, @@ -8274,6 +8245,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } + @Override public void stopAppSwitches() { if (checkCallingPermission(android.Manifest.permission.STOP_APP_SWITCHES) != PackageManager.PERMISSION_GRANTED) { diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index d894e4eb2f10..224946ce89c0 100755 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -754,7 +754,7 @@ final class ActivityStack { prev.task.touchActiveTime(); clearLaunchTime(prev); final ActivityRecord next = mStackSupervisor.topRunningActivityLocked(); - if (next == null || next.task != prev.task) { + if (mService.mHasRecents && (next == null || next.task != prev.task)) { prev.updateThumbnail(screenshotActivities(prev), null); } stopFullyDrawnTraceIfNeeded(); @@ -2558,18 +2558,23 @@ final class ActivityStack { return r; } - void finishAllActivitiesLocked() { + void finishAllActivitiesLocked(boolean immediately) { + boolean noActivitiesInStack = true; for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) { final ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities; for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) { final ActivityRecord r = activities.get(activityNdx); - if (r.finishing) { + noActivitiesInStack = false; + if (r.finishing && !immediately) { continue; } - Slog.d(TAG, "finishAllActivitiesLocked: finishing " + r); + Slog.d(TAG, "finishAllActivitiesLocked: finishing " + r + " immediately"); finishCurrentActivityLocked(r, FINISH_IMMEDIATELY, false); } } + if (noActivitiesInStack) { + mActivityContainer.onTaskListEmptyLocked(); + } } final boolean navigateUpToLocked(IBinder token, Intent destIntent, int resultCode, @@ -2683,6 +2688,7 @@ final class ActivityStack { // down to the max limit while they are still waiting to finish. mStackSupervisor.mFinishingActivities.remove(r); mStackSupervisor.mWaitingVisibleActivities.remove(r); + mStackSupervisor.removePendingActivityLaunchesLocked(r); // Remove any pending results. if (r.finishing && r.pendingResults != null) { diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index bca215dde51a..611b28fe3974 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -88,7 +88,6 @@ import android.view.Surface; import com.android.internal.app.HeavyWeightSwitcherActivity; import com.android.internal.os.TransferPipe; import com.android.server.LocalServices; -import com.android.server.am.ActivityManagerService.PendingActivityLaunch; import com.android.server.am.ActivityStack.ActivityState; import com.android.server.wm.WindowManagerService; @@ -234,6 +233,28 @@ public final class ActivityStackSupervisor implements DisplayListener { InputManagerInternal mInputManagerInternal; + final ArrayList<PendingActivityLaunch> mPendingActivityLaunches + = new ArrayList<PendingActivityLaunch>(); + + /** + * Description of a request to start a new activity, which has been held + * due to app switches being disabled. + */ + static class PendingActivityLaunch { + final ActivityRecord r; + final ActivityRecord sourceRecord; + final int startFlags; + final ActivityStack stack; + + PendingActivityLaunch(ActivityRecord _r, ActivityRecord _sourceRecord, + int _startFlags, ActivityStack _stack) { + r = _r; + sourceRecord = _sourceRecord; + startFlags = _startFlags; + stack = _stack; + } + } + public ActivityStackSupervisor(ActivityManagerService service) { mService = service; PowerManager pm = (PowerManager)mService.mContext.getSystemService(Context.POWER_SERVICE); @@ -1304,7 +1325,7 @@ public final class ActivityStackSupervisor implements DisplayListener { if (!mService.checkAppSwitchAllowedLocked(callingPid, callingUid, "Activity start")) { PendingActivityLaunch pal = new PendingActivityLaunch(r, sourceRecord, startFlags, stack); - mService.mPendingActivityLaunches.add(pal); + mPendingActivityLaunches.add(pal); setDismissKeyguard(false); ActivityOptions.abort(options); return ActivityManager.START_SWITCHES_CANCELED; @@ -1322,7 +1343,7 @@ public final class ActivityStackSupervisor implements DisplayListener { mService.mDidAppSwitch = true; } - mService.doPendingActivityLaunchesLocked(false); + doPendingActivityLaunchesLocked(false); err = startActivityUncheckedLocked(r, sourceRecord, startFlags, true, options); @@ -1830,6 +1851,23 @@ public final class ActivityStackSupervisor implements DisplayListener { return ActivityManager.START_SUCCESS; } + final void doPendingActivityLaunchesLocked(boolean doResume) { + while (!mPendingActivityLaunches.isEmpty()) { + PendingActivityLaunch pal = mPendingActivityLaunches.remove(0); + startActivityUncheckedLocked(pal.r, pal.sourceRecord, pal.startFlags, + doResume && mPendingActivityLaunches.isEmpty(), null); + } + } + + void removePendingActivityLaunchesLocked(ActivityRecord r) { + for (int palNdx = mPendingActivityLaunches.size() - 1; palNdx >= 0; --palNdx) { + PendingActivityLaunch pal = mPendingActivityLaunches.get(palNdx); + if (pal.r == r) { + mPendingActivityLaunches.remove(palNdx); + } + } + } + void acquireLaunchWakelock() { if (VALIDATE_WAKE_LOCK_CALLER && Binder.getCallingUid() != Process.myUid()) { throw new IllegalStateException("Calling must be system uid"); @@ -1924,10 +1962,8 @@ public final class ActivityStackSupervisor implements DisplayListener { thumbnails = null; } - if (isFrontStack(mHomeStack)) { - booting = mService.mBooting; - mService.mBooting = false; - } + booting = mService.mBooting; + mService.mBooting = false; if (mStartingUsers.size() > 0) { startingUsers = new ArrayList<UserStartedState>(mStartingUsers); @@ -2960,7 +2996,9 @@ public final class ActivityStackSupervisor implements DisplayListener { synchronized (mService) { Slog.w(TAG, "Timeout waiting for all activities in task to finish. " + msg.obj); - ((ActivityContainer) msg.obj).onTaskListEmptyLocked(); + final ActivityContainer container = (ActivityContainer) msg.obj; + container.mStack.finishAllActivitiesLocked(true); + container.onTaskListEmptyLocked(); } } break; } @@ -3054,11 +3092,11 @@ public final class ActivityStackSupervisor implements DisplayListener { final Message msg = mHandler.obtainMessage(CONTAINER_TASK_LIST_EMPTY_TIMEOUT, this); - mHandler.sendMessageDelayed(msg, 1000); + mHandler.sendMessageDelayed(msg, 2000); long origId = Binder.clearCallingIdentity(); try { - mStack.finishAllActivitiesLocked(); + mStack.finishAllActivitiesLocked(false); } finally { Binder.restoreCallingIdentity(origId); } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 5626c7a2aad0..e3e79f0fbe8a 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -10930,14 +10930,19 @@ public class WindowManagerService extends IWindowManager.Stub public void waitForAllWindowsDrawn(IRemoteCallback callback, long timeout) { synchronized (mWindowMap) { mWaitingForDrawnCallback = callback; - final WindowList windows = getDefaultWindowListLocked(); - for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) { - final WindowState win = windows.get(winNdx); - if (win.mHasSurface) { - win.mWinAnimator.mDrawState = WindowStateAnimator.DRAW_PENDING; - // Force add to mResizingWindows. - win.mLastContentInsets.set(-1, -1, -1, -1); - mWaitingForDrawn.add(win); + for (int displayNdx = mDisplayContents.size() - 1; displayNdx >= 0; --displayNdx) { + final WindowList windows = + mDisplayContents.valueAt(displayNdx).getWindowList(); + for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) { + final WindowState win = windows.get(winNdx); + if (win.mHasSurface) { + win.mWinAnimator.mDrawState = WindowStateAnimator.DRAW_PENDING; + // Force add to mResizingWindows. + win.mLastContentInsets.set(-1, -1, -1, -1); + if (DEBUG_SCREEN_ON) Slog.d(TAG, "waitForAllWindowsDrawn: adding " + + win); + mWaitingForDrawn.add(win); + } } } requestTraversalLocked(); diff --git a/tools/layoutlib/bridge/src/android/text/AndroidBidi_Delegate.java b/tools/layoutlib/bridge/src/android/text/AndroidBidi_Delegate.java index 973fa0e9ef54..d9f47642a934 100644 --- a/tools/layoutlib/bridge/src/android/text/AndroidBidi_Delegate.java +++ b/tools/layoutlib/bridge/src/android/text/AndroidBidi_Delegate.java @@ -40,10 +40,10 @@ public class AndroidBidi_Delegate { case 1: // Layout.DIR_REQUEST_RTL break; // No change. case -1: - dir = Bidi.LEVEL_DEFAULT_LTR; + dir = Bidi.LEVEL_DEFAULT_RTL; break; case -2: - dir = Bidi.LEVEL_DEFAULT_RTL; + dir = Bidi.LEVEL_DEFAULT_LTR; break; default: // Invalid code. Log error, assume LEVEL_DEFAULT_LTR and continue. diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java index fde4e1a31a50..29e1f769289e 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java @@ -620,19 +620,16 @@ public final class BridgeContext extends Context { } if (value != null) { - if ((value.getFirst() == ResourceType.STYLE) - || (value.getFirst() == ResourceType.ATTR)) { - // look for the style in the current theme, and its parent: - ResourceValue item = mRenderResources.findItemInTheme(value.getSecond(), + if (value.getFirst() == ResourceType.STYLE) { + // look for the style in all resources: + StyleResourceValue item = mRenderResources.getStyle(value.getSecond(), isFrameworkRes); if (item != null) { - if (item instanceof StyleResourceValue) { - if (defaultPropMap != null) { - defaultPropMap.put("style", item.getName()); - } - - defStyleValues = (StyleResourceValue)item; + if (defaultPropMap != null) { + defaultPropMap.put("style", item.getName()); } + + defStyleValues = item; } else { Bridge.getLog().error(null, String.format( |