Merge "Fix NPE in WallpaperDrawable" into nyc-dev
diff --git a/cmds/dpm/src/com/android/commands/dpm/Dpm.java b/cmds/dpm/src/com/android/commands/dpm/Dpm.java
index b83484d..31c7421 100644
--- a/cmds/dpm/src/com/android/commands/dpm/Dpm.java
+++ b/cmds/dpm/src/com/android/commands/dpm/Dpm.java
@@ -44,6 +44,7 @@
private static final String COMMAND_SET_ACTIVE_ADMIN = "set-active-admin";
private static final String COMMAND_SET_DEVICE_OWNER = "set-device-owner";
private static final String COMMAND_SET_PROFILE_OWNER = "set-profile-owner";
+ private static final String COMMAND_REMOVE_ACTIVE_ADMIN = "remove-active-admin";
private IDevicePolicyManager mDevicePolicyManager;
private int mUserId = UserHandle.USER_SYSTEM;
@@ -60,6 +61,8 @@
"[ --name <NAME> ] <COMPONENT>\n" +
"usage: dpm set-profile-owner [ --user <USER_ID> | current ] [ --name <NAME> ] " +
"<COMPONENT>\n" +
+ "usage: dpm remove-active-admin [ --user <USER_ID> | current ] [ --name <NAME> ] " +
+ "<COMPONENT>\n" +
"\n" +
"dpm set-active-admin: Sets the given component as active admin" +
" for an existing user.\n" +
@@ -68,7 +71,11 @@
" package as device owner.\n" +
"\n" +
"dpm set-profile-owner: Sets the given component as active admin and profile" +
- " owner for an existing user.\n");
+ " owner for an existing user.\n" +
+ "\n" +
+ "dpm remove-active-admin: Disables an active admin, the admin must have declared" +
+ " android:testOnly in the application in its manifest. This will also remove" +
+ " device and profile owners\n");
}
@Override
@@ -91,6 +98,9 @@
case COMMAND_SET_PROFILE_OWNER:
runSetProfileOwner();
break;
+ case COMMAND_REMOVE_ACTIVE_ADMIN:
+ runRemoveActiveAdmin();
+ break;
default:
throw new IllegalArgumentException ("unknown command '" + command + "'");
}
@@ -152,6 +162,12 @@
System.out.println("Active admin set to component " + mComponent.toShortString());
}
+ private void runRemoveActiveAdmin() throws RemoteException {
+ parseArgs(/*canHaveName=*/ false);
+ mDevicePolicyManager.forceRemoveActiveAdmin(mComponent, mUserId);
+ System.out.println("Success: Admin removed " + mComponent);
+ }
+
private void runSetProfileOwner() throws RemoteException {
parseArgs(/*canHaveName=*/ true);
mDevicePolicyManager.setActiveAdmin(mComponent, true /*refreshing*/, mUserId);
diff --git a/core/java/android/animation/AnimatorSet.java b/core/java/android/animation/AnimatorSet.java
index e788d27..8ff38bb 100644
--- a/core/java/android/animation/AnimatorSet.java
+++ b/core/java/android/animation/AnimatorSet.java
@@ -559,7 +559,8 @@
boolean previouslyPaused = mPaused;
super.pause();
if (!previouslyPaused && mPaused) {
- if (mDelayAnim != null) {
+ if (mDelayAnim.isStarted()) {
+ // If delay hasn't passed, pause the start delay animator.
mDelayAnim.pause();
} else {
int size = mNodes.size();
@@ -578,7 +579,8 @@
boolean previouslyPaused = mPaused;
super.resume();
if (previouslyPaused && !mPaused) {
- if (mDelayAnim != null) {
+ if (mDelayAnim.isStarted()) {
+ // If start delay hasn't passed, resume the previously paused start delay animator
mDelayAnim.resume();
} else {
int size = mNodes.size();
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 7a18df6..0ca2e14 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -6391,6 +6391,24 @@
}
}
+ /**
+ * @hide
+ * Remove a test admin synchronously without sending it a broadcast about being removed.
+ * If the admin is a profile owner or device owner it will still be removed.
+ *
+ * @param userHandle user id to remove the admin for.
+ * @param admin The administration compononent to remove.
+ * @throws SecurityException if the caller is not shell / root or the admin package
+ * isn't a test application see {@link ApplicationInfo#FLAG_TEST_APP}.
+ */
+ public void forceRemoveActiveAdmin(ComponentName adminReceiver, int userHandle) {
+ try {
+ mService.forceRemoveActiveAdmin(adminReceiver, userHandle);
+ } catch (RemoteException re) {
+ throw re.rethrowFromSystemServer();
+ }
+ }
+
private void throwIfParentInstance(String functionName) {
if (mParentInstance) {
throw new SecurityException(functionName + " cannot be called on the parent instance");
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index cba64c2..989e613 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -111,6 +111,7 @@
boolean packageHasActiveAdmins(String packageName, int userHandle);
void getRemoveWarning(in ComponentName policyReceiver, in RemoteCallback result, int userHandle);
void removeActiveAdmin(in ComponentName policyReceiver, int userHandle);
+ void forceRemoveActiveAdmin(in ComponentName policyReceiver, int userHandle);
boolean hasGrantedPolicy(in ComponentName policyReceiver, int usesPolicy, int userHandle);
void setActivePasswordState(int quality, int length, int letters, int uppercase, int lowercase,
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index ef50fdc..7da849a 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -102,13 +102,13 @@
public @interface ScalingMode {}
// From system/window.h
/** @hide */
- static final int SCALING_MODE_FREEZE = 0;
+ public static final int SCALING_MODE_FREEZE = 0;
/** @hide */
- static final int SCALING_MODE_SCALE_TO_WINDOW = 1;
+ public static final int SCALING_MODE_SCALE_TO_WINDOW = 1;
/** @hide */
- static final int SCALING_MODE_SCALE_CROP = 2;
+ public static final int SCALING_MODE_SCALE_CROP = 2;
/** @hide */
- static final int SCALING_MODE_NO_SCALE_CROP = 3;
+ public static final int SCALING_MODE_NO_SCALE_CROP = 3;
/** @hide */
@IntDef({ROTATION_0, ROTATION_90, ROTATION_180, ROTATION_270})
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index c30ede3..dc9014b 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -85,6 +85,8 @@
IBinder displayToken, int mode);
private static native void nativeDeferTransactionUntil(long nativeObject,
IBinder handle, long frame);
+ private static native void nativeSetOverrideScalingMode(long nativeObject,
+ int scalingMode);
private static native IBinder nativeGetHandle(long nativeObject);
@@ -376,6 +378,11 @@
nativeDeferTransactionUntil(mNativeObject, handle, frame);
}
+ public void setOverrideScalingMode(int scalingMode) {
+ checkNotReleased();
+ nativeSetOverrideScalingMode(mNativeObject, scalingMode);
+ }
+
public IBinder getHandle() {
return nativeGetHandle(mNativeObject);
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index e9ca623..9e4f26f 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -2716,11 +2716,11 @@
mAttachInfo.mHardwareRenderer.setStopped(false);
}
- mAttachInfo.mHardwareRenderer.draw(mView, mAttachInfo, this);
-
if (updated) {
requestDrawWindow();
}
+
+ mAttachInfo.mHardwareRenderer.draw(mView, mAttachInfo, this);
} else {
// If we get here with a disabled & requested hardware renderer, something went
// wrong (an invalidate posted right before we destroyed the hardware surface
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 10afdb8..250d9b7 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -60,6 +60,7 @@
import android.util.Xml;
import android.view.Display;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.net.NetworkStatsFactory;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.FastPrintWriter;
@@ -1092,7 +1093,7 @@
public void writeToParcel(Parcel out, long elapsedRealtimeUs) {
if (DEBUG) Log.i(TAG, "**** WRITING TIMER #" + mType + ": mTotalTime="
+ computeRunTimeLocked(mTimeBase.getRealtime(elapsedRealtimeUs)));
- out.writeInt(mCount);
+ out.writeInt(computeCurrentCountLocked());
out.writeInt(mLoadedCount);
out.writeInt(mUnpluggedCount);
out.writeLong(computeRunTimeLocked(mTimeBase.getRealtime(elapsedRealtimeUs)));
@@ -1109,7 +1110,7 @@
+ " old mUnpluggedCount=" + mUnpluggedCount);
}
mUnpluggedTime = computeRunTimeLocked(baseRealtime);
- mUnpluggedCount = mCount;
+ mUnpluggedCount = computeCurrentCountLocked();
if (DEBUG && mType < 0) {
Log.v(TAG, "unplug #" + mType
+ ": new mUnpluggedTime=" + mUnpluggedTime
@@ -1192,7 +1193,7 @@
public void writeSummaryFromParcelLocked(Parcel out, long elapsedRealtimeUs) {
long runTime = computeRunTimeLocked(mTimeBase.getRealtime(elapsedRealtimeUs));
out.writeLong(runTime);
- out.writeInt(mCount);
+ out.writeInt(computeCurrentCountLocked());
}
public void readSummaryFromParcelLocked(Parcel in) {
@@ -1249,7 +1250,8 @@
*/
int mUpdateVersion;
- SamplingTimer(Clocks clocks, TimeBase timeBase, Parcel in) {
+ @VisibleForTesting
+ public SamplingTimer(Clocks clocks, TimeBase timeBase, Parcel in) {
super(clocks, 0, timeBase, in);
mCurrentReportedCount = in.readInt();
mUnpluggedReportedCount = in.readInt();
@@ -1259,7 +1261,8 @@
mTimeBaseRunning = timeBase.isRunning();
}
- SamplingTimer(Clocks clocks, TimeBase timeBase, boolean trackReportedValues) {
+ @VisibleForTesting
+ public SamplingTimer(Clocks clocks, TimeBase timeBase, boolean trackReportedValues) {
super(clocks, 0, timeBase);
mTrackingReportedValues = trackReportedValues;
mTimeBaseRunning = timeBase.isRunning();
diff --git a/core/java/com/android/internal/policy/BackdropFrameRenderer.java b/core/java/com/android/internal/policy/BackdropFrameRenderer.java
index b1598e7..b781fd4 100644
--- a/core/java/com/android/internal/policy/BackdropFrameRenderer.java
+++ b/core/java/com/android/internal/policy/BackdropFrameRenderer.java
@@ -16,8 +16,6 @@
package com.android.internal.policy;
-import static android.view.WindowCallbacks.RESIZE_MODE_FREEFORM;
-
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
@@ -102,9 +100,6 @@
mOldSystemInsets.set(systemInsets);
mOldStableInsets.set(stableInsets);
mResizeMode = resizeMode;
- synchronized (this) {
- redrawLocked(initialBounds, fullscreen, mSystemInsets, mStableInsets);
- }
// Kick off our draw thread.
start();
@@ -160,7 +155,7 @@
mSystemInsets.set(systemInsets);
mStableInsets.set(stableInsets);
// Notify of a bounds change.
- pingRenderLocked();
+ pingRenderLocked(false /* drawImmediate */);
}
}
@@ -172,7 +167,7 @@
if (mRenderer != null) {
// Enforce a window redraw.
mOldTargetRect.set(0, 0, 0, 0);
- pingRenderLocked();
+ pingRenderLocked(false /* drawImmediate */);
}
}
}
@@ -197,7 +192,7 @@
mRenderer = null;
// Exit the renderer loop.
- pingRenderLocked();
+ pingRenderLocked(false /* drawImmediate */);
}
}
}
@@ -208,9 +203,6 @@
Looper.prepare();
synchronized (this) {
mChoreographer = Choreographer.getInstance();
-
- // Draw at least once.
- mChoreographer.postFrameCallback(this);
}
Looper.loop();
} finally {
@@ -236,18 +228,22 @@
Looper.myLooper().quit();
return;
}
- mNewTargetRect.set(mTargetRect);
- if (!mNewTargetRect.equals(mOldTargetRect)
- || mOldFullscreen != mFullscreen
- || !mStableInsets.equals(mOldStableInsets)
- || !mSystemInsets.equals(mOldSystemInsets)
- || mReportNextDraw) {
- mOldFullscreen = mFullscreen;
- mOldTargetRect.set(mNewTargetRect);
- mOldSystemInsets.set(mSystemInsets);
- mOldStableInsets.set(mStableInsets);
- redrawLocked(mNewTargetRect, mFullscreen, mSystemInsets, mStableInsets);
- }
+ doFrameUncheckedLocked();
+ }
+ }
+
+ private void doFrameUncheckedLocked() {
+ mNewTargetRect.set(mTargetRect);
+ if (!mNewTargetRect.equals(mOldTargetRect)
+ || mOldFullscreen != mFullscreen
+ || !mStableInsets.equals(mOldStableInsets)
+ || !mSystemInsets.equals(mOldSystemInsets)
+ || mReportNextDraw) {
+ mOldFullscreen = mFullscreen;
+ mOldTargetRect.set(mNewTargetRect);
+ mOldSystemInsets.set(mSystemInsets);
+ mOldStableInsets.set(mStableInsets);
+ redrawLocked(mNewTargetRect, mFullscreen, mSystemInsets, mStableInsets);
}
}
@@ -288,7 +284,7 @@
synchronized (this) {
mReportNextDraw = reportNextDraw;
mOldTargetRect.set(0, 0, 0, 0);
- pingRenderLocked();
+ pingRenderLocked(true /* drawImmediate */);
}
}
@@ -403,10 +399,14 @@
* Sends a message to the renderer to wake up and perform the next action which can be
* either the next rendering or the self destruction if mRenderer is null.
* Note: This call must be synchronized.
+ *
+ * @param drawImmediate if we should draw immediately instead of scheduling a frame
*/
- private void pingRenderLocked() {
- if (mChoreographer != null) {
+ private void pingRenderLocked(boolean drawImmediate) {
+ if (mChoreographer != null && !drawImmediate) {
mChoreographer.postFrameCallback(this);
+ } else {
+ doFrameUncheckedLocked();
}
}
diff --git a/core/java/com/android/internal/policy/DividerSnapAlgorithm.java b/core/java/com/android/internal/policy/DividerSnapAlgorithm.java
index 669e1ef..b8bc161 100644
--- a/core/java/com/android/internal/policy/DividerSnapAlgorithm.java
+++ b/core/java/com/android/internal/policy/DividerSnapAlgorithm.java
@@ -330,6 +330,14 @@
return snapTarget;
}
+ public boolean isFirstSplitTargetAvailable() {
+ return mFirstSplitTarget != mMiddleTarget;
+ }
+
+ public boolean isLastSplitTargetAvailable() {
+ return mLastSplitTarget != mMiddleTarget;
+ }
+
/**
* Cycles through all non-dismiss targets with a stepping of {@param increment}. It moves left
* if {@param increment} is negative and moves right otherwise.
diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
index 994bdeb..3d05422 100644
--- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl
+++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
@@ -41,7 +41,6 @@
void setImeWindowStatus(in IBinder token, int vis, int backDisposition,
boolean showImeSwitcher);
void expandSettingsPanel(String subPanel);
- void setCurrentUser(int newUserId);
// ---- Methods below are for use by the status bar policy services ----
// You need the STATUS_BAR_SERVICE permission
@@ -63,48 +62,6 @@
in NotificationVisibility[] noLongerVisibleKeys);
void onNotificationExpansionChanged(in String key, in boolean userAction, in boolean expanded);
void setSystemUiVisibility(int vis, int mask, String cause);
- void setWindowState(int window, int state);
-
- void showRecentApps(boolean triggeredFromAltTab, boolean fromHome);
- void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey);
- void toggleRecentApps();
- void preloadRecentApps();
- void cancelPreloadRecentApps();
-
- void toggleKeyboardShortcutsMenu(int deviceId);
-
- /**
- * Notifies the status bar that an app transition is pending to delay applying some flags with
- * visual impact until {@link #appTransitionReady} is called.
- */
- void appTransitionPending();
-
- /**
- * Notifies the status bar that a pending app transition has been cancelled.
- */
- void appTransitionCancelled();
-
- /**
- * Notifies the status bar that an app transition is now being executed.
- *
- * @param statusBarAnimationsStartTime the desired start time for all visual animations in the
- * status bar caused by this app transition in uptime millis
- * @param statusBarAnimationsDuration the duration for all visual animations in the status
- * bar caused by this app transition in millis
- */
- void appTransitionStarting(long statusBarAnimationsStartTime, long statusBarAnimationsDuration);
-
- void startAssist(in Bundle args);
-
- /**
- * Request picture-in-picture.
- *
- * <p>
- * This is called when an user presses picture-in-picture key or equivalent.
- * TV device may start picture-in-picture from foreground activity if there's none.
- * Picture-in-picture overlay menu will be shown instead otherwise.
- */
- void requestTvPictureInPicture();
void addTile(in ComponentName tile);
void remTile(in ComponentName tile);
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index d8233a0..0590134 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -597,6 +597,13 @@
ctrl->deferTransactionUntil(handle, frameNumber);
}
+static void nativeSetOverrideScalingMode(JNIEnv* env, jclass clazz, jlong nativeObject,
+ jint scalingMode) {
+ auto ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
+
+ ctrl->setOverrideScalingMode(scalingMode);
+}
+
static jobject nativeGetHandle(JNIEnv* env, jclass clazz, jlong nativeObject) {
auto ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
@@ -676,6 +683,8 @@
(void*)nativeSetDisplayPowerMode },
{"nativeDeferTransactionUntil", "(JLandroid/os/IBinder;J)V",
(void*)nativeDeferTransactionUntil },
+ {"nativeSetOverrideScalingMode", "(JI)V",
+ (void*)nativeSetOverrideScalingMode },
{"nativeGetHandle", "(J)Landroid/os/IBinder;",
(void*)nativeGetHandle }
};
diff --git a/core/tests/coretests/src/com/android/internal/os/BatteryStatsSamplingTimerTest.java b/core/tests/coretests/src/com/android/internal/os/BatteryStatsSamplingTimerTest.java
new file mode 100644
index 0000000..51d41a4
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/os/BatteryStatsSamplingTimerTest.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2016 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 com.android.internal.os;
+
+import android.os.BatteryStats;
+import android.os.Parcel;
+import android.support.test.filters.SmallTest;
+
+import junit.framework.TestCase;
+
+public class BatteryStatsSamplingTimerTest extends TestCase {
+
+ @SmallTest
+ public void testSampleTimerSummaryParceling() throws Exception {
+ final MockClocks clocks = new MockClocks();
+ clocks.realtime = 0;
+ clocks.uptime = 0;
+
+ final BatteryStatsImpl.TimeBase timeBase = new BatteryStatsImpl.TimeBase();
+ timeBase.init(clocks.uptimeMillis(), clocks.elapsedRealtime());
+
+ BatteryStatsImpl.SamplingTimer timer = new BatteryStatsImpl.SamplingTimer(clocks, timeBase,
+ true);
+
+ // Start running on battery.
+ timeBase.setRunning(true, clocks.uptimeMillis(), clocks.elapsedRealtime());
+
+ // The first update on battery consumes the values as a way of starting cleanly.
+ timer.addCurrentReportedTotalTime(10);
+ timer.addCurrentReportedCount(1);
+
+ timer.addCurrentReportedTotalTime(10);
+ timer.addCurrentReportedCount(1);
+
+ clocks.realtime = 20;
+ clocks.uptime = 20;
+
+ assertEquals(10, timer.getTotalTimeLocked(clocks.elapsedRealtime(),
+ BatteryStats.STATS_SINCE_CHARGED));
+ assertEquals(1, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED));
+
+ // Grab a summary parcel while on battery.
+ final Parcel onBatterySummaryParcel = Parcel.obtain();
+ timer.writeSummaryFromParcelLocked(onBatterySummaryParcel, clocks.elapsedRealtime() * 1000);
+ onBatterySummaryParcel.setDataPosition(0);
+
+ // Stop running on battery.
+ timeBase.setRunning(false, clocks.uptimeMillis(), clocks.elapsedRealtime());
+
+ assertEquals(10, timer.getTotalTimeLocked(clocks.elapsedRealtime(),
+ BatteryStats.STATS_SINCE_CHARGED));
+ assertEquals(1, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED));
+
+ // Grab a summary parcel while not on battery.
+ final Parcel offBatterySummaryParcel = Parcel.obtain();
+ timer.writeSummaryFromParcelLocked(offBatterySummaryParcel,
+ clocks.elapsedRealtime() * 1000);
+ offBatterySummaryParcel.setDataPosition(0);
+
+ // Read the on battery summary from the parcel.
+ BatteryStatsImpl.SamplingTimer unparceledTimer = new BatteryStatsImpl.SamplingTimer(
+ clocks, timeBase, true);
+ unparceledTimer.readSummaryFromParcelLocked(onBatterySummaryParcel);
+
+ assertEquals(10, unparceledTimer.getTotalTimeLocked(0, BatteryStats.STATS_SINCE_CHARGED));
+ assertEquals(1, unparceledTimer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED));
+
+ // Read the off battery summary from the parcel.
+ unparceledTimer = new BatteryStatsImpl.SamplingTimer(clocks, timeBase, true);
+ unparceledTimer.readSummaryFromParcelLocked(offBatterySummaryParcel);
+
+ assertEquals(10, unparceledTimer.getTotalTimeLocked(0, BatteryStats.STATS_SINCE_CHARGED));
+ assertEquals(1, unparceledTimer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED));
+ }
+}
diff --git a/core/tests/coretests/src/com/android/internal/os/BatteryStatsServTest.java b/core/tests/coretests/src/com/android/internal/os/BatteryStatsServTest.java
index 1c3cd38..5fd8225 100644
--- a/core/tests/coretests/src/com/android/internal/os/BatteryStatsServTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/BatteryStatsServTest.java
@@ -16,20 +16,13 @@
package com.android.internal.os;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-
import android.os.BatteryStats;
import android.os.Parcel;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.util.Log;
+import android.support.test.filters.SmallTest;
import junit.framework.Assert;
import junit.framework.TestCase;
-import com.android.internal.os.BatteryStatsImpl;
-
/**
* Provides test cases for android.os.BatteryStats.
*/
diff --git a/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java b/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java
index 05aa53c..78bcbbc 100644
--- a/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java
+++ b/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java
@@ -5,6 +5,7 @@
@RunWith(Suite.class)
@Suite.SuiteClasses({
+ BatteryStatsSamplingTimerTest.class,
BatteryStatsServTest.class,
BatteryStatsTimeBaseTest.class,
BatteryStatsTimerTest.class,
diff --git a/core/tests/coretests/src/com/android/internal/os/BatteryStatsTimeBaseTest.java b/core/tests/coretests/src/com/android/internal/os/BatteryStatsTimeBaseTest.java
index ab92f15..3190d9e 100644
--- a/core/tests/coretests/src/com/android/internal/os/BatteryStatsTimeBaseTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/BatteryStatsTimeBaseTest.java
@@ -18,11 +18,10 @@
import java.io.PrintWriter;
import java.io.StringWriter;
-import java.util.ArrayList;
import android.os.BatteryStats;
import android.os.Parcel;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.support.test.filters.SmallTest;
import android.util.Log;
import junit.framework.Assert;
diff --git a/core/tests/coretests/src/com/android/internal/os/BatteryStatsTimerTest.java b/core/tests/coretests/src/com/android/internal/os/BatteryStatsTimerTest.java
index 3e17fcb..98d0f7f 100644
--- a/core/tests/coretests/src/com/android/internal/os/BatteryStatsTimerTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/BatteryStatsTimerTest.java
@@ -18,8 +18,7 @@
import android.os.BatteryStats;
import android.os.Parcel;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.util.Log;
+import android.support.test.filters.SmallTest;
import android.util.StringBuilderPrinter;
import junit.framework.Assert;
@@ -148,7 +147,7 @@
timer.onTimeStarted(10, 20, 50);
Assert.assertEquals(50, timer.lastComputeRunTimeRealtime);
Assert.assertEquals(4, timer.getUnpluggedTime());
- Assert.assertEquals(0, timer.getUnpluggedCount());
+ Assert.assertEquals(3000, timer.getUnpluggedCount());
// Test that stopping the timer updates mTotalTime and mCount
timer.nextComputeRunTime = 17;
@@ -168,15 +167,16 @@
// Test write then read
TestTimer timer1 = new TestTimer(clocks, 0, timeBase);
timer1.setCount(1);
- timer1.setLoadedCount(2);
- timer1.setLastCount(3);
- timer1.setUnpluggedCount(4);
+ timer1.setLoadedCount(3);
+ timer1.setLastCount(4);
+ timer1.setUnpluggedCount(5);
timer1.setTotalTime(9223372036854775807L);
timer1.setLoadedTime(9223372036854775806L);
timer1.setLastTime(9223372036854775805L);
timer1.setUnpluggedTime(9223372036854775804L);
timer1.setTimeBeforeMark(9223372036854775803L);
timer1.nextComputeRunTime = 201;
+ timer1.nextComputeCurrentCount = 2;
Parcel parcel = Parcel.obtain();
Timer.writeTimerToParcel(parcel, timer1, 77);
@@ -185,10 +185,10 @@
Assert.assertTrue("parcel null object", parcel.readInt() != 0);
TestTimer timer2 = new TestTimer(clocks, 0, timeBase, parcel);
- Assert.assertEquals(1, timer2.getCount());
- Assert.assertEquals(2, timer2.getLoadedCount());
+ Assert.assertEquals(2, timer2.getCount()); // from computeTotalCountLocked()
+ Assert.assertEquals(3, timer2.getLoadedCount());
Assert.assertEquals(0, timer2.getLastCount()); // NOT saved
- Assert.assertEquals(4, timer2.getUnpluggedCount());
+ Assert.assertEquals(5, timer2.getUnpluggedCount());
Assert.assertEquals(201, timer2.getTotalTime()); // from computeRunTimeLocked()
Assert.assertEquals(9223372036854775806L, timer2.getLoadedTime());
Assert.assertEquals(0, timer2.getLastTime()); // NOT saved
@@ -309,6 +309,7 @@
Parcel parcel = Parcel.obtain();
timer1.nextComputeRunTime = 9223372036854775800L;
+ timer1.nextComputeCurrentCount = 1;
timer1.writeSummaryFromParcelLocked(parcel, 201);
Assert.assertEquals(40, timer1.lastComputeRunTimeRealtime);
diff --git a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
index 35385eb..6762bea 100644
--- a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
@@ -310,6 +310,15 @@
@Override
public boolean setVisible(boolean visible, boolean restart) {
+ if (mAnimatorSet.isInfinite() && mAnimatorSet.isStarted()) {
+ if (visible) {
+ // Resume the infinite animation when the drawable becomes visible again.
+ mAnimatorSet.resume();
+ } else {
+ // Pause the infinite animation once the drawable is no longer visible.
+ mAnimatorSet.pause();
+ }
+ }
mAnimatedVectorState.mVectorDrawable.setVisible(visible, restart);
return super.setVisible(visible, restart);
}
@@ -815,6 +824,9 @@
void onDraw(Canvas canvas);
boolean isStarted();
boolean isRunning();
+ boolean isInfinite();
+ void pause();
+ void resume();
}
private static class VectorDrawableAnimatorUI implements VectorDrawableAnimator {
@@ -825,6 +837,7 @@
// Caching the listener in the case when listener operation is called before the mSet is
// setup by init().
private ArrayList<AnimatorListener> mListenerArray = null;
+ private boolean mIsInfinite = false;
VectorDrawableAnimatorUI(@NonNull AnimatedVectorDrawable drawable) {
mDrawable = drawable;
@@ -840,6 +853,7 @@
// Keep a deep copy of the set, such that set can be still be constantly representing
// the static content from XML file.
mSet = set.clone();
+ mIsInfinite = mSet.getTotalDuration() == Animator.DURATION_INFINITE;
// If there are listeners added before calling init(), now they should be setup.
if (mListenerArray != null && !mListenerArray.isEmpty()) {
@@ -934,6 +948,27 @@
return mSet != null && mSet.isRunning();
}
+ @Override
+ public boolean isInfinite() {
+ return mIsInfinite;
+ }
+
+ @Override
+ public void pause() {
+ if (mSet == null) {
+ return;
+ }
+ mSet.pause();
+ }
+
+ @Override
+ public void resume() {
+ if (mSet == null) {
+ return;
+ }
+ mSet.resume();
+ }
+
private void invalidateOwningView() {
mDrawable.invalidateSelf();
}
@@ -956,6 +991,7 @@
private boolean mStarted = false;
private boolean mInitialized = false;
private boolean mIsReversible = false;
+ private boolean mIsInfinite = false;
// This needs to be set before parsing starts.
private boolean mShouldIgnoreInvalidAnim;
// TODO: Consider using NativeAllocationRegistery to track native allocation
@@ -983,6 +1019,7 @@
mShouldIgnoreInvalidAnim = shouldIgnoreInvalidAnimation();
parseAnimatorSet(set, 0);
mInitialized = true;
+ mIsInfinite = set.getTotalDuration() == Animator.DURATION_INFINITE;
// Check reversible.
mIsReversible = true;
@@ -1408,6 +1445,21 @@
}
}
+ @Override
+ public boolean isInfinite() {
+ return mIsInfinite;
+ }
+
+ @Override
+ public void pause() {
+ // TODO: Implement pause for Animator On RT.
+ }
+
+ @Override
+ public void resume() {
+ // TODO: Implement resume for Animator On RT.
+ }
+
private void onAnimationEnd(int listenerId) {
if (listenerId != mLastListenerId) {
return;
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index b557dc4..4e9b59f 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -111,6 +111,8 @@
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.MANAGE_ACTIVITY_STACKS" />
<uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" />
+ <!-- Permission needed to rename bugreport notifications (so they're not shown as Shell) -->
+ <uses-permission android:name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME" />
<application android:label="@string/app_label"
android:defaultToDeviceProtectedStorage="true"
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index 346ae20..ec39998 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -62,6 +62,7 @@
import android.content.res.Configuration;
import android.net.Uri;
import android.os.AsyncTask;
+import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
@@ -204,6 +205,8 @@
*/
private boolean mTakingScreenshot;
+ private static final Bundle sNotificationBundle = new Bundle();
+
@Override
public void onCreate() {
mContext = getApplicationContext();
@@ -979,7 +982,13 @@
}
private static Notification.Builder newBaseNotification(Context context) {
+ if (sNotificationBundle.isEmpty()) {
+ // Rename notifcations from "Shell" to "Android System"
+ sNotificationBundle.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME,
+ context.getString(com.android.internal.R.string.android_system_label));
+ }
return new Notification.Builder(context)
+ .addExtras(sNotificationBundle)
.setCategory(Notification.CATEGORY_SYSTEM)
.setSmallIcon(com.android.internal.R.drawable.stat_sys_adb)
.setLocalOnly(true)
diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml
index 9697ea6..94d79f2 100644
--- a/packages/SystemUI/res/values/ids.xml
+++ b/packages/SystemUI/res/values/ids.xml
@@ -63,9 +63,10 @@
<item type="id" name="is_clicked_heads_up_tag" />
<!-- Accessibility actions for the docked stack divider -->
- <item type="id" name="action_move_left" />
- <item type="id" name="action_move_right" />
- <item type="id" name="action_move_up" />
- <item type="id" name="action_move_down" />
+ <item type="id" name="action_move_tl_full" />
+ <item type="id" name="action_move_tl_70" />
+ <item type="id" name="action_move_tl_50" />
+ <item type="id" name="action_move_tl_30" />
+ <item type="id" name="action_move_rb_full" />
</resources>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index a03aa28..8e3ea4c 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1580,17 +1580,27 @@
<!-- Accessibility label for the divider that separates the windows in split-screen mode [CHAR LIMIT=NONE] -->
<string name="accessibility_divider">Split-screen divider</string>
- <!-- Accessibility action for moving down the docked stack divider [CHAR LIMIT=NONE] -->
- <string name="accessibility_action_divider_move_down">Move down</string>
+ <!-- Accessibility action for moving docked stack divider to make the left screen full screen [CHAR LIMIT=NONE] -->
+ <string name="accessibility_action_divider_left_full">Left full screen</string>
+ <!-- Accessibility action for moving docked stack divider to make the left screen 70% [CHAR LIMIT=NONE] -->
+ <string name="accessibility_action_divider_left_70">Left 70%</string>
+ <!-- Accessibility action for moving docked stack divider to make the left screen 50% [CHAR LIMIT=NONE] -->
+ <string name="accessibility_action_divider_left_50">Left 50%</string>
+ <!-- Accessibility action for moving docked stack divider to make the left screen 30% [CHAR LIMIT=NONE] -->
+ <string name="accessibility_action_divider_left_30">Left 30%</string>
+ <!-- Accessibility action for moving docked stack divider to make the right screen full screen [CHAR LIMIT=NONE] -->
+ <string name="accessibility_action_divider_right_full">Right full screen</string>
- <!-- Accessibility action for moving down the docked stack divider [CHAR LIMIT=NONE] -->
- <string name="accessibility_action_divider_move_up">Move up</string>
-
- <!-- Accessibility action for moving down the docked stack divider [CHAR LIMIT=NONE] -->
- <string name="accessibility_action_divider_move_left">Move left</string>
-
- <!-- Accessibility action for moving down the docked stack divider [CHAR LIMIT=NONE] -->
- <string name="accessibility_action_divider_move_right">Move right</string>
+ <!-- Accessibility action for moving docked stack divider to make the top screen full screen [CHAR LIMIT=NONE] -->
+ <string name="accessibility_action_divider_top_full">Top full screen</string>
+ <!-- Accessibility action for moving docked stack divider to make the top screen 70% [CHAR LIMIT=NONE] -->
+ <string name="accessibility_action_divider_top_70">Top 70%</string>
+ <!-- Accessibility action for moving docked stack divider to make the top screen 50% [CHAR LIMIT=NONE] -->
+ <string name="accessibility_action_divider_top_50">Top 50%</string>
+ <!-- Accessibility action for moving docked stack divider to make the top screen 30% [CHAR LIMIT=NONE] -->
+ <string name="accessibility_action_divider_top_30">Top 30%</string>
+ <!-- Accessibility action for moving docked stack divider to make the bottom screen full screen [CHAR LIMIT=NONE] -->
+ <string name="accessibility_action_divider_bottom_full">Bottom full screen</string>
<!-- Accessibility description of a QS tile while editing positions [CHAR LIMIT=NONE] -->
<string name="accessibility_qs_edit_tile_label">Position <xliff:g id="position" example="2">%1$d</xliff:g>, <xliff:g id="tile_name" example="Wi-Fi">%2$s</xliff:g>. Double tap to edit.</string>
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
index d12ab29..cecbfcb 100644
--- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
@@ -317,8 +317,8 @@
mResizedView = null;
mWatchingForPull = false;
}
- mInitialTouchY = ev.getY();
- mInitialTouchX = ev.getX();
+ mInitialTouchY = ev.getRawY();
+ mInitialTouchX = ev.getRawX();
break;
case MotionEvent.ACTION_CANCEL:
@@ -412,8 +412,8 @@
mWatchingForPull = mScrollAdapter != null &&
isInside(mScrollAdapter.getHostView(), x, y);
mResizedView = findView(x, y);
- mInitialTouchX = ev.getX();
- mInitialTouchY = ev.getY();
+ mInitialTouchX = ev.getRawX();
+ mInitialTouchY = ev.getRawY();
break;
case MotionEvent.ACTION_MOVE: {
if (mWatchingForPull) {
diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
index 1306284..c72f5d2 100644
--- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
@@ -29,6 +29,7 @@
import android.graphics.RectF;
import android.graphics.Region.Op;
import android.opengl.GLUtils;
+import android.os.AsyncTask;
import android.os.SystemProperties;
import android.renderscript.Matrix4f;
import android.service.wallpaper.WallpaperService;
@@ -155,6 +156,8 @@
private int mLastRequestedWidth = -1;
private int mLastRequestedHeight = -1;
+ private AsyncTask<Void, Void, Bitmap> mLoader;
+ private boolean mNeedsDrawAfterLoadingWallpaper;
public DrawableEngine() {
super();
@@ -184,10 +187,9 @@
super.onCreate(surfaceHolder);
mDefaultDisplay = getSystemService(WindowManager.class).getDefaultDisplay();
-
- updateSurfaceSize(surfaceHolder, getDefaultDisplayInfo());
-
setOffsetNotificationsEnabled(false);
+
+ updateSurfaceSize(surfaceHolder, getDefaultDisplayInfo(), false /* forDraw */);
}
@Override
@@ -197,17 +199,19 @@
mWallpaperManager.forgetLoadedWallpaper();
}
- void updateSurfaceSize(SurfaceHolder surfaceHolder, DisplayInfo displayInfo) {
+ boolean updateSurfaceSize(SurfaceHolder surfaceHolder, DisplayInfo displayInfo,
+ boolean forDraw) {
+ boolean hasWallpaper = true;
+
// Load background image dimensions, if we haven't saved them yet
if (mBackgroundWidth <= 0 || mBackgroundHeight <= 0) {
// Need to load the image to get dimensions
mWallpaperManager.forgetLoadedWallpaper();
- updateWallpaperLocked();
- if (mBackgroundWidth <= 0 || mBackgroundHeight <= 0) {
- // Default to the display size if we can't find the dimensions
- mBackgroundWidth = displayInfo.logicalWidth;
- mBackgroundHeight = displayInfo.logicalHeight;
+ loadWallpaper(forDraw);
+ if (DEBUG) {
+ Log.d(TAG, "Reloading, redoing updateSurfaceSize later.");
}
+ hasWallpaper = false;
}
// Force the wallpaper to cover the screen in both dimensions
@@ -224,6 +228,7 @@
} else {
surfaceHolder.setSizeFromLayout();
}
+ return hasWallpaper;
}
@Override
@@ -299,6 +304,7 @@
}
super.onSurfaceRedrawNeeded(holder);
+ mLastSurfaceHeight = mLastSurfaceWidth = -1;
drawFrame();
}
@@ -317,7 +323,9 @@
// should change
if (newRotation != mLastRotation) {
// Update surface size (if necessary)
- updateSurfaceSize(getSurfaceHolder(), displayInfo);
+ if (!updateSurfaceSize(getSurfaceHolder(), displayInfo, true /* forDraw */)) {
+ return; // had to reload wallpaper, will retry later
+ }
mRotationAtLastSurfaceSizeUpdate = newRotation;
mDisplayWidthAtLastSurfaceSizeUpdate = displayInfo.logicalWidth;
mDisplayHeightAtLastSurfaceSizeUpdate = displayInfo.logicalHeight;
@@ -339,8 +347,8 @@
}
mLastRotation = newRotation;
- // Load bitmap if it is not yet loaded or if it was loaded at a different size
- if (mBackground == null || surfaceDimensionsChanged) {
+ // Load bitmap if it is not yet loaded
+ if (mBackground == null) {
if (DEBUG) {
Log.d(TAG, "Reloading bitmap: mBackground, bgw, bgh, dw, dh = " +
mBackground + ", " +
@@ -349,20 +357,11 @@
dw + ", " + dh);
}
mWallpaperManager.forgetLoadedWallpaper();
- updateWallpaperLocked();
- if (mBackground == null) {
- if (DEBUG) {
- Log.d(TAG, "Unable to load bitmap");
- }
- return;
- }
+ loadWallpaper(true /* needDraw */);
if (DEBUG) {
- if (dw != mBackground.getWidth() || dh != mBackground.getHeight()) {
- Log.d(TAG, "Surface != bitmap dimensions: surface w/h, bitmap w/h: " +
- dw + ", " + dh + ", " + mBackground.getWidth() + ", " +
- mBackground.getHeight());
- }
+ Log.d(TAG, "Reloading, resuming draw later");
}
+ return;
}
// Center the scaled image
@@ -422,36 +421,77 @@
}
}
- private void updateWallpaperLocked() {
- Throwable exception = null;
- try {
- mBackground = null;
- mBackgroundWidth = -1;
- mBackgroundHeight = -1;
- mBackground = mWallpaperManager.getBitmap();
- mBackgroundWidth = mBackground.getWidth();
- mBackgroundHeight = mBackground.getHeight();
- } catch (RuntimeException e) {
- exception = e;
- } catch (OutOfMemoryError e) {
- exception = e;
- }
-
- if (exception != null) {
- mBackground = null;
- mBackgroundWidth = -1;
- mBackgroundHeight = -1;
- // Note that if we do fail at this, and the default wallpaper can't
- // be loaded, we will go into a cycle. Don't do a build where the
- // default wallpaper can't be loaded.
- Log.w(TAG, "Unable to load wallpaper!", exception);
- try {
- mWallpaperManager.clear();
- } catch (IOException ex) {
- // now we're really screwed.
- Log.w(TAG, "Unable reset to default wallpaper!", ex);
+ /**
+ * Loads the wallpaper on background thread and schedules updating the surface frame,
+ * and if {@param needsDraw} is set also draws a frame.
+ *
+ * If loading is already in-flight, subsequent loads are ignored (but needDraw is or-ed to
+ * the active request).
+ */
+ private void loadWallpaper(boolean needsDraw) {
+ mNeedsDrawAfterLoadingWallpaper |= needsDraw;
+ if (mLoader != null) {
+ if (DEBUG) {
+ Log.d(TAG, "Skipping loadWallpaper, already in flight ");
}
+ return;
}
+ mLoader = new AsyncTask<Void, Void, Bitmap>() {
+ @Override
+ protected Bitmap doInBackground(Void... params) {
+ Throwable exception;
+ try {
+ return mWallpaperManager.getBitmap();
+ } catch (RuntimeException | OutOfMemoryError e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ // Note that if we do fail at this, and the default wallpaper can't
+ // be loaded, we will go into a cycle. Don't do a build where the
+ // default wallpaper can't be loaded.
+ Log.w(TAG, "Unable to load wallpaper!", exception);
+ try {
+ mWallpaperManager.clear();
+ } catch (IOException ex) {
+ // now we're really screwed.
+ Log.w(TAG, "Unable reset to default wallpaper!", ex);
+ }
+
+ try {
+ return mWallpaperManager.getBitmap();
+ } catch (RuntimeException | OutOfMemoryError e) {
+ Log.w(TAG, "Unable to load default wallpaper!", e);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(Bitmap b) {
+ mBackground = null;
+ mBackgroundWidth = -1;
+ mBackgroundHeight = -1;
+
+ if (b != null) {
+ mBackground = b;
+ mBackgroundWidth = mBackground.getWidth();
+ mBackgroundHeight = mBackground.getHeight();
+ }
+
+ if (DEBUG) {
+ Log.d(TAG, "Wallpaper loaded: " + mBackground);
+ }
+ updateSurfaceSize(getSurfaceHolder(), getDefaultDisplayInfo(),
+ false /* forDraw */);
+ if (mNeedsDrawAfterLoadingWallpaper) {
+ drawFrame();
+ }
+
+ mLoader = null;
+ mNeedsDrawAfterLoadingWallpaper = false;
+ }
+ }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUISecondaryUserService.java b/packages/SystemUI/src/com/android/systemui/SystemUISecondaryUserService.java
index f619bfb..c8a2e17 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUISecondaryUserService.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUISecondaryUserService.java
@@ -16,11 +16,9 @@
package com.android.systemui;
-import android.app.ActivityManager;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
-import android.os.Process;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -43,15 +41,19 @@
SystemUI[] services = ((SystemUIApplication) getApplication()).getServices();
if (args == null || args.length == 0) {
for (SystemUI ui: services) {
- pw.println("dumping service: " + ui.getClass().getName());
- ui.dump(fd, pw, args);
+ if (ui != null) {
+ pw.println("dumping service: " + ui.getClass().getName());
+ ui.dump(fd, pw, args);
+ }
}
} else {
String svc = args[0];
for (SystemUI ui: services) {
- String name = ui.getClass().getName();
- if (name.endsWith(svc)) {
- ui.dump(fd, pw, args);
+ if (ui != null) {
+ String name = ui.getClass().getName();
+ if (name.endsWith(svc)) {
+ ui.dump(fd, pw, args);
+ }
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java
index 0798590..1ac5992 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java
@@ -27,6 +27,7 @@
import android.os.UserHandle;
import android.provider.Settings;
import android.view.MotionEvent;
+import android.view.accessibility.AccessibilityManager;
import com.android.systemui.analytics.DataCollector;
import com.android.systemui.statusbar.StatusBarState;
@@ -60,6 +61,7 @@
private final SensorManager mSensorManager;
private final DataCollector mDataCollector;
private final HumanInteractionClassifier mHumanInteractionClassifier;
+ private final AccessibilityManager mAccessibilityManager;
private static FalsingManager sInstance = null;
@@ -78,7 +80,8 @@
private FalsingManager(Context context) {
mContext = context;
- mSensorManager = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE);
+ mSensorManager = mContext.getSystemService(SensorManager.class);
+ mAccessibilityManager = context.getSystemService(AccessibilityManager.class);
mDataCollector = DataCollector.getInstance(mContext);
mHumanInteractionClassifier = HumanInteractionClassifier.getInstance(mContext);
mScreenOn = context.getSystemService(PowerManager.class).isInteractive();
@@ -177,6 +180,11 @@
.toString());
}
}
+ if (mAccessibilityManager.isTouchExplorationEnabled()) {
+ // Touch exploration triggers false positives in the classifier and
+ // already sufficiently prevents false unlocks.
+ return false;
+ }
return mHumanInteractionClassifier.isFalseTouch();
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index 6176d99..33d3dc0 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -1765,6 +1765,7 @@
mTmpTransform, null);
mTmpTransform.scale = finalScale;
mTmpTransform.translationZ = mLayoutAlgorithm.mMaxTranslationZ + 1;
+ mTmpTransform.dimAlpha = 0f;
updateTaskViewToTransform(event.taskView, mTmpTransform,
new AnimationProps(DRAG_SCALE_DURATION, Interpolators.FAST_OUT_SLOW_IN));
}
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
index 67c4008..277c60b 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
@@ -154,31 +154,62 @@
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(host, info);
if (isHorizontalDivision()) {
- info.addAction(new AccessibilityAction(R.id.action_move_up,
- mContext.getString(R.string.accessibility_action_divider_move_up)));
- info.addAction(new AccessibilityAction(R.id.action_move_down,
- mContext.getString(R.string.accessibility_action_divider_move_down)));
+ info.addAction(new AccessibilityAction(R.id.action_move_tl_full,
+ mContext.getString(R.string.accessibility_action_divider_top_full)));
+ if (mSnapAlgorithm.isFirstSplitTargetAvailable()) {
+ info.addAction(new AccessibilityAction(R.id.action_move_tl_70,
+ mContext.getString(R.string.accessibility_action_divider_top_70)));
+ }
+ info.addAction(new AccessibilityAction(R.id.action_move_tl_50,
+ mContext.getString(R.string.accessibility_action_divider_top_50)));
+ if (mSnapAlgorithm.isLastSplitTargetAvailable()) {
+ info.addAction(new AccessibilityAction(R.id.action_move_tl_30,
+ mContext.getString(R.string.accessibility_action_divider_top_30)));
+ }
+ info.addAction(new AccessibilityAction(R.id.action_move_rb_full,
+ mContext.getString(R.string.accessibility_action_divider_bottom_full)));
} else {
- info.addAction(new AccessibilityAction(R.id.action_move_left,
- mContext.getString(R.string.accessibility_action_divider_move_left)));
- info.addAction(new AccessibilityAction(R.id.action_move_right,
- mContext.getString(R.string.accessibility_action_divider_move_right)));
+ info.addAction(new AccessibilityAction(R.id.action_move_tl_full,
+ mContext.getString(R.string.accessibility_action_divider_left_full)));
+ if (mSnapAlgorithm.isFirstSplitTargetAvailable()) {
+ info.addAction(new AccessibilityAction(R.id.action_move_tl_70,
+ mContext.getString(R.string.accessibility_action_divider_left_70)));
+ }
+ info.addAction(new AccessibilityAction(R.id.action_move_tl_50,
+ mContext.getString(R.string.accessibility_action_divider_left_50)));
+ if (mSnapAlgorithm.isLastSplitTargetAvailable()) {
+ info.addAction(new AccessibilityAction(R.id.action_move_tl_30,
+ mContext.getString(R.string.accessibility_action_divider_left_30)));
+ }
+ info.addAction(new AccessibilityAction(R.id.action_move_rb_full,
+ mContext.getString(R.string.accessibility_action_divider_right_full)));
}
}
@Override
public boolean performAccessibilityAction(View host, int action, Bundle args) {
- if (action == R.id.action_move_up || action == R.id.action_move_down
- || action == R.id.action_move_left || action == R.id.action_move_right) {
- int position = getCurrentPosition();
- SnapTarget currentTarget = mSnapAlgorithm.calculateSnapTarget(
- position, 0 /* velocity */);
- SnapTarget nextTarget =
- action == R.id.action_move_up || action == R.id.action_move_left
- ? mSnapAlgorithm.getPreviousTarget(currentTarget)
- : mSnapAlgorithm.getNextTarget(currentTarget);
+ int currentPosition = getCurrentPosition();
+ SnapTarget nextTarget = null;
+ switch (action) {
+ case R.id.action_move_tl_full:
+ nextTarget = mSnapAlgorithm.getDismissEndTarget();
+ break;
+ case R.id.action_move_tl_70:
+ nextTarget = mSnapAlgorithm.getLastSplitTarget();
+ break;
+ case R.id.action_move_tl_50:
+ nextTarget = mSnapAlgorithm.getMiddleTarget();
+ break;
+ case R.id.action_move_tl_30:
+ nextTarget = mSnapAlgorithm.getFirstSplitTarget();
+ break;
+ case R.id.action_move_rb_full:
+ nextTarget = mSnapAlgorithm.getDismissStartTarget();
+ break;
+ }
+ if (nextTarget != null) {
startDragging(true /* animate */, false /* touching */);
- stopDragging(getCurrentPosition(), nextTarget, 250, Interpolators.FAST_OUT_SLOW_IN);
+ stopDragging(currentPosition, nextTarget, 250, Interpolators.FAST_OUT_SLOW_IN);
return true;
}
return super.performAccessibilityAction(host, action, args);
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/ForcedResizableInfoActivity.java b/packages/SystemUI/src/com/android/systemui/stackdivider/ForcedResizableInfoActivity.java
index 177296b..18834ed 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/ForcedResizableInfoActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/ForcedResizableInfoActivity.java
@@ -18,6 +18,7 @@
import android.annotation.Nullable;
import android.app.Activity;
+import android.app.ActivityManager;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -75,4 +76,9 @@
finish();
return true;
}
+
+ @Override
+ public void setTaskDescription(ActivityManager.TaskDescription taskDescription) {
+ // Do nothing
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/FakeShadowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/FakeShadowView.java
index 32c26ba..0c1891e1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/FakeShadowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/FakeShadowView.java
@@ -25,6 +25,7 @@
import android.view.ViewOutlineProvider;
import android.widget.LinearLayout;
+import com.android.systemui.R;
import com.android.systemui.statusbar.AlphaOptimizedFrameLayout;
/**
@@ -32,6 +33,7 @@
*/
public class FakeShadowView extends AlphaOptimizedFrameLayout {
public static final float SHADOW_SIBLING_TRESHOLD = 0.1f;
+ private final int mShadowMinHeight;
private View mFakeShadow;
private float mOutlineAlpha;
@@ -64,6 +66,8 @@
}
});
addView(mFakeShadow);
+ mShadowMinHeight = Math.max(1, context.getResources()
+ .getDimensionPixelSize(R.dimen.notification_divider_height));
}
public void setFakeShadowTranslationZ(float fakeShadowTranslationZ, float outlineAlpha,
@@ -72,6 +76,7 @@
mFakeShadow.setVisibility(INVISIBLE);
} else {
mFakeShadow.setVisibility(VISIBLE);
+ fakeShadowTranslationZ = Math.max(mShadowMinHeight, fakeShadowTranslationZ);
mFakeShadow.setTranslationZ(fakeShadowTranslationZ);
mFakeShadow.setTranslationX(outlineTranslation);
mFakeShadow.setTranslationY(shadowYEnd - mFakeShadow.getHeight());
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java
index 15cf552..ef19d95 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java
@@ -29,7 +29,7 @@
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.DrawableWrapper;
-import android.os.Bundle;
+import android.os.AsyncTask;
import android.os.Handler;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
@@ -48,9 +48,7 @@
private static final String TAG = "LockscreenWallpaper";
- private final Context mContext;
private final PhoneStatusBar mBar;
- private final IWallpaperManager mService;
private final WallpaperManager mWallpaperManager;
private final Handler mH;
@@ -60,69 +58,75 @@
// The user selected in the UI, or null if no user is selected or UI doesn't support selecting
// users.
private UserHandle mSelectedUser;
+ private AsyncTask<Void, Void, LoaderResult> mLoader;
public LockscreenWallpaper(Context ctx, PhoneStatusBar bar, Handler h) {
- mContext = ctx;
mBar = bar;
mH = h;
- mService = IWallpaperManager.Stub.asInterface(
- ServiceManager.getService(Context.WALLPAPER_SERVICE));
mWallpaperManager = (WallpaperManager) ctx.getSystemService(Context.WALLPAPER_SERVICE);
mCurrentUserId = ActivityManager.getCurrentUser();
+ IWallpaperManager service = IWallpaperManager.Stub.asInterface(
+ ServiceManager.getService(Context.WALLPAPER_SERVICE));
try {
- mService.setLockWallpaperCallback(this);
+ service.setLockWallpaperCallback(this);
} catch (RemoteException e) {
Log.e(TAG, "System dead?" + e);
}
}
public Bitmap getBitmap() {
- try {
- if (mCached) {
- return mCache;
- }
- if (!mService.isWallpaperSupported(mContext.getOpPackageName())) {
- mCached = true;
- mCache = null;
- return null;
- }
- // Prefer the selected user (when specified) over the current user for the FLAG_SET_LOCK
- // wallpaper.
- final int lockWallpaperUserId =
- mSelectedUser != null ? mSelectedUser.getIdentifier() : mCurrentUserId;
- ParcelFileDescriptor fd = mService.getWallpaper(null, WallpaperManager.FLAG_LOCK,
- new Bundle(), lockWallpaperUserId);
- if (fd != null) {
- try {
- BitmapFactory.Options options = new BitmapFactory.Options();
- mCache = BitmapFactory.decodeFileDescriptor(
- fd.getFileDescriptor(), null, options);
- mCached = true;
- return mCache;
- } catch (OutOfMemoryError e) {
- Log.w(TAG, "Can't decode file", e);
- return null;
- } finally {
- IoUtils.closeQuietly(fd);
- }
- } else {
- mCached = true;
- if (mSelectedUser != null && mSelectedUser.getIdentifier() != mCurrentUserId) {
- // When selected user is different from the current user, show the selected
- // user's static wallpaper.
- mCache = mWallpaperManager.getBitmapAsUser(mSelectedUser.getIdentifier());
- } else {
- // When there is no selected user, or it's same as the current user, show the
- // system (possibly dynamic) wallpaper for the selected user.
- mCache = null;
- }
- return mCache;
- }
- } catch (RemoteException e) {
- Log.e(TAG, "System dead?" + e);
+ if (mCached) {
+ return mCache;
+ }
+ if (!mWallpaperManager.isWallpaperSupported()) {
+ mCached = true;
+ mCache = null;
return null;
}
+
+ LoaderResult result = loadBitmap(mCurrentUserId, mSelectedUser);
+ if (result.success) {
+ mCached = true;
+ mCache = result.bitmap;
+ }
+ return mCache;
+ }
+
+ public LoaderResult loadBitmap(int currentUserId, UserHandle selectedUser) {
+ // May be called on any thread - only use thread safe operations.
+
+ // Prefer the selected user (when specified) over the current user for the FLAG_SET_LOCK
+ // wallpaper.
+ final int lockWallpaperUserId =
+ selectedUser != null ? selectedUser.getIdentifier() : currentUserId;
+ ParcelFileDescriptor fd = mWallpaperManager.getWallpaperFile(
+ WallpaperManager.FLAG_LOCK, lockWallpaperUserId);
+
+ if (fd != null) {
+ try {
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ return LoaderResult.success(BitmapFactory.decodeFileDescriptor(
+ fd.getFileDescriptor(), null, options));
+ } catch (OutOfMemoryError e) {
+ Log.w(TAG, "Can't decode file", e);
+ return LoaderResult.fail();
+ } finally {
+ IoUtils.closeQuietly(fd);
+ }
+ } else {
+ if (selectedUser != null && selectedUser.getIdentifier() != currentUserId) {
+ // When selected user is different from the current user, show the selected
+ // user's static wallpaper.
+ return LoaderResult.success(
+ mWallpaperManager.getBitmapAsUser(selectedUser.getIdentifier()));
+
+ } else {
+ // When there is no selected user, or it's same as the current user, show the
+ // system (possibly dynamic) wallpaper for the selected user.
+ return LoaderResult.success(null);
+ }
+ }
}
public void setCurrentUser(int user) {
@@ -137,14 +141,16 @@
return;
}
mSelectedUser = selectedUser;
-
- mH.removeCallbacks(this);
- mH.post(this);
+ postUpdateWallpaper();
}
@Override
public void onWallpaperChanged() {
// Called on Binder thread.
+ postUpdateWallpaper();
+ }
+
+ private void postUpdateWallpaper() {
mH.removeCallbacks(this);
mH.post(this);
}
@@ -152,10 +158,52 @@
@Override
public void run() {
// Called in response to onWallpaperChanged on the main thread.
- mCached = false;
- mCache = null;
- getBitmap();
- mBar.updateMediaMetaData(true /* metaDataChanged */, true /* allowEnterAnimation */);
+
+ if (mLoader != null) {
+ mLoader.cancel(false /* interrupt */);
+ }
+
+ final int currentUser = mCurrentUserId;
+ final UserHandle selectedUser = mSelectedUser;
+ mLoader = new AsyncTask<Void, Void, LoaderResult>() {
+ @Override
+ protected LoaderResult doInBackground(Void... params) {
+ return loadBitmap(currentUser, selectedUser);
+ }
+
+ @Override
+ protected void onPostExecute(LoaderResult result) {
+ super.onPostExecute(result);
+ if (isCancelled()) {
+ return;
+ }
+ if (result.success) {
+ mCached = true;
+ mCache = result.bitmap;
+ mBar.updateMediaMetaData(
+ true /* metaDataChanged */, true /* allowEnterAnimation */);
+ }
+ mLoader = null;
+ }
+ }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+ }
+
+ private static class LoaderResult {
+ public final boolean success;
+ public final Bitmap bitmap;
+
+ LoaderResult(boolean success, Bitmap bitmap) {
+ this.success = success;
+ this.bitmap = bitmap;
+ }
+
+ static LoaderResult success(Bitmap b) {
+ return new LoaderResult(true, b);
+ }
+
+ static LoaderResult fail() {
+ return new LoaderResult(false, null);
+ }
}
/**
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 40eb71d..40dacd3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -791,7 +791,7 @@
private SubscriptionInfo addSignalController(int id, int simSlotIndex) {
SubscriptionInfo info = new SubscriptionInfo(id, "", simSlotIndex, "", "", 0, 0, "", 0,
- null, 0, 0, "");
+ null, 0, 0, "", SubscriptionManager.SIM_PROVISIONED);
mMobileSignalControllers.put(id, new MobileSignalController(mContext,
mConfig, mHasMobileDataFeature, mPhone, mCallbackHandler, this, info,
mSubDefaults, mReceiverHandler.getLooper()));
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index d900b37..2b29c6b 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -60,7 +60,6 @@
import android.os.Process;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
-import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
@@ -92,7 +91,6 @@
import com.android.internal.R;
import com.android.internal.content.PackageMonitor;
import com.android.internal.os.SomeArgs;
-import com.android.internal.statusbar.IStatusBarService;
import com.android.server.LocalServices;
import com.android.server.statusbar.StatusBarManagerInternal;
@@ -3315,13 +3313,9 @@
private void openRecents() {
final long token = Binder.clearCallingIdentity();
- IStatusBarService statusBarService = IStatusBarService.Stub.asInterface(
- ServiceManager.getService("statusbar"));
- try {
- statusBarService.toggleRecentApps();
- } catch (RemoteException e) {
- Slog.e(LOG_TAG, "Error toggling recent apps.");
- }
+ StatusBarManagerInternal statusBarService = LocalServices.getService(
+ StatusBarManagerInternal.class);
+ statusBarService.toggleRecentApps();
Binder.restoreCallingIdentity(token);
}
diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java
index d61b561..6c05173 100644
--- a/services/core/java/com/android/server/LockSettingsService.java
+++ b/services/core/java/com/android/server/LockSettingsService.java
@@ -690,17 +690,17 @@
final IProgressListener listener = new IProgressListener.Stub() {
@Override
public void onStarted(int id, Bundle extras) throws RemoteException {
- // Ignored
+ Log.d(TAG, "unlockUser started");
}
@Override
public void onProgress(int id, int progress, Bundle extras) throws RemoteException {
- // Ignored
+ Log.d(TAG, "unlockUser progress " + progress);
}
@Override
public void onFinished(int id, Bundle extras) throws RemoteException {
- Log.d(TAG, "unlockUser finished!");
+ Log.d(TAG, "unlockUser finished");
latch.countDown();
}
};
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 6138ef4..60653d5 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -1945,6 +1945,9 @@
startPersistentApps(PackageManager.MATCH_DIRECT_BOOT_UNAWARE);
}
installEncryptionUnawareProviders(userId);
+ if (msg.obj instanceof ProgressReporter) {
+ ((ProgressReporter) msg.obj).finish();
+ }
break;
}
case SYSTEM_USER_CURRENT_MSG: {
diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java
index 6cd6ff4..2516f5d 100644
--- a/services/core/java/com/android/server/am/BatteryStatsService.java
+++ b/services/core/java/com/android/server/am/BatteryStatsService.java
@@ -58,8 +58,8 @@
import com.android.internal.os.BatteryStatsHelper;
import com.android.internal.os.BatteryStatsImpl;
import com.android.internal.os.PowerProfile;
-import com.android.server.FgThread;
import com.android.server.LocalServices;
+import com.android.server.ServiceThread;
import java.io.File;
import java.io.FileDescriptor;
@@ -176,7 +176,10 @@
BatteryStatsService(File systemDir, Handler handler) {
// Our handler here will be accessing the disk, use a different thread than
// what the ActivityManagerService gave us (no I/O on that one!).
- mHandler = new BatteryStatsHandler(FgThread.getHandler().getLooper());
+ final ServiceThread thread = new ServiceThread("batterystats-sync",
+ Process.THREAD_PRIORITY_DEFAULT, true);
+ thread.start();
+ mHandler = new BatteryStatsHandler(thread.getLooper());
// BatteryStatsImpl expects the ActivityManagerService handler, so pass that one through.
mStats = new BatteryStatsImpl(systemDir, handler, mHandler);
@@ -209,6 +212,9 @@
synchronized (mStats) {
mStats.shutdownLocked();
}
+
+ // Shutdown the thread we made.
+ mHandler.getLooper().quit();
}
public static IBatteryStats getService() {
diff --git a/services/core/java/com/android/server/am/PreBootBroadcaster.java b/services/core/java/com/android/server/am/PreBootBroadcaster.java
index 0e192ea..1f3ccf5 100644
--- a/services/core/java/com/android/server/am/PreBootBroadcaster.java
+++ b/services/core/java/com/android/server/am/PreBootBroadcaster.java
@@ -78,9 +78,12 @@
final ResolveInfo ri = mTargets.get(mIndex++);
final ComponentName componentName = ri.activityInfo.getComponentName();
- final CharSequence label = ri.activityInfo.loadLabel(mService.mContext.getPackageManager());
- mProgress.setProgress(mIndex, mTargets.size(),
- mService.mContext.getString(R.string.android_preparing_apk, label));
+ if (mProgress != null) {
+ final CharSequence label = ri.activityInfo
+ .loadLabel(mService.mContext.getPackageManager());
+ mProgress.setProgress(mIndex, mTargets.size(),
+ mService.mContext.getString(R.string.android_preparing_apk, label));
+ }
Slog.i(TAG, "Pre-boot of " + componentName.toShortString() + " for user " + mUserId);
EventLogTags.writeAmPreBoot(mUserId, componentName.getPackageName());
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 4c050c4..75d49c3 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -101,6 +101,7 @@
*/
final class UserController {
private static final String TAG = TAG_WITH_CLASS_NAME ? "UserController" : TAG_AM;
+
// Maximum number of users we allow to be running at a time.
static final int MAX_RUNNING_USERS = 3;
@@ -279,7 +280,8 @@
uss.mUnlockProgress.setProgress(20);
// Dispatch unlocked to system services
- mHandler.sendMessage(mHandler.obtainMessage(SYSTEM_USER_UNLOCK_MSG, userId, 0));
+ mHandler.obtainMessage(SYSTEM_USER_UNLOCK_MSG, userId, 0, uss.mUnlockProgress)
+ .sendToTarget();
// Dispatch unlocked to external apps
final Intent unlockedIntent = new Intent(Intent.ACTION_USER_UNLOCKED);
@@ -309,8 +311,7 @@
// Send PRE_BOOT broadcasts if fingerprint changed
final UserInfo info = getUserInfo(userId);
if (!Objects.equals(info.lastLoggedInFingerprint, Build.FINGERPRINT)) {
- uss.mUnlockProgress.startSegment(80);
- new PreBootBroadcaster(mService, userId, uss.mUnlockProgress) {
+ new PreBootBroadcaster(mService, userId, null) {
@Override
public void onFinished() {
finishUserUnlocked(uss);
@@ -328,14 +329,6 @@
* {@link UserState#STATE_RUNNING_UNLOCKED}.
*/
private void finishUserUnlocked(UserState uss) {
- try {
- finishUserUnlockedInternal(uss);
- } finally {
- uss.mUnlockProgress.finish();
- }
- }
-
- private void finishUserUnlockedInternal(UserState uss) {
final int userId = uss.mHandle.getIdentifier();
synchronized (mService) {
// Bail if we ended up with a stale user
diff --git a/services/core/java/com/android/server/policy/BarController.java b/services/core/java/com/android/server/policy/BarController.java
index 0c80ffa..5878709 100644
--- a/services/core/java/com/android/server/policy/BarController.java
+++ b/services/core/java/com/android/server/policy/BarController.java
@@ -18,15 +18,14 @@
import android.app.StatusBarManager;
import android.os.Handler;
-import android.os.RemoteException;
-import android.os.ServiceManager;
import android.os.SystemClock;
import android.util.Slog;
import android.view.View;
import android.view.WindowManager;
import android.view.WindowManagerPolicy.WindowState;
-import com.android.internal.statusbar.IStatusBarService;
+import com.android.server.LocalServices;
+import com.android.server.statusbar.StatusBarManagerInternal;
import java.io.PrintWriter;
@@ -52,7 +51,7 @@
private final int mTranslucentWmFlag;
protected final Handler mHandler;
private final Object mServiceAquireLock = new Object();
- protected IStatusBarService mStatusBarService;
+ protected StatusBarManagerInternal mStatusBarInternal;
private WindowState mWin;
private int mState = StatusBarManager.WINDOW_STATE_SHOWING;
@@ -182,15 +181,9 @@
mHandler.post(new Runnable() {
@Override
public void run() {
- try {
- IStatusBarService statusbar = getStatusBarService();
- if (statusbar != null) {
- statusbar.setWindowState(mStatusBarManagerId, state);
- }
- } catch (RemoteException e) {
- if (DEBUG) Slog.w(mTag, "Error posting window state", e);
- // re-acquire status bar service next time it is needed.
- mStatusBarService = null;
+ StatusBarManagerInternal statusbar = getStatusBarInternal();
+ if (statusbar != null) {
+ statusbar.setWindowState(mStatusBarManagerId, state);
}
}
});
@@ -276,13 +269,12 @@
}
}
- protected IStatusBarService getStatusBarService() {
+ protected StatusBarManagerInternal getStatusBarInternal() {
synchronized (mServiceAquireLock) {
- if (mStatusBarService == null) {
- mStatusBarService = IStatusBarService.Stub.asInterface(
- ServiceManager.getService("statusbar"));
+ if (mStatusBarInternal == null) {
+ mStatusBarInternal = LocalServices.getService(StatusBarManagerInternal.class);
}
- return mStatusBarService;
+ return mStatusBarInternal;
}
}
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 1686f14..007190d 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -1467,14 +1467,12 @@
private void requestTvPictureInPictureInternal() {
try {
- IStatusBarService statusbar = getStatusBarService();
+ StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
if (statusbar != null) {
statusbar.requestTvPictureInPicture();
}
- } catch (RemoteException|IllegalArgumentException e) {
+ } catch (IllegalArgumentException e) {
Slog.e(TAG, "Cannot handle picture-in-picture key", e);
- // re-acquire status bar service next time it is needed.
- mStatusBarService = null;
}
}
@@ -3562,21 +3560,15 @@
((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
.launchLegacyAssist(hint, UserHandle.myUserId(), args);
} else {
- try {
- if (hint != null) {
- if (args == null) {
- args = new Bundle();
- }
- args.putBoolean(hint, true);
+ if (hint != null) {
+ if (args == null) {
+ args = new Bundle();
}
- IStatusBarService statusbar = getStatusBarService();
- if (statusbar != null) {
- statusbar.startAssist(args);
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "RemoteException when starting assist", e);
- // re-acquire status bar service next time it is needed.
- mStatusBarService = null;
+ args.putBoolean(hint, true);
+ }
+ StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
+ if (statusbar != null) {
+ statusbar.startAssist(args);
}
}
}
@@ -3598,45 +3590,27 @@
private void preloadRecentApps() {
mPreloadedRecentApps = true;
- try {
- IStatusBarService statusbar = getStatusBarService();
- if (statusbar != null) {
- statusbar.preloadRecentApps();
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "RemoteException when preloading recent apps", e);
- // re-acquire status bar service next time it is needed.
- mStatusBarService = null;
+ StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
+ if (statusbar != null) {
+ statusbar.preloadRecentApps();
}
}
private void cancelPreloadRecentApps() {
if (mPreloadedRecentApps) {
mPreloadedRecentApps = false;
- try {
- IStatusBarService statusbar = getStatusBarService();
- if (statusbar != null) {
- statusbar.cancelPreloadRecentApps();
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "RemoteException when cancelling recent apps preload", e);
- // re-acquire status bar service next time it is needed.
- mStatusBarService = null;
+ StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
+ if (statusbar != null) {
+ statusbar.cancelPreloadRecentApps();
}
}
}
private void toggleRecentApps() {
mPreloadedRecentApps = false; // preloading no longer needs to be canceled
- try {
- IStatusBarService statusbar = getStatusBarService();
- if (statusbar != null) {
- statusbar.toggleRecentApps();
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "RemoteException when toggling recent apps", e);
- // re-acquire status bar service next time it is needed.
- mStatusBarService = null;
+ StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
+ if (statusbar != null) {
+ statusbar.toggleRecentApps();
}
}
@@ -3648,40 +3622,24 @@
private void showRecentApps(boolean triggeredFromAltTab, boolean fromHome) {
mPreloadedRecentApps = false; // preloading no longer needs to be canceled
- try {
- IStatusBarService statusbar = getStatusBarService();
- if (statusbar != null) {
- statusbar.showRecentApps(triggeredFromAltTab, fromHome);
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "RemoteException when showing recent apps", e);
- // re-acquire status bar service next time it is needed.
- mStatusBarService = null;
+ StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
+ if (statusbar != null) {
+ statusbar.showRecentApps(triggeredFromAltTab, fromHome);
}
}
private void toggleKeyboardShortcutsMenu(int deviceId) {
- try {
- IStatusBarService statusbar = getStatusBarService();
- if (statusbar != null) {
- statusbar.toggleKeyboardShortcutsMenu(deviceId);
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "RemoteException when showing keyboard shortcuts menu", e);
+ StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
+ if (statusbar != null) {
+ statusbar.toggleKeyboardShortcutsMenu(deviceId);
}
}
private void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHome) {
mPreloadedRecentApps = false; // preloading no longer needs to be canceled
- try {
- IStatusBarService statusbar = getStatusBarService();
- if (statusbar != null) {
- statusbar.hideRecentApps(triggeredFromAltTab, triggeredFromHome);
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "RemoteException when closing recent apps", e);
- // re-acquire status bar service next time it is needed.
- mStatusBarService = null;
+ StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
+ if (statusbar != null) {
+ statusbar.hideRecentApps(triggeredFromAltTab, triggeredFromHome);
}
}
@@ -7483,13 +7441,9 @@
if (mKeyguardDelegate != null) {
mKeyguardDelegate.setCurrentUser(newUserId);
}
- IStatusBarService statusBar = getStatusBarService();
+ StatusBarManagerInternal statusBar = getStatusBarManagerInternal();
if (statusBar != null) {
- try {
- statusBar.setCurrentUser(newUserId);
- } catch (RemoteException e) {
- // oh well
- }
+ statusBar.setCurrentUser(newUserId);
}
setLastInputMethodWindowLw(null, null);
}
diff --git a/services/core/java/com/android/server/policy/StatusBarController.java b/services/core/java/com/android/server/policy/StatusBarController.java
index 86d0468..245518c 100644
--- a/services/core/java/com/android/server/policy/StatusBarController.java
+++ b/services/core/java/com/android/server/policy/StatusBarController.java
@@ -18,9 +18,7 @@
import android.app.StatusBarManager;
import android.os.IBinder;
-import android.os.RemoteException;
import android.os.SystemClock;
-import android.util.Slog;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.Animation;
@@ -28,7 +26,6 @@
import android.view.animation.Interpolator;
import android.view.animation.TranslateAnimation;
-import com.android.internal.statusbar.IStatusBarService;
import com.android.server.LocalServices;
import com.android.server.statusbar.StatusBarManagerInternal;
@@ -49,15 +46,9 @@
mHandler.post(new Runnable() {
@Override
public void run() {
- try {
- IStatusBarService statusbar = getStatusBarService();
- if (statusbar != null) {
- statusbar.appTransitionPending();
- }
- } catch (RemoteException e) {
- Slog.e(mTag, "RemoteException when app transition is pending", e);
- // re-acquire status bar service next time it is needed.
- mStatusBarService = null;
+ StatusBarManagerInternal statusbar = getStatusBarInternal();
+ if (statusbar != null) {
+ statusbar.appTransitionPending();
}
}
});
@@ -69,19 +60,13 @@
mHandler.post(new Runnable() {
@Override
public void run() {
- try {
- IStatusBarService statusbar = getStatusBarService();
- if (statusbar != null) {
- long startTime = calculateStatusBarTransitionStartTime(openAnimation,
- closeAnimation);
- long duration = closeAnimation != null || openAnimation != null
- ? TRANSITION_DURATION : 0;
- statusbar.appTransitionStarting(startTime, duration);
- }
- } catch (RemoteException e) {
- Slog.e(mTag, "RemoteException when app transition is starting", e);
- // re-acquire status bar service next time it is needed.
- mStatusBarService = null;
+ StatusBarManagerInternal statusbar = getStatusBarInternal();
+ if (statusbar != null) {
+ long startTime = calculateStatusBarTransitionStartTime(openAnimation,
+ closeAnimation);
+ long duration = closeAnimation != null || openAnimation != null
+ ? TRANSITION_DURATION : 0;
+ statusbar.appTransitionStarting(startTime, duration);
}
}
});
@@ -92,15 +77,9 @@
mHandler.post(new Runnable() {
@Override
public void run() {
- try {
- IStatusBarService statusbar = getStatusBarService();
- if (statusbar != null) {
- statusbar.appTransitionCancelled();
- }
- } catch (RemoteException e) {
- Slog.e(mTag, "RemoteException when app transition is cancelled", e);
- // re-acquire status bar service next time it is needed.
- mStatusBarService = null;
+ StatusBarManagerInternal statusbar = getStatusBarInternal();
+ if (statusbar != null) {
+ statusbar.appTransitionCancelled();
}
}
});
diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java b/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java
index 95923fe..38a3d01 100644
--- a/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java
+++ b/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java
@@ -28,6 +28,50 @@
void notificationLightOff();
void showScreenPinningRequest(int taskId);
void showAssistDisclosure();
+
+ void preloadRecentApps();
+
+ void cancelPreloadRecentApps();
+
+ void showRecentApps(boolean triggeredFromAltTab, boolean fromHome);
+
+ void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey);
+
+ void toggleKeyboardShortcutsMenu(int deviceId);
+
+ /**
+ * Request picture-in-picture.
+ *
+ * <p>
+ * This is called when an user presses picture-in-picture key or equivalent.
+ * TV device may start picture-in-picture from foreground activity if there's none.
+ * Picture-in-picture overlay menu will be shown instead otherwise.
+ */
+ void requestTvPictureInPicture();
+
+ void setWindowState(int window, int state);
+
+ /**
+ * Notifies the status bar that an app transition is pending to delay applying some flags with
+ * visual impact until {@link #appTransitionReady} is called.
+ */
+ void appTransitionPending();
+
+ /**
+ * Notifies the status bar that a pending app transition has been cancelled.
+ */
+ void appTransitionCancelled();
+
+ /**
+ * Notifies the status bar that an app transition is now being executed.
+ *
+ * @param statusBarAnimationsStartTime the desired start time for all visual animations in the
+ * status bar caused by this app transition in uptime millis
+ * @param statusBarAnimationsDuration the duration for all visual animations in the status
+ * bar caused by this app transition in millis
+ */
+ void appTransitionStarting(long statusBarAnimationsStartTime, long statusBarAnimationsDuration);
+
void startAssist(Bundle args);
void onCameraLaunchGestureDetected(int source);
void topAppWindowChanged(boolean menuVisible);
@@ -35,4 +79,8 @@
Rect fullscreenBounds, Rect dockedBounds, String cause);
void toggleSplitScreen();
void appTransitionFinished();
+
+ void toggleRecentApps();
+
+ void setCurrentUser(int newUserId);
}
diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
index 981b75a..9020677 100644
--- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
+++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
@@ -223,6 +223,114 @@
} catch (RemoteException ex) {}
}
}
+
+ @Override
+ public void toggleRecentApps() {
+ if (mBar != null) {
+ try {
+ mBar.toggleRecentApps();
+ } catch (RemoteException ex) {}
+ }
+ }
+
+ @Override
+ public void setCurrentUser(int newUserId) {
+ if (SPEW) Slog.d(TAG, "Setting current user to user " + newUserId);
+ mCurrentUserId = newUserId;
+ }
+
+
+ @Override
+ public void preloadRecentApps() {
+ if (mBar != null) {
+ try {
+ mBar.preloadRecentApps();
+ } catch (RemoteException ex) {}
+ }
+ }
+
+ @Override
+ public void cancelPreloadRecentApps() {
+ if (mBar != null) {
+ try {
+ mBar.cancelPreloadRecentApps();
+ } catch (RemoteException ex) {}
+ }
+ }
+
+ @Override
+ public void showRecentApps(boolean triggeredFromAltTab, boolean fromHome) {
+ if (mBar != null) {
+ try {
+ mBar.showRecentApps(triggeredFromAltTab, fromHome);
+ } catch (RemoteException ex) {}
+ }
+ }
+
+ @Override
+ public void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
+ if (mBar != null) {
+ try {
+ mBar.hideRecentApps(triggeredFromAltTab, triggeredFromHomeKey);
+ } catch (RemoteException ex) {}
+ }
+ }
+
+ @Override
+ public void toggleKeyboardShortcutsMenu(int deviceId) {
+ if (mBar != null) {
+ try {
+ mBar.toggleKeyboardShortcutsMenu(deviceId);
+ } catch (RemoteException ex) {}
+ }
+ }
+
+ @Override
+ public void requestTvPictureInPicture() {
+ if (mBar != null) {
+ try {
+ mBar.requestTvPictureInPicture();
+ } catch (RemoteException ex) {}
+ }
+ }
+
+ @Override
+ public void setWindowState(int window, int state) {
+ if (mBar != null) {
+ try {
+ mBar.setWindowState(window, state);
+ } catch (RemoteException ex) {}
+ }
+ }
+
+ @Override
+ public void appTransitionPending() {
+ if (mBar != null) {
+ try {
+ mBar.appTransitionPending();
+ } catch (RemoteException ex) {}
+ }
+ }
+
+ @Override
+ public void appTransitionCancelled() {
+ if (mBar != null) {
+ try {
+ mBar.appTransitionCancelled();
+ } catch (RemoteException ex) {}
+ }
+ }
+
+ @Override
+ public void appTransitionStarting(long statusBarAnimationsStartTime,
+ long statusBarAnimationsDuration) {
+ if (mBar != null) {
+ try {
+ mBar.appTransitionStarting(
+ statusBarAnimationsStartTime, statusBarAnimationsDuration);
+ } catch (RemoteException ex) {}
+ }
+ }
};
// ================================================================================
@@ -527,122 +635,6 @@
}
}
- @Override
- public void toggleRecentApps() {
- if (mBar != null) {
- try {
- mBar.toggleRecentApps();
- } catch (RemoteException ex) {}
- }
- }
-
- @Override
- public void preloadRecentApps() {
- if (mBar != null) {
- try {
- mBar.preloadRecentApps();
- } catch (RemoteException ex) {}
- }
- }
-
- @Override
- public void cancelPreloadRecentApps() {
- if (mBar != null) {
- try {
- mBar.cancelPreloadRecentApps();
- } catch (RemoteException ex) {}
- }
- }
-
- @Override
- public void showRecentApps(boolean triggeredFromAltTab, boolean fromHome) {
- if (mBar != null) {
- try {
- mBar.showRecentApps(triggeredFromAltTab, fromHome);
- } catch (RemoteException ex) {}
- }
- }
-
- @Override
- public void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
- if (mBar != null) {
- try {
- mBar.hideRecentApps(triggeredFromAltTab, triggeredFromHomeKey);
- } catch (RemoteException ex) {}
- }
- }
-
- @Override
- public void toggleKeyboardShortcutsMenu(int deviceId) {
- if (mBar != null) {
- try {
- mBar.toggleKeyboardShortcutsMenu(deviceId);
- } catch (RemoteException ex) {}
- }
- }
-
- @Override
- public void requestTvPictureInPicture() {
- if (mBar != null) {
- try {
- mBar.requestTvPictureInPicture();
- } catch (RemoteException ex) {}
- }
- }
-
- @Override
- public void setCurrentUser(int newUserId) {
- if (SPEW) Slog.d(TAG, "Setting current user to user " + newUserId);
- mCurrentUserId = newUserId;
- }
-
- @Override
- public void setWindowState(int window, int state) {
- if (mBar != null) {
- try {
- mBar.setWindowState(window, state);
- } catch (RemoteException ex) {}
- }
- }
-
- @Override
- public void appTransitionPending() {
- if (mBar != null) {
- try {
- mBar.appTransitionPending();
- } catch (RemoteException ex) {}
- }
- }
-
- @Override
- public void appTransitionCancelled() {
- if (mBar != null) {
- try {
- mBar.appTransitionCancelled();
- } catch (RemoteException ex) {}
- }
- }
-
- @Override
- public void appTransitionStarting(long statusBarAnimationsStartTime,
- long statusBarAnimationsDuration) {
- if (mBar != null) {
- try {
- mBar.appTransitionStarting(
- statusBarAnimationsStartTime, statusBarAnimationsDuration);
- } catch (RemoteException ex) {}
- }
- }
-
- @Override
- public void startAssist(Bundle args) {
- if (mBar != null) {
- try {
- mBar.startAssist(args);
- } catch (RemoteException ex) {}
- }
- }
-
private void enforceStatusBarOrShell() {
if (Binder.getCallingUid() == Process.SHELL_UID) {
return;
diff --git a/services/core/java/com/android/server/wm/BoundsAnimationController.java b/services/core/java/com/android/server/wm/BoundsAnimationController.java
index b7d6062..eacdd81 100644
--- a/services/core/java/com/android/server/wm/BoundsAnimationController.java
+++ b/services/core/java/com/android/server/wm/BoundsAnimationController.java
@@ -129,13 +129,16 @@
public void onAnimationStart(Animator animation) {
if (DEBUG) Slog.d(TAG, "onAnimationStart: mTarget=" + mTarget
+ " mReplacement=" + mReplacement);
- if (animatingToLargerSize()) {
- mTarget.setPinnedStackSize(mFrom, mTo);
- }
-
if (!mReplacement) {
mTarget.onAnimationStart();
}
+
+ // Ensure that we have prepared the target for animation before
+ // we trigger any size changes, so it can swap surfaces
+ // in to appropriate modes, or do as it wishes otherwise.
+ if (animatingToLargerSize()) {
+ mTarget.setPinnedStackSize(mFrom, mTo);
+ }
}
@Override
diff --git a/services/core/java/com/android/server/wm/DockedStackDividerController.java b/services/core/java/com/android/server/wm/DockedStackDividerController.java
index 0039c0a..b90d0d1 100644
--- a/services/core/java/com/android/server/wm/DockedStackDividerController.java
+++ b/services/core/java/com/android/server/wm/DockedStackDividerController.java
@@ -663,4 +663,8 @@
public String toShortString() {
return TAG;
}
-}
\ No newline at end of file
+
+ WindowState getWindow() {
+ return mWindow;
+ }
+}
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 46a8dff..4f49eed 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -600,7 +600,8 @@
//
// Anyway we don't need to synchronize position and content updates for these
// windows since they aren't at the base layer and could be moved around anyway.
- if (!win.computeDragResizing() && win.mAttrs.type == TYPE_BASE_APPLICATION) {
+ if (!win.computeDragResizing() && win.mAttrs.type == TYPE_BASE_APPLICATION &&
+ !mStack.getBoundsAnimating()) {
win.mResizedWhileNotDragResizing = true;
}
}
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index 872bc6d..1fd2b1f 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -42,6 +42,7 @@
import android.view.DisplayInfo;
import android.view.Surface;
import android.view.animation.PathInterpolator;
+import android.view.SurfaceControl;
import com.android.internal.policy.DividerSnapAlgorithm;
import com.android.internal.policy.DividerSnapAlgorithm.SnapTarget;
@@ -127,10 +128,12 @@
private float mAdjustImeAmount;
private final int mDockedStackMinimizeThickness;
- // If this is true, the task will be down or upscaled
- // to perfectly fit the region it would have been cropped
- // to.
- private boolean mForceScaleToCrop = false;
+ // If this is true, we are in the bounds animating mode.
+ // The task will be down or upscaled to perfectly fit the
+ // region it would have been cropped to. We may also avoid
+ // certain logic we would otherwise apply while resizing,
+ // while resizing in the bounds animating mode.
+ private boolean mBoundsAnimating = false;
// By default, movement animations are applied to all
// window movement. If this is true, animations will not
// be applied within this stack. This is useful for example
@@ -1269,11 +1272,36 @@
return true;
}
+ void forceWindowsScaleable(boolean force) {
+ SurfaceControl.openTransaction();
+ try {
+ for (int taskNdx = mTasks.size() - 1; taskNdx >= 0; --taskNdx) {
+ final ArrayList<AppWindowToken> activities = mTasks.get(taskNdx).mAppTokens;
+ for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
+ final ArrayList<WindowState> windows = activities.get(activityNdx).allAppWindows;
+ for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) {
+ final WindowStateAnimator winAnimator = windows.get(winNdx).mWinAnimator;
+ if (winAnimator == null || !winAnimator.hasSurface()) {
+ continue;
+ }
+ winAnimator.mSurfaceController.forceScaleableInTransaction(force);
+ }
+ }
+ }
+ } finally {
+ SurfaceControl.closeTransaction();
+ }
+ }
+
@Override // AnimatesBounds
public void onAnimationStart() {
synchronized (mService.mWindowMap) {
+ // We force windows out of SCALING_MODE_FREEZE
+ // so that we can continue to animate them
+ // while a resize is pending.
+ forceWindowsScaleable(true);
mFreezeMovementAnimations = true;
- mForceScaleToCrop = true;
+ mBoundsAnimating = true;
}
}
@@ -1281,7 +1309,8 @@
public void onAnimationEnd() {
synchronized (mService.mWindowMap) {
mFreezeMovementAnimations = false;
- mForceScaleToCrop = false;
+ mBoundsAnimating = false;
+ forceWindowsScaleable(false);
mService.requestTraversal();
}
if (mStackId == PINNED_STACK_ID) {
@@ -1312,6 +1341,10 @@
}
public boolean getForceScaleToCrop() {
- return mForceScaleToCrop;
+ return mBoundsAnimating;
+ }
+
+ public boolean getBoundsAnimating() {
+ return mBoundsAnimating;
}
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 79ff78e..38f12a1 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -1563,6 +1563,16 @@
mLayersController.setInputMethodAnimLayerAdjustment(0);
}
}
+
+ // If the docked divider is visible, we still need to go through this whole
+ // excercise to find the appropriate input method target (used for animations
+ // and dialog adjustments), but for purposes of Z ordering we simply wish to
+ // place it above the docked divider.
+ WindowState dockedDivider = w.mDisplayContent.mDividerControllerLocked.getWindow();
+ if (dockedDivider != null && dockedDivider.isVisibleLw()) {
+ int dividerIndex = windows.indexOf(dockedDivider);
+ return dividerIndex > 0 ? dividerIndex + 1 : i + 1;
+ }
return i+1;
}
if (willMove) {
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 5077f32..76fdda01 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -2382,6 +2382,9 @@
if (stack != null) {
pw.print(" stackId="); pw.print(stack.mStackId);
}
+ if (mNotOnAppsDisplay) {
+ pw.print(" mNotOnAppsDisplay="); pw.print(mNotOnAppsDisplay);
+ }
pw.print(" mSession="); pw.print(mSession);
pw.print(" mClient="); pw.println(mClient.asBinder());
pw.print(prefix); pw.print("mOwnerUid="); pw.print(mOwnerUid);
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 1f76f31..f6ef69d 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -562,6 +562,7 @@
Slog.v(TAG, "Finishing drawing window " + mWin + ": mDrawState="
+ drawStateToString());
}
+
if (mWin.mAppToken != null && mWin.mAppToken.mAnimatingWithSavedSurface) {
// App has drawn something to its windows, we're no longer animating with
// the saved surfaces. If the user exits now, we only want to save again
@@ -1290,6 +1291,17 @@
}
private void adjustCropToStackBounds(WindowState w, Rect clipRect, Rect finalClipRect,
boolean isFreeformResizing) {
+
+ final DisplayContent displayContent = w.getDisplayContent();
+ if (displayContent != null && !displayContent.isDefaultDisplay) {
+ // There are some windows that live on other displays while their app and main window
+ // live on the default display (e.g. casting...). We don't want to crop this windows
+ // to the stack bounds which is only currently supported on the default display.
+ // TODO(multi-display): Need to support cropping to stack bounds on other displays
+ // when we have stacks on other displays.
+ return;
+ }
+
final Task task = w.getTask();
if (task == null || !task.cropWindowsToStackBounds()) {
return;
diff --git a/services/core/java/com/android/server/wm/WindowSurfaceController.java b/services/core/java/com/android/server/wm/WindowSurfaceController.java
index 8799c61..6eed5e7 100644
--- a/services/core/java/com/android/server/wm/WindowSurfaceController.java
+++ b/services/core/java/com/android/server/wm/WindowSurfaceController.java
@@ -23,6 +23,8 @@
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_VISIBILITY;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
+import static android.view.Surface.SCALING_MODE_FREEZE;
+import static android.view.Surface.SCALING_MODE_SCALE_TO_WINDOW;
import android.graphics.Point;
import android.graphics.PointF;
@@ -392,6 +394,13 @@
mSurfaceControl.deferTransactionUntil(handle, frame);
}
+ void forceScaleableInTransaction(boolean force) {
+ // -1 means we don't override the default or client specified
+ // scaling mode.
+ int scalingMode = force ? SCALING_MODE_SCALE_TO_WINDOW : -1;
+ mSurfaceControl.setOverrideScalingMode(scalingMode);
+ }
+
boolean clearWindowContentFrameStats() {
if (mSurfaceControl == null) {
return false;
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index d3d05f3..45a7311 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -2909,6 +2909,54 @@
}
}
+ public void forceRemoveActiveAdmin(ComponentName adminReceiver, int userHandle) {
+ if (!mHasFeature) {
+ return;
+ }
+ Preconditions.checkNotNull(adminReceiver, "ComponentName is null");
+ enforceShell("forceRemoveActiveAdmin");
+ long ident = mInjector.binderClearCallingIdentity();
+ try {
+ final ApplicationInfo ai;
+ try {
+ ai = mIPackageManager.getApplicationInfo(adminReceiver.getPackageName(),
+ 0, userHandle);
+ } catch (RemoteException e) {
+ throw new IllegalStateException(e);
+ }
+ if (ai == null) {
+ throw new IllegalStateException("Couldn't find package to remove admin "
+ + adminReceiver.getPackageName() + " " + userHandle);
+ }
+ if ((ai.flags & ApplicationInfo.FLAG_TEST_ONLY) == 0) {
+ throw new SecurityException("Attempt to remove non-test admin " + adminReceiver
+ + adminReceiver + " " + userHandle);
+ }
+ // If admin is a device or profile owner tidy that up first.
+ synchronized (this) {
+ if (isDeviceOwner(adminReceiver, userHandle)) {
+ clearDeviceOwnerLocked(getDeviceOwnerAdminLocked(), userHandle);
+ }
+ if (isProfileOwner(adminReceiver, userHandle)) {
+ final ActiveAdmin admin = getActiveAdminUncheckedLocked(adminReceiver,
+ userHandle, /* parent */ false);
+ clearProfileOwnerLocked(admin, userHandle);
+ }
+ }
+ // Remove the admin skipping sending the broadcast.
+ removeAdminArtifacts(adminReceiver, userHandle);
+ } finally {
+ mInjector.binderRestoreCallingIdentity(ident);
+ }
+ }
+
+ private void enforceShell(String method) {
+ final int callingUid = Binder.getCallingUid();
+ if (callingUid != Process.SHELL_UID && callingUid != Process.ROOT_UID) {
+ throw new SecurityException("Non-shell user attempted to call " + method);
+ }
+ }
+
@Override
public void removeActiveAdmin(ComponentName adminReceiver, int userHandle) {
if (!mHasFeature) {
@@ -5732,32 +5780,37 @@
enforceUserUnlocked(deviceOwnerUserId);
final ActiveAdmin admin = getDeviceOwnerAdminLocked();
- if (admin != null) {
- admin.disableCamera = false;
- admin.userRestrictions = null;
- admin.forceEphemeralUsers = false;
- mUserManagerInternal.setForceEphemeralUsers(admin.forceEphemeralUsers);
- }
- clearUserPoliciesLocked(deviceOwnerUserId);
-
- mOwners.clearDeviceOwner();
- mOwners.writeDeviceOwner();
- updateDeviceOwnerLocked();
- disableSecurityLoggingIfNotCompliant();
- // Reactivate backup service.
long ident = mInjector.binderClearCallingIdentity();
try {
- mInjector.getIBackupManager().setBackupServiceActive(UserHandle.USER_SYSTEM, true);
-
+ clearDeviceOwnerLocked(admin, deviceOwnerUserId);
removeActiveAdminLocked(deviceOwnerComponent, deviceOwnerUserId);
- } catch (RemoteException e) {
- throw new IllegalStateException("Failed reactivating backup service.", e);
} finally {
mInjector.binderRestoreCallingIdentity(ident);
}
}
}
+ private void clearDeviceOwnerLocked(ActiveAdmin admin, int userId) {
+ if (admin != null) {
+ admin.disableCamera = false;
+ admin.userRestrictions = null;
+ admin.forceEphemeralUsers = false;
+ mUserManagerInternal.setForceEphemeralUsers(admin.forceEphemeralUsers);
+ }
+ clearUserPoliciesLocked(userId);
+
+ mOwners.clearDeviceOwner();
+ mOwners.writeDeviceOwner();
+ updateDeviceOwnerLocked();
+ disableSecurityLoggingIfNotCompliant();
+ try {
+ // Reactivate backup service.
+ mInjector.getIBackupManager().setBackupServiceActive(UserHandle.USER_SYSTEM, true);
+ } catch (RemoteException e) {
+ throw new IllegalStateException("Failed reactivating backup service.", e);
+ }
+ }
+
@Override
public boolean setProfileOwner(ComponentName who, String ownerName, int userHandle) {
if (!mHasFeature) {
@@ -5794,14 +5847,9 @@
final ActiveAdmin admin =
getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
synchronized (this) {
- admin.disableCamera = false;
- admin.userRestrictions = null;
- clearUserPoliciesLocked(userId);
- mOwners.removeProfileOwner(userId);
- mOwners.writeProfileOwner(userId);
-
final long ident = mInjector.binderClearCallingIdentity();
try {
+ clearProfileOwnerLocked(admin, userId);
removeActiveAdminLocked(who, userId);
} finally {
mInjector.binderRestoreCallingIdentity(ident);
@@ -5809,6 +5857,16 @@
}
}
+ public void clearProfileOwnerLocked(ActiveAdmin admin, int userId) {
+ if (admin != null) {
+ admin.disableCamera = false;
+ admin.userRestrictions = null;
+ }
+ clearUserPoliciesLocked(userId);
+ mOwners.removeProfileOwner(userId);
+ mOwners.writeProfileOwner(userId);
+ }
+
@Override
public void setDeviceOwnerLockScreenInfo(ComponentName who, CharSequence info) {
Preconditions.checkNotNull(who, "ComponentName is null");
@@ -5842,15 +5900,13 @@
policy.mUserProvisioningState = DevicePolicyManager.STATE_USER_UNMANAGED;
saveSettingsLocked(userId);
- final long ident = mInjector.binderClearCallingIdentity();
try {
mIPackageManager.updatePermissionFlagsForAllApps(
PackageManager.FLAG_PERMISSION_POLICY_FIXED,
0 /* flagValues */, userId);
pushUserRestrictions(userId);
} catch (RemoteException re) {
- } finally {
- mInjector.binderRestoreCallingIdentity(ident);
+ // Shouldn't happen.
}
}
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 5ac697f..15d76fd 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -630,6 +630,20 @@
public static final String KEY_MMS_USER_AGENT_STRING = "userAgent";
/**
+ * If carriers require differentiate un-provisioned status: cold sim or out of credit sim
+ * a package name and activity name can be provided to launch a supported carrier application
+ * that check the sim provisioning status
+ * The first element is the package name and the second element is the activity name
+ * of the provisioning app
+ * example:
+ * <item>com.google.android.carrierPackageName</item>
+ * <item>com.google.android.carrierPackageName.CarrierActivityName</item>
+ * @hide
+ */
+ public static final String KEY_SIM_PROVISIONING_STATUS_DETECTION_CARRIER_APP_STRING_ARRAY =
+ "sim_state_detection_carrier_app_string_array";
+
+ /**
* Determines whether the carrier supports making non-emergency phone calls while the phone is
* in emergency callback mode. Default value is {@code true}, meaning that non-emergency calls
* are allowed in emergency callback mode.
@@ -798,6 +812,10 @@
sDefaults.putString(KEY_MMS_USER_AGENT_STRING, "");
sDefaults.putBoolean(KEY_ALLOW_NON_EMERGENCY_CALLS_IN_ECM_BOOL, true);
sDefaults.putBoolean(KEY_USE_RCS_PRESENCE_BOOL, false);
+
+ // Used for Sim card State detection app
+ sDefaults.putStringArray(KEY_SIM_PROVISIONING_STATUS_DETECTION_CARRIER_APP_STRING_ARRAY,
+ null);
}
/**
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java
index 6229ed9..b5cf212e 100644
--- a/telephony/java/android/telephony/SubscriptionInfo.java
+++ b/telephony/java/android/telephony/SubscriptionInfo.java
@@ -90,6 +90,14 @@
private int mDataRoaming;
/**
+ * Sim Provisioning Status:
+ * {@See SubscriptionManager#SIM_PROVISIONED}
+ * {@See SubscriptionManager#SIM_UNPROVISIONED_COLD}
+ * {@See SubscriptionManager#SIM_UNPROVISIONED_OUT_OF_CREDIT}
+ */
+ private int mSimProvisioningStatus;
+
+ /**
* SIM Icon bitmap
*/
private Bitmap mIconBitmap;
@@ -114,7 +122,7 @@
*/
public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName,
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
- Bitmap icon, int mcc, int mnc, String countryIso) {
+ Bitmap icon, int mcc, int mnc, String countryIso, int simProvisioningStatus) {
this.mId = id;
this.mIccId = iccId;
this.mSimSlotIndex = simSlotIndex;
@@ -128,6 +136,7 @@
this.mMcc = mcc;
this.mMnc = mnc;
this.mCountryIso = countryIso;
+ this.mSimProvisioningStatus = simProvisioningStatus;
}
/**
@@ -264,6 +273,17 @@
}
/**
+ * @return Sim Provisioning Status
+ * {@See SubscriptionManager#SIM_PROVISIONED}
+ * {@See SubscriptionManager#SIM_UNPROVISIONED_COLD}
+ * {@See SubscriptionManager#SIM_UNPROVISIONED_OUT_OF_CREDIT}
+ * @hide
+ */
+ public int getSimProvisioningStatus() {
+ return this.mSimProvisioningStatus;
+ }
+
+ /**
* @return the MCC.
*/
public int getMcc() {
@@ -299,10 +319,12 @@
int mcc = source.readInt();
int mnc = source.readInt();
String countryIso = source.readString();
+ int simProvisioningStatus = source.readInt();
Bitmap iconBitmap = Bitmap.CREATOR.createFromParcel(source);
return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName,
- nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso);
+ nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso,
+ simProvisioningStatus);
}
@Override
@@ -325,6 +347,7 @@
dest.writeInt(mMcc);
dest.writeInt(mMnc);
dest.writeString(mCountryIso);
+ dest.writeInt(mSimProvisioningStatus);
mIconBitmap.writeToParcel(dest, flags);
}
@@ -355,6 +378,6 @@
+ " displayName=" + mDisplayName + " carrierName=" + mCarrierName
+ " nameSource=" + mNameSource + " iconTint=" + mIconTint
+ " dataRoaming=" + mDataRoaming + " iconBitmap=" + mIconBitmap + " mcc " + mMcc
- + " mnc " + mMnc + "}";
+ + " mnc " + mMnc + " SimProvisioningStatus " + mSimProvisioningStatus +"}";
}
}
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index f3b0ce2..c49966a 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -232,6 +232,22 @@
/** Indicates that data roaming is disabled for a subscription */
public static final int DATA_ROAMING_DISABLE = 0;
+ /** Sim provisioning status: provisioned */
+ /** @hide */
+ public static final int SIM_PROVISIONED = 0;
+
+ /** Sim provisioning status: un-provisioned due to cold sim */
+ /** @hide */
+ public static final int SIM_UNPROVISIONED_COLD = 1;
+
+ /** Sim provisioning status: un-provisioned due to out of credit */
+ /** @hide */
+ public static final int SIM_UNPROVISIONED_OUT_OF_CREDIT = 2;
+
+ /** Maximum possible sim provisioning status */
+ /** @hide */
+ public static final int MAX_SIM_PROVISIONING_STATUS = SIM_UNPROVISIONED_OUT_OF_CREDIT;
+
/** @hide */
public static final int DATA_ROAMING_DEFAULT = DATA_ROAMING_DISABLE;
@@ -250,6 +266,13 @@
public static final String MNC = "mnc";
/**
+ * TelephonyProvider column name for the sim provisioning status associated with a SIM.
+ * <P>Type: INTEGER (int)</P>
+ * @hide
+ */
+ public static final String SIM_PROVISIONING_STATUS = "sim_provisioning_status";
+
+ /**
* TelephonyProvider column name for extreme threat in CB settings
* @hide
*/
@@ -820,6 +843,40 @@
}
/**
+ * Set Sim Provisioning Status by subscription ID
+ * @param simProvisioningStatus with the subscription
+ * {@See SubscriptionManager#SIM_PROVISIONED}
+ * {@See SubscriptionManager#SIM_UNPROVISIONED_COLD}
+ * {@See SubscriptionManager#SIM_UNPROVISIONED_OUT_OF_CREDIT}
+ * @param subId the unique SubInfoRecord index in database
+ * @return the number of records updated
+ * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
+ * @hide
+ */
+ public int setSimProvisioningStatus(int simProvisioningStatus, int subId) {
+ if (VDBG) {
+ logd("[setSimProvisioningStatus]+ status:" + simProvisioningStatus + " subId:" + subId);
+ }
+ if (simProvisioningStatus < 0 || simProvisioningStatus > MAX_SIM_PROVISIONING_STATUS ||
+ !isValidSubscriptionId(subId)) {
+ logd("[setSimProvisioningStatus]- fail");
+ return -1;
+ }
+
+ int result = 0;
+
+ try {
+ ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
+ if (iSub != null) {
+ result = iSub.setSimProvisioningStatus(simProvisioningStatus, subId);
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+ return result;
+ }
+
+ /**
* Get slotId associated with the subscription.
* @return slotId as a positive integer or a negative value if an error either
* SIM_NOT_INSERTED or < 0 if an invalid slot index
diff --git a/telephony/java/com/android/internal/telephony/DctConstants.java b/telephony/java/com/android/internal/telephony/DctConstants.java
index ccabace..e4981ce 100644
--- a/telephony/java/com/android/internal/telephony/DctConstants.java
+++ b/telephony/java/com/android/internal/telephony/DctConstants.java
@@ -103,6 +103,7 @@
public static final int EVENT_DATA_RAT_CHANGED = BASE + 41;
public static final int CMD_CLEAR_PROVISIONING_SPINNER = BASE + 42;
public static final int EVENT_DEVICE_PROVISIONED_CHANGE = BASE + 43;
+ public static final int EVENT_REDIRECTION_DETECTED = BASE + 44;
/***** Constants *****/
diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl
index f6aef08..c61ed2a 100755
--- a/telephony/java/com/android/internal/telephony/ISub.aidl
+++ b/telephony/java/com/android/internal/telephony/ISub.aidl
@@ -118,6 +118,17 @@
int setDisplayName(String displayName, int subId);
/**
+ * Set Sim Provisioning Status by subscription ID
+ * @param simProvisionStatus with the subscription:
+ * {@See SubscriptionManager#SIM_PROVISIONED}
+ * {@See SubscriptionManager#SIM_UNPROVISIONED_COLD}
+ * {@See SubscriptionManager#SIM_UNPROVISIONED_OUT_OF_CREDIT}
+ * @param subId the unique SubInfoRecord index in database
+ * @return the number of records updated
+ */
+ int setSimProvisioningStatus(int simProvisioningStatus, int subId);
+
+ /**
* Set display name by simInfo index with name source
* @param displayName the display name of SIM card
* @param subId the unique SubscriptionInfo index in database
diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
index c70f8cf..eafb3d4 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
@@ -395,4 +395,32 @@
*/
public static final String ACTION_SET_RADIO_CAPABILITY_FAILED =
"android.intent.action.ACTION_SET_RADIO_CAPABILITY_FAILED";
+
+ /**
+ * <p>Broadcast Action: when data connections get redirected with validation failure.
+ * intended for sim/account status checks and only sent to the specified carrier app
+ * feedback is via carrier/system APIs to report cold-sim, out-of-credit-sim, etc
+ * The intent will have the following extra values:</p>
+ * <ul>
+ * <li>redirectUrl</li><dd>A string with the redirection url info.</dd>
+ * <li>subId</li><dd>Sub Id which associated the data redirection.</dd>
+ * </ul>
+ * <p class="note">This is a protected intent that can only be sent by the system.</p>
+ */
+ public static final String ACTION_DATA_CONNECTION_REDIRECTED =
+ "android.intent.action.REDIRECTION_DETECTED";
+ /**
+ * <p>Broadcast Action: when data connections setup fails.
+ * intended for sim/account status checks and only sent to the specified carrier app
+ * feedback is via carrier/system APIs to report cold-sim, out-of-credit-sim, etc
+ * The intent will have the following extra values:</p>
+ * <ul>
+ * <li>apnType</li><dd>A string with the apn type.</dd>
+ * <li>errorCode</li><dd>A integer with dataFailCause.</dd>
+ * <li>subId</dt><li>Sub Id which associated the data redirection.</dd>
+ * </ul>
+ * <p class="note">This is a protected intent that can only be sent by the system. </p>
+ */
+ public static final String ACTION_REQUEST_NETWORK_FAILED =
+ "android.intent.action.REQUEST_NETWORK_FAILED";
}