Merge "Invalid accessibility state if UI test process crashes in a bad time." into lmp-dev
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 5ba7d50..cc0d51c 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -132,6 +132,7 @@
" am to-uri [INTENT]\n" +
" am to-intent-uri [INTENT]\n" +
" am switch-user <USER_ID>\n" +
+ " am start-user <USER_ID>\n" +
" am stop-user <USER_ID>\n" +
" am stack start <DISPLAY_ID> <INTENT>\n" +
" am stack movetask <TASK_ID> <STACK_ID> [true|false]\n" +
@@ -233,8 +234,11 @@
"am switch-user: switch to put USER_ID in the foreground, starting\n" +
" execution of that user if it is currently stopped.\n" +
"\n" +
+ "am start-user: start USER_ID in background if it is currently stopped,\n" +
+ " use switch-user if you want to start the user in foreground.\n" +
+ "\n" +
"am stop-user: stop execution of USER_ID, not allowing it to run any\n" +
- " code until a later explicit switch to it.\n" +
+ " code until a later explicit start or switch to it.\n" +
"\n" +
"am stack start: start a new activity on <DISPLAY_ID> using <INTENT>.\n" +
"\n" +
@@ -340,6 +344,8 @@
runToUri(true);
} else if (op.equals("switch-user")) {
runSwitchUser();
+ } else if (op.equals("start-user")) {
+ runStartUserInBackground();
} else if (op.equals("stop-user")) {
runStopUser();
} else if (op.equals("stack")) {
@@ -1133,6 +1139,16 @@
mAm.switchUser(Integer.parseInt(user));
}
+ private void runStartUserInBackground() throws Exception {
+ String user = nextArgRequired();
+ boolean success = mAm.startUserInBackground(Integer.parseInt(user));
+ if (success) {
+ System.out.println("Success: user started");
+ } else {
+ System.err.println("Error: could not start user");
+ }
+ }
+
private void runStopUser() throws Exception {
String user = nextArgRequired();
int res = mAm.stopUser(Integer.parseInt(user), null);
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 3d14c58..cd6088f 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -579,7 +579,7 @@
public TaskDescription(TaskDescription td) {
mLabel = td.mLabel;
mIcon = td.mIcon;
- setPrimaryColor(td.mColorPrimary);
+ mColorPrimary = td.mColorPrimary;
mIconFilename = td.mIconFilename;
}
@@ -600,7 +600,11 @@
* @hide
*/
public void setPrimaryColor(int primaryColor) {
- mColorPrimary = 0xFF000000 | primaryColor;
+ // Ensure that the given color is valid
+ if ((primaryColor != 0) && (Color.alpha(primaryColor) != 255)) {
+ throw new RuntimeException("A TaskDescription's primary color should be opaque");
+ }
+ mColorPrimary = primaryColor;
}
/**
diff --git a/core/java/android/app/ApplicationErrorReport.java b/core/java/android/app/ApplicationErrorReport.java
index be4e80e..841bd16 100644
--- a/core/java/android/app/ApplicationErrorReport.java
+++ b/core/java/android/app/ApplicationErrorReport.java
@@ -388,7 +388,7 @@
dest.writeInt(throwLineNumber);
dest.writeString(stackTrace);
int total = dest.dataPosition()-start;
- if (total > 100*1024) {
+ if (total > 10*1024) {
Slog.d("Error", "ERR: exClass=" + exceptionClassName);
Slog.d("Error", "ERR: exMsg=" + exceptionMessage);
Slog.d("Error", "ERR: file=" + throwFileName);
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 31b39ebb2..4b3aefe 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -798,8 +798,8 @@
public static final String EXTRA_TEMPLATE = "android.template";
/**
- * {@link #extras} key: An array of people that this notification relates to, specified
- * by contacts provider contact URI.
+ * {@link #extras} key: A String array containing the people that this notification relates to,
+ * each of which was supplied to {@link Builder#addPerson(String)}.
*/
public static final String EXTRA_PEOPLE = "android.people";
@@ -2393,10 +2393,27 @@
/**
* Add a person that is relevant to this notification.
*
+ * <P>
+ * Depending on user preferences, this annotation may allow the notification to pass
+ * through interruption filters, and to appear more prominently in the user interface.
+ * </P>
+ *
+ * <P>
+ * The person should be specified by the {@code String} representation of a
+ * {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI}.
+ * </P>
+ *
+ * <P>The system will also attempt to resolve {@code mailto:} and {@code tel:} schema
+ * URIs. The path part of these URIs must exist in the contacts database, in the
+ * appropriate column, or the reference will be discarded as invalid. Telephone schema
+ * URIs will be resolved by {@link android.provider.ContactsContract.PhoneLookup}.
+ * </P>
+ *
+ * @param uri A URI for the person.
* @see Notification#EXTRA_PEOPLE
*/
- public Builder addPerson(String handle) {
- mPeople.add(handle);
+ public Builder addPerson(String uri) {
+ mPeople.add(uri);
return this;
}
diff --git a/core/java/android/hardware/camera2/legacy/RequestThreadManager.java b/core/java/android/hardware/camera2/legacy/RequestThreadManager.java
index fd95901..35deb71 100644
--- a/core/java/android/hardware/camera2/legacy/RequestThreadManager.java
+++ b/core/java/android/hardware/camera2/legacy/RequestThreadManager.java
@@ -16,11 +16,13 @@
package android.hardware.camera2.legacy;
+import android.graphics.ImageFormat;
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.impl.CameraDeviceImpl;
+import android.hardware.camera2.params.StreamConfigurationMap;
import android.hardware.camera2.utils.LongParcelable;
import android.hardware.camera2.utils.SizeAreaComparator;
import android.hardware.camera2.impl.CameraMetadataNative;
@@ -36,6 +38,7 @@
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -208,18 +211,23 @@
int totalSize = data.length + LegacyCameraDevice.nativeGetJpegFooterSize();
totalSize = (totalSize + 3) & ~0x3; // round up to nearest octonibble
+ LegacyCameraDevice.setNextTimestamp(s, timestamp);
if (USE_BLOB_FORMAT_OVERRIDE) {
// Override to RGBA_8888 format.
LegacyCameraDevice.setSurfaceFormat(s,
LegacyMetadataMapper.HAL_PIXEL_FORMAT_RGBA_8888);
- // divide by 4 if using RGBA format (width is in pixels, not bytes).
- totalSize >>= 2;
+
+ int dimen = (int) Math.ceil(Math.sqrt(totalSize));
+ dimen = (dimen + 0xf) & ~0xf; // round up to nearest multiple of 16
+ LegacyCameraDevice.setSurfaceDimens(s, dimen, dimen);
+ LegacyCameraDevice.produceFrame(s, data, dimen, dimen,
+ CameraMetadataNative.NATIVE_JPEG_FORMAT);
+ } else {
+ LegacyCameraDevice.setSurfaceDimens(s, totalSize, /*height*/1);
+ LegacyCameraDevice.produceFrame(s, data, totalSize, /*height*/1,
+ CameraMetadataNative.NATIVE_JPEG_FORMAT);
}
- LegacyCameraDevice.setSurfaceDimens(s, totalSize, /*height*/1);
- LegacyCameraDevice.setNextTimestamp(s, timestamp);
- LegacyCameraDevice.produceFrame(s, data, totalSize, /*height*/1,
- CameraMetadataNative.NATIVE_JPEG_FORMAT);
}
} catch (LegacyExceptionUtils.BufferQueueAbandonedException e) {
Log.w(TAG, "Surface abandoned, dropping frame. ", e);
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index f5fc0d7..bbf6ed8 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -430,16 +430,18 @@
} catch (RemoteException e) {
if ((flags & FLAG_ONEWAY) != 0) {
Log.w(TAG, "Binder call failed.", e);
+ } else {
+ reply.setDataPosition(0);
+ reply.writeException(e);
}
- reply.setDataPosition(0);
- reply.writeException(e);
res = true;
} catch (RuntimeException e) {
if ((flags & FLAG_ONEWAY) != 0) {
Log.w(TAG, "Caught a RuntimeException from the binder stub implementation.", e);
+ } else {
+ reply.setDataPosition(0);
+ reply.writeException(e);
}
- reply.setDataPosition(0);
- reply.writeException(e);
res = true;
} catch (OutOfMemoryError e) {
// Unconditionally log this, since this is generally unrecoverable.
@@ -452,6 +454,14 @@
checkParcel(this, code, reply, "Unreasonably large binder reply buffer");
reply.recycle();
data.recycle();
+
+ // Just in case -- we are done with the IPC, so there should be no more strict
+ // mode violations that have gathered for this thread. Either they have been
+ // parceled and are now in transport off to the caller, or we are returning back
+ // to the main transaction loop to wait for another incoming transaction. Either
+ // way, strict mode begone!
+ StrictMode.clearGatheredViolations();
+
return res;
}
}
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index 4e9d1f0..0e561bd 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -1693,7 +1693,7 @@
int start = p.dataPosition();
violations.get(i).writeToParcel(p, 0 /* unused flags? */);
int size = p.dataPosition()-start;
- if (size > 100*1024) {
+ if (size > 10*1024) {
Slog.d(TAG, "Wrote violation #" + i + " of " + violations.size() + ": "
+ (p.dataPosition()-start) + " bytes");
}
@@ -1725,6 +1725,11 @@
for (int i = 0; i < numViolations; ++i) {
if (LOG_V) Log.d(TAG, "strict mode violation stacks read from binder call. i=" + i);
ViolationInfo info = new ViolationInfo(p, !currentlyGathering);
+ if (info.crashInfo.stackTrace.length() > 5000) {
+ RuntimeException here = new RuntimeException("here");
+ here.fillInStackTrace();
+ Slog.w(TAG, "Stack is getting large: " + info.crashInfo.stackTrace, here);
+ }
info.crashInfo.stackTrace += "# via Binder call with stack:\n" + ourStack;
BlockGuard.Policy policy = BlockGuard.getThreadPolicy();
if (policy instanceof AndroidBlockGuardPolicy) {
@@ -2194,7 +2199,7 @@
dest.writeString(broadcastIntentAction);
dest.writeStringArray(tags);
int total = dest.dataPosition()-start;
- if (total > 100*1024) {
+ if (total > 10*1024) {
Slog.d(TAG, "VIO: policy=" + policy + " dur=" + durationMillis
+ " numLoop=" + violationNumThisLoop
+ " anim=" + numAnimationsRunning
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index 35fff74..5d6acd8 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -760,6 +760,9 @@
/**
* Returns whether the notification matches the user's interruption
* filter.
+ *
+ * @return {@code true} if the notification is allowed by the filter, or
+ * {@code false} if it is blocked.
*/
public boolean matchesInterruptionFilter() {
return mMatchesInterruptionFilter;
diff --git a/core/java/android/view/AccessibilityManagerInternal.java b/core/java/android/view/AccessibilityManagerInternal.java
new file mode 100644
index 0000000..7bb2dc5
--- /dev/null
+++ b/core/java/android/view/AccessibilityManagerInternal.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.view;
+
+/**
+ * Accessibility manager local system service interface.
+ *
+ * @hide Only for use within the system server.
+ */
+public abstract class AccessibilityManagerInternal {
+
+ /**
+ * Queries if the accessibility manager service permits setting
+ * a non-default encryption password.
+ */
+ public abstract boolean isNonDefaultEncryptionPasswordAllowed();
+}
diff --git a/core/java/android/view/GhostView.java b/core/java/android/view/GhostView.java
index 50c927a..20baad0 100644
--- a/core/java/android/view/GhostView.java
+++ b/core/java/android/view/GhostView.java
@@ -324,19 +324,27 @@
final ArrayList<View> preorderedList = parent.buildOrderedChildList();
final boolean customOrder = preorderedList == null
&& parent.isChildrenDrawingOrderEnabled();
+
+ // This default value shouldn't be used because both view and comparedWith
+ // should be in the list. If there is an error, then just return an arbitrary
+ // view is on top.
+ boolean isOnTop = true;
for (int i = 0; i < childrenCount; i++) {
int childIndex = customOrder ? parent.getChildDrawingOrder(childrenCount, i) : i;
final View child = (preorderedList == null)
? parent.getChildAt(childIndex) : preorderedList.get(childIndex);
if (child == view) {
- return false;
+ isOnTop = false;
+ break;
} else if (child == comparedWith) {
- return true;
+ isOnTop = true;
+ break;
}
}
- // Shouldn't get here. Neither of the children is in the parent.
- // Just return an arbitrary one.
- return true;
+ if (preorderedList != null) {
+ preorderedList.clear();
+ }
+ return isOnTop;
}
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 83dfe85..b454681 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -6601,6 +6601,7 @@
* @see #fitSystemWindows(Rect)
* @see #setSystemUiVisibility(int)
*/
+ @ViewDebug.ExportedProperty
public boolean getFitsSystemWindows() {
return (mViewFlags & FITS_SYSTEM_WINDOWS) == FITS_SYSTEM_WINDOWS;
}
diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java
index 235e79f..e317524 100644
--- a/core/java/android/widget/FrameLayout.java
+++ b/core/java/android/widget/FrameLayout.java
@@ -29,6 +29,7 @@
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.Gravity;
+import android.view.RemotableViewMethod;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
@@ -201,6 +202,15 @@
}
}
+ @Override
+ @RemotableViewMethod
+ public void setVisibility(@Visibility int visibility) {
+ super.setVisibility(visibility);
+ if (mForeground != null) {
+ mForeground.setVisible(visibility == VISIBLE, false);
+ }
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 42fc613..c00d209 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -6732,7 +6732,6 @@
Message m = mHandler.obtainMessage(MSG_REPORT_POWER_CHANGE);
m.arg1 = onBattery ? 1 : 0;
mHandler.sendMessage(m);
- mOnBattery = mOnBatteryInternal = onBattery;
final long uptime = mSecUptime * 1000;
final long realtime = mSecRealtime * 1000;
@@ -6745,10 +6744,11 @@
boolean reset = false;
if (!mNoAutoReset && (oldStatus == BatteryManager.BATTERY_STATUS_FULL
|| level >= 90
- || getLowDischargeAmountSinceCharge() >= 60)
- || (getHighDischargeAmountSinceCharge() >= 60
- && mHistoryBuffer.dataSize() >= MAX_HISTORY_BUFFER)) {
+ || (mDischargeCurrentLevel < 20 && level >= 80)
+ || (getHighDischargeAmountSinceCharge() >= 200
+ && mHistoryBuffer.dataSize() >= MAX_HISTORY_BUFFER))) {
Slog.i(TAG, "Resetting battery stats: level=" + level + " status=" + oldStatus
+ + " dischargeLevel=" + mDischargeCurrentLevel
+ " lowAmount=" + getLowDischargeAmountSinceCharge()
+ " highAmount=" + getHighDischargeAmountSinceCharge());
// Before we write, collect a snapshot of the final aggregated
@@ -6785,6 +6785,7 @@
reset = true;
mNumDischargeStepDurations = 0;
}
+ mOnBattery = mOnBatteryInternal = onBattery;
mLastDischargeStepLevel = level;
mMinDischargeStepLevel = level;
mLastDischargeStepTime = -1;
@@ -6812,6 +6813,7 @@
mDischargeAmountScreenOff = 0;
updateTimeBasesLocked(true, !screenOn, uptime, realtime);
} else {
+ mOnBattery = mOnBatteryInternal = onBattery;
pullPendingStateUpdatesLocked();
mHistoryCur.batteryLevel = (byte)level;
mHistoryCur.states |= HistoryItem.STATE_BATTERY_PLUGGED_FLAG;
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 16fa88e..2b7af4b 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -878,6 +878,30 @@
}
/**
+ * Gets whether the device is encrypted.
+ *
+ * @return Whether the device is encrypted.
+ */
+ public static boolean isDeviceEncrypted() {
+ IMountService mountService = IMountService.Stub.asInterface(
+ ServiceManager.getService("mount"));
+ try {
+ return mountService.getEncryptionState() != IMountService.ENCRYPTION_STATE_NONE
+ && mountService.getPasswordType() != StorageManager.CRYPT_TYPE_DEFAULT;
+ } catch (RemoteException re) {
+ Log.e(TAG, "Error getting encryption state", re);
+ }
+ return true;
+ }
+
+ /**
+ * Clears the encryption password.
+ */
+ public void clearEncryptionPassword() {
+ updateEncryptionPassword(StorageManager.CRYPT_TYPE_DEFAULT, null);
+ }
+
+ /**
* Retrieves the quality mode we're in.
* {@see DevicePolicyManager#getPasswordQuality(android.content.ComponentName)}
*
diff --git a/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp b/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp
index b90e493..8440a0e 100644
--- a/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp
+++ b/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp
@@ -193,12 +193,13 @@
if (err != NO_ERROR) return err;
sp<GraphicBuffer> buf(new GraphicBuffer(anb, /*keepOwnership*/false));
- uint32_t gBufWidth = buf->getWidth();
- uint32_t gBufHeight = buf->getHeight();
- if (gBufWidth != width || gBufHeight != height) {
+ uint32_t grallocBufWidth = buf->getWidth();
+ uint32_t grallocBufHeight = buf->getHeight();
+ uint32_t grallocBufStride = buf->getStride();
+ if (grallocBufWidth != width || grallocBufHeight != height) {
ALOGE("%s: Received gralloc buffer with bad dimensions %" PRIu32 "x%" PRIu32
- ", expecting dimensions %zu x %zu", __FUNCTION__, gBufWidth, gBufHeight,
- width, height);
+ ", expecting dimensions %zu x %zu", __FUNCTION__, grallocBufWidth,
+ grallocBufHeight, width, height);
return BAD_VALUE;
}
@@ -210,11 +211,12 @@
return err;
}
- uint64_t tmpSize = width * height;
+ uint64_t tmpSize = (pixelFmt == HAL_PIXEL_FORMAT_BLOB) ? grallocBufWidth :
+ 4 * grallocBufHeight * grallocBufWidth;
if (bufFmt != pixelFmt) {
if (bufFmt == HAL_PIXEL_FORMAT_RGBA_8888 && pixelFmt == HAL_PIXEL_FORMAT_BLOB) {
ALOGV("%s: Using BLOB to RGBA format override.", __FUNCTION__);
- tmpSize *= 4;
+ tmpSize = 4 * (grallocBufWidth + grallocBufStride * (grallocBufHeight - 1));
} else {
ALOGW("%s: Format mismatch in produceFrame: expecting format %#" PRIx32
", but received buffer with format %#" PRIx32, __FUNCTION__, pixelFmt, bufFmt);
@@ -311,17 +313,12 @@
int8_t* img = NULL;
struct camera3_jpeg_blob footer = {
jpeg_blob_id: CAMERA3_JPEG_BLOB_ID,
- jpeg_size: (uint32_t)width
+ jpeg_size: (uint32_t)bufferLength
};
size_t totalJpegSize = bufferLength + sizeof(footer);
totalJpegSize = (totalJpegSize + 3) & ~0x3; // round up to nearest octonibble
- if (height != 1) {
- ALOGE("%s: Invalid height set for JPEG buffer output, %zu", __FUNCTION__, height);
- return BAD_VALUE;
- }
-
if (totalJpegSize > totalSizeBytes) {
ALOGE("%s: Pixel buffer needs size %zu, cannot fit in gralloc buffer of size %zu",
__FUNCTION__, totalJpegSize, totalSizeBytes);
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index 2dbd382..e400698 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -264,8 +264,7 @@
ALOGV("onTransact() on %p calling object %p in env %p vm %p\n", this, mObject, env, mVM);
IPCThreadState* thread_state = IPCThreadState::self();
- const int strict_policy_before = thread_state->getStrictModePolicy();
- thread_state->setLastTransactionBinderFlags(flags);
+ const int32_t strict_policy_before = thread_state->getStrictModePolicy();
//printf("Transact from %p to Java code sending: ", this);
//data.print();
@@ -284,15 +283,11 @@
env->DeleteLocalRef(excep);
}
- // Restore the Java binder thread's state if it changed while
- // processing a call (as it would if the Parcel's header had a
- // new policy mask and Parcel.enforceInterface() changed
- // it...)
- const int strict_policy_after = thread_state->getStrictModePolicy();
- if (strict_policy_after != strict_policy_before) {
- // Our thread-local...
- thread_state->setStrictModePolicy(strict_policy_before);
- // And the Java-level thread-local...
+ // Check if the strict mode state changed while processing the
+ // call. The Binder state will be restored by the underlying
+ // Binder system in IPCThreadState, however we need to take care
+ // of the parallel Java state as well.
+ if (thread_state->getStrictModePolicy() != strict_policy_before) {
set_dalvik_blockguard_policy(env, strict_policy_before);
}
diff --git a/core/res/res/layout/preference_header_item_material.xml b/core/res/res/layout/preference_header_item_material.xml
index 594189f..88e1cb2 100644
--- a/core/res/res/layout/preference_header_item_material.xml
+++ b/core/res/res/layout/preference_header_item_material.xml
@@ -45,7 +45,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
- android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textAppearance="?android:attr/textAppearanceListItem"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
@@ -54,7 +54,7 @@
android:layout_height="wrap_content"
android:layout_below="@android:id/title"
android:layout_alignStart="@android:id/title"
- android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:ellipsize="end"
android:maxLines="2" />
diff --git a/core/res/res/layout/preference_list_content_material.xml b/core/res/res/layout/preference_list_content_material.xml
index 7856799..1bc527e 100644
--- a/core/res/res/layout/preference_list_content_material.xml
+++ b/core/res/res/layout/preference_list_content_material.xml
@@ -48,7 +48,8 @@
android:drawSelectorOnTop="false"
android:cacheColorHint="@color/transparent"
android:listPreferredItemHeight="48dp"
- android:scrollbarAlwaysDrawVerticalTrack="true" />
+ android:scrollbarAlwaysDrawVerticalTrack="true"
+ android:divider="@null" />
<FrameLayout android:id="@+id/list_footer"
android:layout_width="match_parent"
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 8ea1814..719adca 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -5365,11 +5365,11 @@
<attr name="drawable" />
</declare-styleable>
- <!-- Defines the target path or group used in the AnimatedVectorDrawable. -->
+ <!-- Defines the target used in the AnimatedVectorDrawable. -->
<declare-styleable name="AnimatedVectorDrawableTarget">
- <!-- The name of this target path or group -->
+ <!-- The name of the target path, group or vector drawable -->
<attr name="name" />
- <!-- The animation for this target path or group -->
+ <!-- The animation for the target path, group or vector drawable -->
<attr name="animation" />
</declare-styleable>
diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java
index 8014837..4c83e55 100644
--- a/graphics/java/android/graphics/drawable/VectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/VectorDrawable.java
@@ -57,6 +57,8 @@
* <dl>
* <dd>Used to defined a vector drawable
* <dl>
+ * <dt><code>android:name</code></dt>
+ * <dd>Defines the name of this vector drawable.</dd>
* <dt><code>android:width</code></dt>
* <dd>Used to defined the intrinsic width of the drawable.
* This support all the dimension units, normally specified with dp.</dd>
@@ -76,6 +78,8 @@
* <dt><code>android:autoMirrored</code></dt>
* <dd>Indicates if the drawable needs to be mirrored when its layout direction is
* RTL (right-to-left).</dd>
+ * <dt><code>android:alpha</code></dt>
+ * <dd>The opacity of this drawable.</dd>
* </dl></dd>
* </dl>
*
@@ -85,6 +89,8 @@
* The transformations are defined in the same coordinates as the viewport.
* And the transformations are applied in the order of scale, rotate then translate.
* <dl>
+ * <dt><code>android:name</code></dt>
+ * <dd>Defines the name of the group.</dd>
* <dt><code>android:rotation</code></dt>
* <dd>The degrees of rotation of the group.</dd>
* <dt><code>android:pivotX</code></dt>
diff --git a/media/jni/android_media_ImageReader.cpp b/media/jni/android_media_ImageReader.cpp
index f4eb459..aaff9a2 100644
--- a/media/jni/android_media_ImageReader.cpp
+++ b/media/jni/android_media_ImageReader.cpp
@@ -294,7 +294,7 @@
uint8_t* jpegBuffer = buffer->data;
if (usingRGBAOverride) {
- width *= 4;
+ width = (buffer->width + buffer->stride * (buffer->height - 1)) * 4;
}
// First check for JPEG transport header at the end of the buffer
diff --git a/packages/CaptivePortalLogin/AndroidManifest.xml b/packages/CaptivePortalLogin/AndroidManifest.xml
index c5fb167..2ec15be 100644
--- a/packages/CaptivePortalLogin/AndroidManifest.xml
+++ b/packages/CaptivePortalLogin/AndroidManifest.xml
@@ -20,6 +20,7 @@
package="com.android.captiveportallogin" >
<uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application android:label="@string/app_name" >
<activity
diff --git a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
index ae52a1e..b3a6e88 100644
--- a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
+++ b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
@@ -20,7 +20,10 @@
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
+import android.net.ConnectivityManager.NetworkCallback;
import android.net.Network;
+import android.net.NetworkCapabilities;
+import android.net.NetworkRequest;
import android.os.Bundle;
import android.provider.Settings;
import android.provider.Settings.Global;
@@ -55,6 +58,7 @@
private URL mURL;
private int mNetId;
+ private NetworkCallback mNetworkCallback;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -73,7 +77,27 @@
getActionBar().setDisplayShowHomeEnabled(false);
mNetId = Integer.parseInt(getIntent().getStringExtra(Intent.EXTRA_TEXT));
- ConnectivityManager.setProcessDefaultNetwork(new Network(mNetId));
+ final Network network = new Network(mNetId);
+ ConnectivityManager.setProcessDefaultNetwork(network);
+
+ // Exit app if Network disappears.
+ final NetworkCapabilities networkCapabilities =
+ ConnectivityManager.from(this).getNetworkCapabilities(network);
+ if (networkCapabilities == null) {
+ finish();
+ return;
+ }
+ mNetworkCallback = new NetworkCallback() {
+ @Override
+ public void onLost(Network lostNetwork) {
+ if (network.equals(lostNetwork)) done(false);
+ }
+ };
+ final NetworkRequest.Builder builder = new NetworkRequest.Builder();
+ for (int transportType : networkCapabilities.getTransportTypes()) {
+ builder.addTransportType(transportType);
+ }
+ ConnectivityManager.from(this).registerNetworkCallback(builder.build(), mNetworkCallback);
WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
@@ -84,6 +108,7 @@
}
private void done(boolean use_network) {
+ ConnectivityManager.from(this).unregisterNetworkCallback(mNetworkCallback);
Intent intent = new Intent(ACTION_CAPTIVE_PORTAL_LOGGED_IN);
intent.putExtra(Intent.EXTRA_TEXT, String.valueOf(mNetId));
intent.putExtra(LOGGED_IN_RESULT, use_network ? "1" : "0");
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java b/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java
index 34bbc2e..954046c 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java
@@ -95,10 +95,11 @@
log("dozing " + dozing);
}
- public static void traceFling(boolean expand, boolean aboveThreshold, boolean thresholdNeeded) {
+ public static void traceFling(boolean expand, boolean aboveThreshold, boolean thresholdNeeded,
+ boolean screenOnFromTouch) {
if (!ENABLED) return;
log("fling expand=" + expand + " aboveThreshold=" + aboveThreshold + " thresholdNeeded="
- + thresholdNeeded);
+ + thresholdNeeded + " screenOnFromTouch=" + screenOnFromTouch);
}
public static void traceEmergencyCall() {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
index 5caf1ac..8416ad7 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
@@ -112,15 +112,11 @@
mTaskStackBounds = new Rect();
}
- public void onStart() {}
-
- public void onBootCompleted() {
+ public void onStart() {
// Initialize some static datastructures
TaskStackViewLayoutAlgorithm.initializeCurve();
// Load the header bar layout
reloadHeaderBarLayout();
- mBootCompleted = true;
-
// Try and pre-emptively bind the search widget on startup to ensure that we
// have the right thumbnail bounds to animate to.
if (Constants.DebugFlags.App.EnableSearchLayout) {
@@ -138,6 +134,10 @@
}
}
+ public void onBootCompleted() {
+ mBootCompleted = true;
+ }
+
/** Shows the recents */
public void onShowRecents(boolean triggeredFromAltTab, View statusBarView) {
mStatusBarView = statusBarView;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index b9efb22..26420e1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -1551,7 +1551,8 @@
@Override
protected void onEdgeClicked(boolean right) {
if ((right && getRightIcon().getVisibility() != View.VISIBLE)
- || (!right && getLeftIcon().getVisibility() != View.VISIBLE)) {
+ || (!right && getLeftIcon().getVisibility() != View.VISIBLE)
+ || isDozing()) {
return;
}
mHintAnimationRunning = true;
@@ -1747,6 +1748,7 @@
updateKeyguardStatusBarVisibility();
}
+ @Override
public boolean isDozing() {
return mDozing;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index cacc2df7..c612e4c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -337,7 +337,8 @@
boolean expand = flingExpands(vel, vectorVel);
onTrackingStopped(expand);
DozeLog.traceFling(expand, mTouchAboveFalsingThreshold,
- mStatusBar.isFalsingThresholdNeeded());
+ mStatusBar.isFalsingThresholdNeeded(),
+ mStatusBar.isScreenOnComingFromTouch());
fling(vel, expand);
mUpdateFlingOnLayout = expand && mPanelClosedOnDown && !mHasLayoutedSinceDown;
if (mUpdateFlingOnLayout) {
@@ -914,7 +915,9 @@
private boolean onMiddleClicked() {
switch (mStatusBar.getBarState()) {
case StatusBarState.KEYGUARD:
- startUnlockHintAnimation();
+ if (!isDozing()) {
+ startUnlockHintAnimation();
+ }
return true;
case StatusBarState.SHADE_LOCKED:
mStatusBar.goToKeyguard();
@@ -932,6 +935,8 @@
protected abstract void onEdgeClicked(boolean right);
+ protected abstract boolean isDozing();
+
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println(String.format("[PanelView(%s): expandedHeight=%f maxPanelHeight=%d closing=%s"
+ " tracking=%s justPeeked=%s peekAnim=%s%s timeAnim=%s%s touchDisabled=%s"
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 79d769a..3625997 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -646,19 +646,10 @@
mLastSignalLevel = iconLevel = mSignalStrength.getLevel();
}
- if (isCdma()) {
- if (isCdmaEri()) {
- iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[mInetCondition];
- } else {
- iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[mInetCondition];
- }
+ if (isRoaming()) {
+ iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[mInetCondition];
} else {
- // Though mPhone is a Manager, this call is not an IPC
- if (mPhone.isNetworkRoaming()) {
- iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[mInetCondition];
- } else {
- iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[mInetCondition];
- }
+ iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[mInetCondition];
}
mPhoneSignalIconId = iconList[iconLevel];
mQSPhoneSignalIconId =
@@ -811,14 +802,9 @@
}
}
- if (isCdma()) {
- if (isCdmaEri()) {
- mDataTypeIconId = TelephonyIcons.ROAMING_ICON;
- mQSDataTypeIconId = TelephonyIcons.QS_DATA_R[mInetCondition];
- }
- } else if (mPhone.isNetworkRoaming()) {
- mDataTypeIconId = TelephonyIcons.ROAMING_ICON;
- mQSDataTypeIconId = TelephonyIcons.QS_DATA_R[mInetCondition];
+ if (isRoaming()) {
+ mDataTypeIconId = TelephonyIcons.ROAMING_ICON;
+ mQSDataTypeIconId = TelephonyIcons.QS_DATA_R[mInetCondition];
}
}
@@ -836,6 +822,14 @@
return false;
}
+ private boolean isRoaming() {
+ if (isCdma()) {
+ return isCdmaEri();
+ } else {
+ return mServiceState != null && mServiceState.getRoaming();
+ }
+ }
+
private final void updateDataIcon() {
int iconId;
boolean visible = true;
@@ -1233,12 +1227,7 @@
mDataTypeIconId = 0;
mQSDataTypeIconId = 0;
- if (isCdma()) {
- if (isCdmaEri()) {
- mDataTypeIconId = TelephonyIcons.ROAMING_ICON;
- mQSDataTypeIconId = TelephonyIcons.QS_DATA_R[mInetCondition];
- }
- } else if (mPhone.isNetworkRoaming()) {
+ if (isRoaming()) {
mDataTypeIconId = TelephonyIcons.ROAMING_ICON;
mQSDataTypeIconId = TelephonyIcons.QS_DATA_R[mInetCondition];
}
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 42ee666..5f3b877 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -2929,6 +2929,10 @@
}
}
+ // The action mode's theme may differ from the app, so
+ // always show the status guard above it if we have one.
+ showStatusGuard = mStatusGuard != null;
+
// We only need to consume the insets if the action
// mode is overlaid on the app content (e.g. it's
// sitting in a FrameLayout, see
@@ -2936,11 +2940,7 @@
final boolean nonOverlay = (getLocalFeatures()
& (1 << FEATURE_ACTION_MODE_OVERLAY)) == 0;
insets = insets.consumeSystemWindowInsets(
- false, nonOverlay /* top */, false, false);
-
- // The action mode's theme may differ from the app, so
- // always show the status guard above it.
- showStatusGuard = true;
+ false, nonOverlay && showStatusGuard /* top */, false, false);
} else {
// reset top margin
if (mlp.topMargin != 0) {
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 63db31d..cc17422 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -67,6 +67,7 @@
import android.util.Pools.SimplePool;
import android.util.Slog;
import android.util.SparseArray;
+import android.view.AccessibilityManagerInternal;
import android.view.Display;
import android.view.IWindow;
import android.view.InputDevice;
@@ -91,6 +92,7 @@
import com.android.internal.R;
import com.android.internal.content.PackageMonitor;
import com.android.internal.statusbar.IStatusBarService;
+import com.android.internal.widget.LockPatternUtils;
import com.android.server.LocalServices;
import org.xmlpull.v1.XmlPullParserException;
@@ -202,6 +204,8 @@
private final UserManager mUserManager;
+ private final LockPatternUtils mLockPatternUtils;
+
private int mCurrentUserId = UserHandle.USER_OWNER;
//TODO: Remove this hack
@@ -225,9 +229,11 @@
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
mSecurityPolicy = new SecurityPolicy();
mMainHandler = new MainHandler(mContext.getMainLooper());
+ mLockPatternUtils = new LockPatternUtils(context);
registerBroadcastReceivers();
new AccessibilityContentObserver(mMainHandler).register(
context.getContentResolver());
+ LocalServices.addService(AccessibilityManagerInternal.class, new LocalService());
}
private UserState getUserStateLocked(int userId) {
@@ -1294,6 +1300,7 @@
updateTouchExplorationLocked(userState);
updateEnhancedWebAccessibilityLocked(userState);
updateDisplayColorAdjustmentSettingsLocked(userState);
+ updateEncryptionState(userState);
scheduleUpdateInputFilter(userState);
scheduleUpdateClientsIfNeededLocked(userState);
}
@@ -1570,6 +1577,21 @@
DisplayAdjustmentUtils.applyAdjustments(mContext, userState.mUserId);
}
+ private void updateEncryptionState(UserState userState) {
+ if (userState.mUserId != UserHandle.USER_OWNER) {
+ return;
+ }
+ if (hasRunningServicesLocked(userState) && LockPatternUtils.isDeviceEncrypted()) {
+ // If there are running accessibility services we do not have encryption as
+ // the user needs the accessibility layer to be running to authenticate.
+ mLockPatternUtils.clearEncryptionPassword();
+ }
+ }
+
+ private boolean hasRunningServicesLocked(UserState userState) {
+ return !userState.mBoundServices.isEmpty() || !userState.mBindingServices.isEmpty();
+ }
+
private MagnificationSpec getCompatibleMagnificationSpecLocked(int windowId) {
IBinder windowToken = mGlobalWindowTokens.get(windowId);
if (windowToken == null) {
@@ -3891,4 +3913,14 @@
}
}
}
+
+ private final class LocalService extends AccessibilityManagerInternal {
+ @Override
+ public boolean isNonDefaultEncryptionPasswordAllowed() {
+ synchronized (mLock) {
+ UserState userState = getCurrentUserStateLocked();
+ return !hasRunningServicesLocked(userState);
+ }
+ }
+ }
}
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 0b1a627..85ab249 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -516,11 +516,13 @@
return;
}
- if (list.isEmpty() || isDefaultNetwork(nai)) {
+ list.add(nai);
+
+ // Send a broadcast if this is the first network of its type or if it's the default.
+ if (list.size() == 1 || isDefaultNetwork(nai)) {
maybeLogBroadcast(nai, true, type);
sendLegacyNetworkBroadcast(nai, true, type);
}
- list.add(nai);
}
/** Removes the given network from the specified legacy type list. */
diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java
index 7f24d07..b0535b3 100644
--- a/services/core/java/com/android/server/MountService.java
+++ b/services/core/java/com/android/server/MountService.java
@@ -63,6 +63,7 @@
import android.util.Slog;
import android.util.Xml;
+import android.view.AccessibilityManagerInternal;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.IMediaContainerService;
@@ -557,6 +558,8 @@
private final Handler mHandler;
+ private final AccessibilityManagerInternal mAccessibilityManagerInternal;
+
void waitForAsecScan() {
waitForLatch(mAsecsScanned);
}
@@ -1454,6 +1457,9 @@
hthread.start();
mHandler = new MountServiceHandler(hthread.getLooper());
+ mAccessibilityManagerInternal = LocalServices.getService(
+ AccessibilityManagerInternal.class);
+
// Watch for user changes
final IntentFilter userFilter = new IntentFilter();
userFilter.addAction(Intent.ACTION_USER_ADDED);
@@ -2254,8 +2260,15 @@
final NativeDaemonEvent event;
try {
+ // The accessibility layer may veto having a non-default encryption
+ // password because if there are enabled accessibility services the
+ // user cannot authenticate as the latter need access to the data.
+ if (!TextUtils.isEmpty(password)
+ && !mAccessibilityManagerInternal.isNonDefaultEncryptionPasswordAllowed()) {
+ return getEncryptionState();
+ }
event = mConnector.execute("cryptfs", "changepw", CRYPTO_TYPES[type],
- new SensitiveArg(toHex(password)));
+ new SensitiveArg(toHex(password)));
return Integer.parseInt(event.getMessage());
} catch (NativeDaemonConnectorException e) {
// Encryption failed
@@ -2302,7 +2315,7 @@
* @return The type, one of the CRYPT_TYPE_XXX consts from StorageManager.
*/
@Override
- public int getPasswordType() throws RemoteException {
+ public int getPasswordType() {
waitForReady();
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 12c98c1..c7eb546 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -9349,6 +9349,7 @@
checkTime(startTime, "getContentProviderImpl: after getProviderByClass");
final boolean firstClass = cpr == null;
if (firstClass) {
+ final long ident = Binder.clearCallingIdentity();
try {
checkTime(startTime, "getContentProviderImpl: before getApplicationInfo");
ApplicationInfo ai =
@@ -9366,6 +9367,8 @@
cpr = new ContentProviderRecord(this, cpi, ai, comp, singleton);
} catch (RemoteException ex) {
// pm is in same process, this will never happen.
+ } finally {
+ Binder.restoreCallingIdentity(ident);
}
}
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index 9292d45..adc96f7 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -311,7 +311,9 @@
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "Reconnection detected: clearing all backoffs");
}
- mSyncStorageEngine.clearAllBackoffs(mSyncQueue);
+ synchronized (mSyncQueue) {
+ mSyncStorageEngine.clearAllBackoffsLocked(mSyncQueue);
+ }
}
sendCheckAlarmsMessage();
}
diff --git a/services/core/java/com/android/server/content/SyncStorageEngine.java b/services/core/java/com/android/server/content/SyncStorageEngine.java
index 9499370..0d5f240 100644
--- a/services/core/java/com/android/server/content/SyncStorageEngine.java
+++ b/services/core/java/com/android/server/content/SyncStorageEngine.java
@@ -834,17 +834,16 @@
return changed;
}
- public void clearAllBackoffs(SyncQueue syncQueue) {
+ public void clearAllBackoffsLocked(SyncQueue syncQueue) {
boolean changed = false;
synchronized (mAuthorities) {
- synchronized (syncQueue) {
// Clear backoff for all sync adapters.
for (AccountInfo accountInfo : mAccounts.values()) {
for (AuthorityInfo authorityInfo : accountInfo.authorities.values()) {
if (authorityInfo.backoffTime != NOT_IN_BACKOFF_MODE
|| authorityInfo.backoffDelay != NOT_IN_BACKOFF_MODE) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.v(TAG, "clearAllBackoffs:"
+ Log.v(TAG, "clearAllBackoffsLocked:"
+ " authority:" + authorityInfo.target
+ " account:" + accountInfo.accountAndUser.account.name
+ " user:" + accountInfo.accountAndUser.userId
@@ -868,7 +867,6 @@
authorityInfo.backoffDelay = NOT_IN_BACKOFF_MODE;
}
}
- }
syncQueue.clearBackoffs();
}
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 999649b..41574ca 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -2712,9 +2712,10 @@
if (atoken != null) {
if (atoken.startingWindow == win) {
- if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Nulling startingWindow " + win);
- atoken.startingWindow = null;
- } else if (atoken.allAppWindows.size() == 0 && atoken.startingData != null) {
+ if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Notify removed startingWindow " + win);
+ scheduleRemoveStartingWindowLocked(atoken);
+ } else
+ if (atoken.allAppWindows.size() == 0 && atoken.startingData != null) {
// If this is the last window and we had requested a starting
// transition window, well there is no point now.
if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Nulling last startingWindow");
@@ -2722,7 +2723,7 @@
} else if (atoken.allAppWindows.size() == 1 && atoken.startingView != null) {
// If this is the last window except for a starting transition
// window, we need to get rid of the starting transition.
- scheduleRemoveStartingWindow(atoken);
+ scheduleRemoveStartingWindowLocked(atoken);
}
}
@@ -4329,7 +4330,7 @@
synchronized (mWindowMap) {
AppWindowToken wtoken = mTokenMap.get(token).appWindowToken;
if (wtoken.startingWindow != null) {
- scheduleRemoveStartingWindow(wtoken);
+ scheduleRemoveStartingWindowLocked(wtoken);
}
}
}
@@ -4791,14 +4792,19 @@
if (!delayed && wtoken != null) {
wtoken.updateReportedVisibilityLocked();
}
+
+ // Will only remove if startingToken non null.
+ scheduleRemoveStartingWindowLocked(startingToken);
}
Binder.restoreCallingIdentity(origId);
- // Will only remove if startingToken non null.
- scheduleRemoveStartingWindow(startingToken);
}
- void scheduleRemoveStartingWindow(AppWindowToken wtoken) {
+ void scheduleRemoveStartingWindowLocked(AppWindowToken wtoken) {
+ if (mH.hasMessages(H.REMOVE_STARTING, wtoken)) {
+ // Already scheduled.
+ return;
+ }
if (wtoken != null && wtoken.startingWindow != null) {
if (DEBUG_STARTING_WINDOW) Slog.v(TAG, Debug.getCallers(1) +
": Schedule remove starting " + wtoken + (wtoken != null ?
@@ -9093,6 +9099,11 @@
// gotten drawn.
wtoken.allDrawn = true;
wtoken.deferClearAllDrawn = false;
+ // Ensure that apps that are mid-starting are also scheduled to have their
+ // starting windows removed after the animation is complete
+ if (wtoken.startingWindow != null && !wtoken.startingWindow.mExiting) {
+ scheduleRemoveStartingWindowLocked(wtoken);
+ }
if (animLp != null) {
int layer = -1;
@@ -10236,7 +10247,7 @@
winAnimator.mSurfaceShown = false;
winAnimator.mSurfaceControl = null;
winAnimator.mWin.mHasSurface = false;
- scheduleRemoveStartingWindow(winAnimator.mWin.mAppToken);
+ scheduleRemoveStartingWindowLocked(winAnimator.mWin.mAppToken);
}
try {
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 5b007d4..0c727f3 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -515,6 +515,7 @@
static class SurfaceTrace extends SurfaceControl {
private final static String SURFACE_TAG = "SurfaceTrace";
+ private final static boolean logSurfaceTrace = DEBUG_SURFACE_TRACE;
final static ArrayList<SurfaceTrace> sSurfaces = new ArrayList<SurfaceTrace>();
private float mSurfaceTraceAlpha = 0;
@@ -534,7 +535,7 @@
super(s, name, w, h, format, flags);
mName = name != null ? name : "Not named";
mSize.set(w, h);
- Slog.v(SURFACE_TAG, "ctor: " + this + ". Called by "
+ if (logSurfaceTrace) Slog.v(SURFACE_TAG, "ctor: " + this + ". Called by "
+ Debug.getCallers(3));
synchronized (sSurfaces) {
sSurfaces.add(0, this);
@@ -544,8 +545,8 @@
@Override
public void setAlpha(float alpha) {
if (mSurfaceTraceAlpha != alpha) {
- Slog.v(SURFACE_TAG, "setAlpha(" + alpha + "): OLD:" + this + ". Called by "
- + Debug.getCallers(3));
+ if (logSurfaceTrace) Slog.v(SURFACE_TAG, "setAlpha(" + alpha + "): OLD:" + this +
+ ". Called by " + Debug.getCallers(3));
mSurfaceTraceAlpha = alpha;
}
super.setAlpha(alpha);
@@ -554,8 +555,8 @@
@Override
public void setLayer(int zorder) {
if (zorder != mLayer) {
- Slog.v(SURFACE_TAG, "setLayer(" + zorder + "): OLD:" + this + ". Called by "
- + Debug.getCallers(3));
+ if (logSurfaceTrace) Slog.v(SURFACE_TAG, "setLayer(" + zorder + "): OLD:" + this
+ + ". Called by " + Debug.getCallers(3));
mLayer = zorder;
}
super.setLayer(zorder);
@@ -576,8 +577,8 @@
@Override
public void setPosition(float x, float y) {
if (x != mPosition.x || y != mPosition.y) {
- Slog.v(SURFACE_TAG, "setPosition(" + x + "," + y + "): OLD:" + this
- + ". Called by " + Debug.getCallers(3));
+ if (logSurfaceTrace) Slog.v(SURFACE_TAG, "setPosition(" + x + "," + y + "): OLD:"
+ + this + ". Called by " + Debug.getCallers(3));
mPosition.set(x, y);
}
super.setPosition(x, y);
@@ -586,8 +587,8 @@
@Override
public void setSize(int w, int h) {
if (w != mSize.x || h != mSize.y) {
- Slog.v(SURFACE_TAG, "setSize(" + w + "," + h + "): OLD:" + this + ". Called by "
- + Debug.getCallers(3));
+ if (logSurfaceTrace) Slog.v(SURFACE_TAG, "setSize(" + w + "," + h + "): OLD:"
+ + this + ". Called by " + Debug.getCallers(3));
mSize.set(w, h);
}
super.setSize(w, h);
@@ -597,8 +598,9 @@
public void setWindowCrop(Rect crop) {
if (crop != null) {
if (!crop.equals(mWindowCrop)) {
- Slog.v(SURFACE_TAG, "setWindowCrop(" + crop.toShortString() + "): OLD:" + this
- + ". Called by " + Debug.getCallers(3));
+ if (logSurfaceTrace) Slog.v(SURFACE_TAG, "setWindowCrop("
+ + crop.toShortString() + "): OLD:" + this + ". Called by "
+ + Debug.getCallers(3));
mWindowCrop.set(crop);
}
}
@@ -608,8 +610,8 @@
@Override
public void setLayerStack(int layerStack) {
if (layerStack != mLayerStack) {
- Slog.v(SURFACE_TAG, "setLayerStack(" + layerStack + "): OLD:" + this
- + ". Called by " + Debug.getCallers(3));
+ if (logSurfaceTrace) Slog.v(SURFACE_TAG, "setLayerStack(" + layerStack + "): OLD:"
+ + this + ". Called by " + Debug.getCallers(3));
mLayerStack = layerStack;
}
super.setLayerStack(layerStack);
@@ -618,8 +620,8 @@
@Override
public void setOpaque(boolean isOpaque) {
if (isOpaque != mIsOpaque) {
- Slog.v(SURFACE_TAG, "setOpaque(" + isOpaque + "): OLD:" + this
- + ". Called by " + Debug.getCallers(3));
+ if (logSurfaceTrace) Slog.v(SURFACE_TAG, "setOpaque(" + isOpaque + "): OLD:"
+ + this + ". Called by " + Debug.getCallers(3));
mIsOpaque = isOpaque;
}
super.setOpaque(isOpaque);
@@ -628,8 +630,9 @@
@Override
public void setMatrix(float dsdx, float dtdx, float dsdy, float dtdy) {
if (dsdx != mDsdx || dtdx != mDtdx || dsdy != mDsdy || dtdy != mDtdy) {
- Slog.v(SURFACE_TAG, "setMatrix(" + dsdx + "," + dtdx + "," + dsdy + "," + dtdy +
- "): OLD:" + this + ". Called by " + Debug.getCallers(3));
+ if (logSurfaceTrace) Slog.v(SURFACE_TAG, "setMatrix(" + dsdx + "," + dtdx + ","
+ + dsdy + "," + dtdy + "): OLD:" + this + ". Called by "
+ + Debug.getCallers(3));
mDsdx = dsdx;
mDtdx = dtdx;
mDsdy = dsdy;
@@ -641,7 +644,8 @@
@Override
public void hide() {
if (mShown) {
- Slog.v(SURFACE_TAG, "hide: OLD:" + this + ". Called by " + Debug.getCallers(3));
+ if (logSurfaceTrace) Slog.v(SURFACE_TAG, "hide: OLD:" + this + ". Called by "
+ + Debug.getCallers(3));
mShown = false;
}
super.hide();
@@ -650,7 +654,8 @@
@Override
public void show() {
if (!mShown) {
- Slog.v(SURFACE_TAG, "show: OLD:" + this + ". Called by " + Debug.getCallers(3));
+ if (logSurfaceTrace) Slog.v(SURFACE_TAG, "show: OLD:" + this + ". Called by "
+ + Debug.getCallers(3));
mShown = true;
}
super.show();
@@ -659,7 +664,8 @@
@Override
public void destroy() {
super.destroy();
- Slog.v(SURFACE_TAG, "destroy: " + this + ". Called by " + Debug.getCallers(3));
+ if (logSurfaceTrace) Slog.v(SURFACE_TAG, "destroy: " + this + ". Called by "
+ + Debug.getCallers(3));
synchronized (sSurfaces) {
sSurfaces.remove(this);
}
@@ -668,7 +674,7 @@
@Override
public void release() {
super.release();
- Slog.v(SURFACE_TAG, "release: " + this + ". Called by "
+ if (logSurfaceTrace) Slog.v(SURFACE_TAG, "release: " + this + ". Called by "
+ Debug.getCallers(3));
synchronized (sSurfaces) {
sSurfaces.remove(this);