Merge "Proxy fixes from API review feedback" into lmp-dev
diff --git a/api/current.txt b/api/current.txt
index 2e4dfb8..55a3efa 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5391,8 +5391,8 @@
field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLED = "android.app.action.DEVICE_ADMIN_DISABLED";
field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLE_REQUESTED = "android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED";
field public static final java.lang.String ACTION_DEVICE_ADMIN_ENABLED = "android.app.action.DEVICE_ADMIN_ENABLED";
- field public static final java.lang.String ACTION_LOCK_TASK_ENTERING = "android.app.action.ACTION_LOCK_TASK_ENTERING";
- field public static final java.lang.String ACTION_LOCK_TASK_EXITING = "android.app.action.ACTION_LOCK_TASK_EXITING";
+ field public static final java.lang.String ACTION_LOCK_TASK_ENTERING = "android.app.action.LOCK_TASK_ENTERING";
+ field public static final java.lang.String ACTION_LOCK_TASK_EXITING = "android.app.action.LOCK_TASK_EXITING";
field public static final java.lang.String ACTION_PASSWORD_CHANGED = "android.app.action.ACTION_PASSWORD_CHANGED";
field public static final java.lang.String ACTION_PASSWORD_EXPIRING = "android.app.action.ACTION_PASSWORD_EXPIRING";
field public static final java.lang.String ACTION_PASSWORD_FAILED = "android.app.action.ACTION_PASSWORD_FAILED";
@@ -28889,6 +28889,7 @@
field public static final java.lang.String MMS_CONFIG_ALLOW_ATTACH_AUDIO = "allowAttachAudio";
field public static final java.lang.String MMS_CONFIG_APPEND_TRANSACTION_ID = "enabledTransID";
field public static final java.lang.String MMS_CONFIG_EMAIL_GATEWAY_NUMBER = "emailGatewayNumber";
+ field public static final java.lang.String MMS_CONFIG_GROUP_MMS_ENABLED = "enableGroupMms";
field public static final java.lang.String MMS_CONFIG_HTTP_PARAMS = "httpParams";
field public static final java.lang.String MMS_CONFIG_HTTP_SOCKET_TIMEOUT = "httpSocketTimeout";
field public static final java.lang.String MMS_CONFIG_MAX_IMAGE_HEIGHT = "maxImageHeight";
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 8ab344e..29ef484 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -5410,6 +5410,7 @@
mTranslucentCallback = callback;
mChangeCanvasToTranslucent =
ActivityManagerNative.getDefault().convertToTranslucent(mToken, options);
+ WindowManagerGlobal.getInstance().changeCanvasOpacity(mToken, false);
drawComplete = true;
} catch (RemoteException e) {
// Make callback return as though it timed out.
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index f8dfdd9..5921477 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -21,7 +21,6 @@
import android.annotation.SdkConstant.SdkConstantType;
import android.content.Context;
import android.content.Intent;
-import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -825,6 +824,13 @@
public static final String EXTRA_COMPACT_ACTIONS = "android.compactActions";
/**
+ * {@link #extras} key: the user that built the notification.
+ *
+ * @hide
+ */
+ public static final String EXTRA_ORIGINATING_USERID = "android.originatingUserId";
+
+ /**
* Value for {@link #EXTRA_AS_HEADS_UP} that indicates this notification should not be
* displayed in the heads up space.
*
@@ -1807,12 +1813,10 @@
= "android.rebuild.hudViewActionCount";
/**
- * The ApplicationInfo of the package that created the notification, used to create
- * a context to rebuild the notification via a Builder.
- * @hide
+ * The package name of the context used to create the notification via a Builder.
*/
- private static final String EXTRA_REBUILD_CONTEXT_APPLICATION_INFO =
- "android.rebuild.applicationInfo";
+ private static final String EXTRA_REBUILD_CONTEXT_PACKAGE =
+ "android.rebuild.contextPackage";
// Whether to enable stripping (at post time) & rebuilding (at listener receive time) of
// memory intensive resources.
@@ -1863,6 +1867,11 @@
private int mColor = COLOR_DEFAULT;
/**
+ * The user that built the notification originally.
+ */
+ private int mOriginatingUserId;
+
+ /**
* Contains extras related to rebuilding during the build phase.
*/
private Bundle mRebuildBundle = new Bundle();
@@ -2582,7 +2591,7 @@
// Note: This assumes that the current user can read the profile badge of the
// originating user.
UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
- return userManager.getBadgeForUser(new UserHandle(mContext.getUserId()), 0);
+ return userManager.getBadgeForUser(new UserHandle(mOriginatingUserId), 0);
}
private Bitmap getProfileBadge() {
@@ -2661,7 +2670,8 @@
* @param hasProgress whether the progress bar should be shown and set
*/
private RemoteViews applyStandardTemplate(int resId, boolean hasProgress) {
- RemoteViews contentView = new BuilderRemoteViews(mContext.getApplicationInfo(), resId);
+ RemoteViews contentView = new BuilderRemoteViews(mContext.getPackageName(),
+ mOriginatingUserId, resId);
resetStandardTemplate(contentView);
@@ -3053,8 +3063,8 @@
*/
public void populateExtras(Bundle extras) {
// Store original information used in the construction of this object
- extras.putParcelable(EXTRA_REBUILD_CONTEXT_APPLICATION_INFO,
- mContext.getApplicationInfo());
+ extras.putInt(EXTRA_ORIGINATING_USERID, mOriginatingUserId);
+ extras.putString(EXTRA_REBUILD_CONTEXT_PACKAGE, mContext.getPackageName());
extras.putCharSequence(EXTRA_TITLE, mContentTitle);
extras.putCharSequence(EXTRA_TEXT, mContentText);
extras.putCharSequence(EXTRA_SUB_TEXT, mSubText);
@@ -3142,14 +3152,13 @@
extras.remove(EXTRA_NEEDS_REBUILD);
// Re-create notification context so we can access app resources.
- ApplicationInfo applicationInfo = extras.getParcelable(
- EXTRA_REBUILD_CONTEXT_APPLICATION_INFO);
+ String packageName = extras.getString(EXTRA_REBUILD_CONTEXT_PACKAGE);
Context builderContext;
try {
- builderContext = context.createApplicationContext(applicationInfo,
+ builderContext = context.createPackageContext(packageName,
Context.CONTEXT_RESTRICTED);
} catch (NameNotFoundException e) {
- Log.e(TAG, "ApplicationInfo " + applicationInfo + " not found");
+ Log.e(TAG, "Package name " + packageName + " not found");
builderContext = context; // try with our context
}
@@ -3284,6 +3293,7 @@
// Extras.
Bundle extras = n.extras;
+ mOriginatingUserId = extras.getInt(EXTRA_ORIGINATING_USERID);
mContentTitle = extras.getCharSequence(EXTRA_TITLE);
mContentText = extras.getCharSequence(EXTRA_TEXT);
mSubText = extras.getCharSequence(EXTRA_SUB_TEXT);
@@ -3316,6 +3326,7 @@
* object.
*/
public Notification build() {
+ mOriginatingUserId = mContext.getUserId();
mHasThreeLines = hasThreeLines();
Notification n = buildUnstyled();
@@ -4815,8 +4826,8 @@
super(parcel);
}
- public BuilderRemoteViews(ApplicationInfo appInfo, int layoutId) {
- super(appInfo, layoutId);
+ public BuilderRemoteViews(String packageName, int userId, int layoutId) {
+ super(packageName, userId, layoutId);
}
@Override
diff --git a/core/java/android/app/admin/DeviceAdminReceiver.java b/core/java/android/app/admin/DeviceAdminReceiver.java
index 15def09..e2f175c 100644
--- a/core/java/android/app/admin/DeviceAdminReceiver.java
+++ b/core/java/android/app/admin/DeviceAdminReceiver.java
@@ -177,7 +177,7 @@
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_LOCK_TASK_ENTERING
- = "android.app.action.ACTION_LOCK_TASK_ENTERING";
+ = "android.app.action.LOCK_TASK_ENTERING";
/**
* Action sent to a device administrator to notify that the device is exiting
@@ -190,7 +190,7 @@
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_LOCK_TASK_EXITING
- = "android.app.action.ACTION_LOCK_TASK_EXITING";
+ = "android.app.action.LOCK_TASK_EXITING";
/**
* A boolean describing whether the device is currently entering or exiting
diff --git a/core/java/android/text/format/DateFormat.java b/core/java/android/text/format/DateFormat.java
index 1e411b4..9fec9a1 100755
--- a/core/java/android/text/format/DateFormat.java
+++ b/core/java/android/text/format/DateFormat.java
@@ -17,7 +17,6 @@
package android.text.format;
import android.content.Context;
-import android.os.UserHandle;
import android.provider.Settings;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
@@ -129,14 +128,8 @@
* @return true if 24 hour time format is selected, false otherwise.
*/
public static boolean is24HourFormat(Context context) {
- // This method is called by View classes that can be used by RemoteViews
- // and rendered in another user. The context therefore may reference
- // a user that would require interact accross users to access. So
- // use the user id we are running as.
- // This is the case when we have widgets from a user profile added
- // to the homescreen.
- String value = Settings.System.getStringForUser(context.getContentResolver(),
- Settings.System.TIME_12_24, UserHandle.myUserId());
+ String value = Settings.System.getString(context.getContentResolver(),
+ Settings.System.TIME_12_24);
if (value == null) {
Locale locale = context.getResources().getConfiguration().locale;
@@ -234,14 +227,8 @@
* @return the {@link java.text.DateFormat} object that properly formats the date.
*/
public static java.text.DateFormat getDateFormat(Context context) {
- // This method is called by View classes that can be used by RemoteViews
- // and rendered in another user. The context therefore may reference
- // a user that would require interact accross users to access. So
- // use the user id we are running as.
- // This is the case when we have widgets from a user profile added
- // to the homescreen.
- String value = Settings.System.getStringForUser(context.getContentResolver(),
- Settings.System.DATE_FORMAT, UserHandle.myUserId());
+ String value = Settings.System.getString(context.getContentResolver(),
+ Settings.System.DATE_FORMAT);
return getDateFormatForSetting(context, value);
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index dd1cbc93..4299e2e 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -6111,6 +6111,33 @@
}
}
} break;
+
+
+ case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED: {
+ if (mAccessibilityFocusedHost != null && mAccessibilityFocusedVirtualView != null) {
+ // We care only for changes rooted in the focused host.
+ final long eventSourceId = event.getSourceNodeId();
+ final int hostViewId = AccessibilityNodeInfo.getAccessibilityViewId(
+ eventSourceId);
+ if (hostViewId != mAccessibilityFocusedHost.getAccessibilityViewId()) {
+ break;
+ }
+
+ // We only care about changes that may change the virtual focused view bounds.
+ final int changes = event.getContentChangeTypes();
+ if ((changes & AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE) != 0
+ || changes == AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED) {
+ AccessibilityNodeProvider provider = mAccessibilityFocusedHost
+ .getAccessibilityNodeProvider();
+ if (provider != null) {
+ final int virtualChildId = AccessibilityNodeInfo.getVirtualDescendantId(
+ mAccessibilityFocusedVirtualView.getSourceNodeId());
+ mAccessibilityFocusedVirtualView = provider.createAccessibilityNodeInfo(
+ virtualChildId);
+ }
+ }
+ }
+ } break;
}
mAccessibilityManager.sendAccessibilityEvent(event);
return true;
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index 053fdd0..b7b12a8 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -379,6 +379,10 @@
public static final int LID_CLOSED = 0;
public static final int LID_OPEN = 1;
+ public static final int CAMERA_LENS_COVER_ABSENT = -1;
+ public static final int CAMERA_LENS_UNCOVERED = 0;
+ public static final int CAMERA_LENS_COVERED = 1;
+
/**
* Ask the window manager to re-evaluate the system UI flags.
*/
@@ -399,6 +403,11 @@
public int getLidState();
/**
+ * Returns a code that descripbes whether the camera lens is covered or not.
+ */
+ public int getCameraLensCoverState();
+
+ /**
* Switch the keyboard layout for the given device.
* Direction should be +1 or -1 to go to the next or previous keyboard layout.
*/
@@ -951,7 +960,14 @@
* @param lidOpen True if the lid is now open.
*/
public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen);
-
+
+ /**
+ * Tell the policy that the camera lens has been covered or uncovered.
+ * @param whenNanos The time when the change occurred in uptime nanoseconds.
+ * @param lensCovered True if the lens is covered.
+ */
+ public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered);
+
/**
* Tell the policy if anyone is requesting that keyguard not come on.
*
diff --git a/core/java/android/widget/DateTimeView.java b/core/java/android/widget/DateTimeView.java
index b3ff88b..45d1403 100644
--- a/core/java/android/widget/DateTimeView.java
+++ b/core/java/android/widget/DateTimeView.java
@@ -29,7 +29,6 @@
import android.provider.Settings;
import android.widget.TextView;
import android.widget.RemoteViews.RemoteView;
-import android.os.UserHandle;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@@ -191,15 +190,8 @@
}
private DateFormat getDateFormat() {
- // OK, this is gross but needed. This class is supported by the
- // remote views mechanism and as a part of that the remote views
- // can be inflated by a context for another user without the app
- // having interact users permission - just for loading resources.
- // For example, when adding widgets from a user profile to the
- // home screen. Therefore, we access settings as the user the app
- // is running as not the one the context is for.
- String format = Settings.System.getStringForUser(getContext().getContentResolver(),
- Settings.System.DATE_FORMAT, UserHandle.myUserId());
+ String format = Settings.System.getString(getContext().getContentResolver(),
+ Settings.System.DATE_FORMAT);
if (format == null || "".equals(format)) {
return DateFormat.getDateInstance(DateFormat.SHORT);
} else {
@@ -220,20 +212,10 @@
filter.addAction(Intent.ACTION_TIME_CHANGED);
filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
-
- // OK, this is gross but needed. This class is supported by the
- // remote views mechanism and as a part of that the remote views
- // can be inflated by a context for another user without the app
- // having interact users permission - just for loading resources.
- // For example, when adding widgets from a user profile to the
- // home screen. Therefore, we register the receiver and content
- // observer as the user the app is running as not the one the context is for.
- context.registerReceiverAsUser(mBroadcastReceiver, android.os.Process.myUserHandle(),
- filter, null, null);
+ context.registerReceiver(mBroadcastReceiver, filter);
Uri uri = Settings.System.getUriFor(Settings.System.DATE_FORMAT);
- context.getContentResolver().registerContentObserver(uri, true, mContentObserver,
- UserHandle.myUserId());
+ context.getContentResolver().registerContentObserver(uri, true, mContentObserver);
}
private void unregisterReceivers() {
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 9de69f2..69d5f40 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -1653,10 +1653,8 @@
*
* @param application The application whose content is shown by the views.
* @param layoutId The id of the layout resource.
- *
- * @hide
*/
- protected RemoteViews(ApplicationInfo application, int layoutId) {
+ private RemoteViews(ApplicationInfo application, int layoutId) {
mApplication = application;
mLayoutId = layoutId;
mBitmapCache = new BitmapCache();
diff --git a/core/java/android/widget/TextClock.java b/core/java/android/widget/TextClock.java
index acfc543..4c5c71d 100644
--- a/core/java/android/widget/TextClock.java
+++ b/core/java/android/widget/TextClock.java
@@ -26,7 +26,6 @@
import android.net.Uri;
import android.os.Handler;
import android.os.SystemClock;
-import android.os.UserHandle;
import android.provider.Settings;
import android.text.format.DateFormat;
import android.util.AttributeSet;
@@ -496,28 +495,12 @@
filter.addAction(Intent.ACTION_TIME_CHANGED);
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
- // OK, this is gross but needed. This class is supported by the
- // remote views mechanism and as a part of that the remote views
- // can be inflated by a context for another user without the app
- // having interact users permission - just for loading resources.
- // For example, when adding widgets from a user profile to the
- // home screen. Therefore, we register the receiver as the user
- // the app is running as not the one the context is for.
- getContext().registerReceiverAsUser(mIntentReceiver, android.os.Process.myUserHandle(),
- filter, null, getHandler());
+ getContext().registerReceiver(mIntentReceiver, filter, null, getHandler());
}
private void registerObserver() {
final ContentResolver resolver = getContext().getContentResolver();
- // OK, this is gross but needed. This class is supported by the
- // remote views mechanism and as a part of that the remote views
- // can be inflated by a context for another user without the app
- // having interact users permission - just for loading resources.
- // For example, when adding widgets from a user profile to the
- // home screen. Therefore, we register the content observer
- // as the user the app is running as not the one the context is for.
- resolver.registerContentObserver(Settings.System.CONTENT_URI, true,
- mFormatChangeObserver, UserHandle.myUserId());
+ resolver.registerContentObserver(Settings.System.CONTENT_URI, true, mFormatChangeObserver);
}
private void unregisterReceiver() {
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 188a3e9..3e1b674 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -41,7 +41,6 @@
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
-import android.os.UserHandle;
import android.provider.Settings;
import android.text.BoringLayout;
import android.text.DynamicLayout;
@@ -8338,15 +8337,8 @@
* to speak passwords.
*/
private boolean shouldSpeakPasswordsForAccessibility() {
- // OK, this is gross but needed. This class is supported by the
- // remote views mechanism and as a part of that the remote views
- // can be inflated by a context for another user without the app
- // having interact users permission - just for loading resources.
- // For example, when adding widgets from a user profile to the
- // home screen. Therefore, we access settings as user the app is
- // running as not the one the context is for.
- return (Settings.Secure.getIntForUser(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0, UserHandle.myUserId()) == 1);
+ return (Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0) == 1);
}
@Override
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 81a838a..f39727a 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -2890,7 +2890,6 @@
invalidate();
int opacity = PixelFormat.OPAQUE;
-
// Note: if there is no background, we will assume opaque. The
// common case seems to be that an application sets there to be
// no background so it can draw everything itself. For that,
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index e382a9f..e8dc800 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -66,6 +66,7 @@
import android.os.UEventObserver;
import android.os.UserHandle;
import android.os.Vibrator;
+import android.provider.MediaStore;
import android.provider.Settings;
import android.service.dreams.DreamManagerInternal;
import android.service.dreams.DreamService;
@@ -127,6 +128,9 @@
import static android.view.WindowManagerPolicy.WindowManagerFuncs.LID_ABSENT;
import static android.view.WindowManagerPolicy.WindowManagerFuncs.LID_OPEN;
import static android.view.WindowManagerPolicy.WindowManagerFuncs.LID_CLOSED;
+import static android.view.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_COVER_ABSENT;
+import static android.view.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_UNCOVERED;
+import static android.view.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_COVERED;
/**
* WindowManagerPolicy implementation for the Android phone UI. This
@@ -315,6 +319,7 @@
boolean mLanguageSwitchKeyPressed;
int mLidState = LID_ABSENT;
+ int mCameraLensCoverState = CAMERA_LENS_COVER_ABSENT;
boolean mHaveBuiltInKeyboard;
boolean mSystemReady;
@@ -1525,6 +1530,10 @@
mLidState = mWindowManagerFuncs.getLidState();
}
+ private void readCameraLensCoverState() {
+ mCameraLensCoverState = mWindowManagerFuncs.getCameraLensCoverState();
+ }
+
private boolean isHidden(int accessibilityMode) {
switch (accessibilityMode) {
case 1:
@@ -4055,6 +4064,27 @@
}
}
+ @Override
+ public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered) {
+ int lensCoverState = lensCovered ? CAMERA_LENS_COVERED : CAMERA_LENS_UNCOVERED;
+ if (mCameraLensCoverState == lensCoverState) {
+ return;
+ }
+ if (mCameraLensCoverState == CAMERA_LENS_COVERED &&
+ lensCoverState == CAMERA_LENS_UNCOVERED) {
+ Intent intent;
+ final boolean keyguardActive = mKeyguardDelegate == null ? false :
+ mKeyguardDelegate.isShowing();
+ if (keyguardActive) {
+ intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE);
+ } else {
+ intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
+ }
+ mContext.startActivityAsUser(intent, UserHandle.CURRENT_OR_SELF);
+ }
+ mCameraLensCoverState = lensCoverState;
+ }
+
void setHdmiPlugged(boolean plugged) {
if (mHdmiPlugged != plugged) {
mHdmiPlugged = plugged;
@@ -5132,6 +5162,7 @@
mKeyguardDelegate = new KeyguardServiceDelegate(mContext, null);
mKeyguardDelegate.onSystemReady();
+ readCameraLensCoverState();
updateUiMode();
synchronized (mLock) {
updateOrientationListenerLp();
@@ -5783,6 +5814,7 @@
pw.print(" mSystemBooted="); pw.println(mSystemBooted);
pw.print(prefix); pw.print("mLidState="); pw.print(mLidState);
pw.print(" mLidOpenRotation="); pw.print(mLidOpenRotation);
+ pw.print(" mCameraLensCoverState="); pw.print(mCameraLensCoverState);
pw.print(" mHdmiPlugged="); pw.println(mHdmiPlugged);
if (mLastSystemUiFlags != 0 || mResettingSystemUiFlags != 0
|| mForceClearedSystemUiFlags != 0) {
diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
index 7f7e5c3..2ef806f 100644
--- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
+++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
@@ -1863,7 +1863,7 @@
private void deleteProviderLocked(Provider provider) {
int N = provider.widgets.size();
- for (int i = 0; i < N; i++) {
+ for (int i = N - 1; i >= 0; i--) {
Widget widget = provider.widgets.remove(i);
// Call back with empty RemoteViews
updateAppWidgetInstanceLocked(widget, null, false);
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 2e9df8a..b116d76 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -10346,8 +10346,8 @@
final boolean translucentChanged = r.changeWindowTranslucency(false);
if (translucentChanged) {
r.task.stack.convertToTranslucent(r);
- mStackSupervisor.ensureActivitiesVisibleLocked(null, 0);
}
+ mStackSupervisor.ensureActivitiesVisibleLocked(null, 0);
mWindowManager.setAppFullscreen(token, false);
return translucentChanged;
}
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index 93dceff..9e81149 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -241,6 +241,9 @@
/** Switch code: Headphone/Microphone Jack. When set, something is inserted. */
public static final int SW_JACK_PHYSICAL_INSERT = 0x07;
+ /** Switch code: Camera lens cover. When set the lens is covered. */
+ public static final int SW_CAMERA_LENS_COVER = 0x09;
+
public static final int SW_LID_BIT = 1 << SW_LID;
public static final int SW_KEYPAD_SLIDE_BIT = 1 << SW_KEYPAD_SLIDE;
public static final int SW_HEADPHONE_INSERT_BIT = 1 << SW_HEADPHONE_INSERT;
@@ -249,6 +252,7 @@
public static final int SW_JACK_PHYSICAL_INSERT_BIT = 1 << SW_JACK_PHYSICAL_INSERT;
public static final int SW_JACK_BITS =
SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_JACK_PHYSICAL_INSERT_BIT | SW_LINEOUT_INSERT_BIT;
+ public static final int SW_CAMERA_LENS_COVER_BIT = 1 << SW_CAMERA_LENS_COVER;
/** Whether to use the dev/input/event or uevent subsystem for the audio jack. */
final boolean mUseDevInputEventForAudioJack;
@@ -1380,6 +1384,11 @@
mWindowManagerCallbacks.notifyLidSwitchChanged(whenNanos, lidOpen);
}
+ if ((switchMask & SW_CAMERA_LENS_COVER_BIT) != 0) {
+ final boolean lensCovered = ((switchValues & SW_CAMERA_LENS_COVER_BIT) == 0);
+ mWindowManagerCallbacks.notifyCameraLensCoverSwitchChanged(whenNanos, lensCovered);
+ }
+
if (mUseDevInputEventForAudioJack && (switchMask & SW_JACK_BITS) != 0) {
mWiredAccessoryCallbacks.notifyWiredAccessoryChanged(whenNanos, switchValues,
switchMask);
@@ -1575,6 +1584,8 @@
public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen);
+ public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered);
+
public void notifyInputChannelBroken(InputWindowHandle inputWindowHandle);
public long notifyANR(InputApplicationHandle inputApplicationHandle,
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 228c120..846efc0 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -10245,8 +10245,18 @@
if (bp != null) {
// If the defining package is signed with our cert, it's okay. This
// also includes the "updating the same package" case, of course.
- if (compareSignatures(bp.packageSetting.signatures.mSignatures,
- pkg.mSignatures) != PackageManager.SIGNATURE_MATCH) {
+ // "updating same package" could also involve key-rotation.
+ final boolean sigsOk;
+ if (!bp.sourcePackage.equals(pkg.packageName)
+ || !(bp.packageSetting instanceof PackageSetting)
+ || !bp.packageSetting.keySetData.isUsingUpgradeKeySets()
+ || ((PackageSetting) bp.packageSetting).sharedUser != null) {
+ sigsOk = compareSignatures(bp.packageSetting.signatures.mSignatures,
+ pkg.mSignatures) != PackageManager.SIGNATURE_MATCH;
+ } else {
+ sigsOk = checkUpgradeKeySetLP((PackageSetting) bp.packageSetting, pkg);
+ }
+ if (!sigsOk) {
// If the owning package is the system itself, we log but allow
// install to proceed; we fail the install on all other permission
// redefinitions.
diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java
index f02c0e6..d0f00d4 100644
--- a/services/core/java/com/android/server/wm/InputMonitor.java
+++ b/services/core/java/com/android/server/wm/InputMonitor.java
@@ -352,6 +352,12 @@
mService.mPolicy.notifyLidSwitchChanged(whenNanos, lidOpen);
}
+ /* Notifies that the camera lens cover state has changed. */
+ @Override
+ public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered) {
+ mService.mPolicy.notifyCameraLensCoverSwitchChanged(whenNanos, lensCovered);
+ }
+
/* Provides an opportunity for the window manager policy to intercept early key
* processing as soon as the key has been read from the device. */
@Override
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 08343d8..a1afe29 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -5432,6 +5432,23 @@
}
}
+ // Called by window manager policy. Not exposed externally.
+ @Override
+ public int getCameraLensCoverState() {
+ int sw = mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY,
+ InputManagerService.SW_CAMERA_LENS_COVER);
+ if (sw > 0) {
+ // Switch state: AKEY_STATE_DOWN or AKEY_STATE_VIRTUAL.
+ return CAMERA_LENS_COVERED;
+ } else if (sw == 0) {
+ // Switch state: AKEY_STATE_UP.
+ return CAMERA_LENS_UNCOVERED;
+ } else {
+ // Switch state: AKEY_STATE_UNKNOWN.
+ return CAMERA_LENS_COVER_ABSENT;
+ }
+ }
+
// Called by window manager policy. Not exposed externally.
@Override
public void switchKeyboardLayout(int deviceId, int direction) {
diff --git a/telecomm/java/android/telecomm/Log.java b/telecomm/java/android/telecomm/Log.java
index b8dfb11..446ae75 100644
--- a/telecomm/java/android/telecomm/Log.java
+++ b/telecomm/java/android/telecomm/Log.java
@@ -31,7 +31,7 @@
// Generic tag for all Telecomm Framework logging
private static final String TAG = "TelecommFramework";
- public static final boolean FORCE_LOGGING = true; /* STOP SHIP if true */
+ public static final boolean FORCE_LOGGING = false; /* STOP SHIP if true */
public static final boolean DEBUG = isLoggable(android.util.Log.DEBUG);
public static final boolean INFO = isLoggable(android.util.Log.INFO);
public static final boolean VERBOSE = isLoggable(android.util.Log.VERBOSE);
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index acb97a0..8af5e98 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -164,14 +164,6 @@
return uri.getSchemeSpecificPart();
}
- // TODO: We don't check for SecurityException here (requires
- // CALL_PRIVILEGED permission).
- if (scheme.equals("voicemail")) {
- long subId = intent.getLongExtra(SUBSCRIPTION_KEY,
- SubscriptionManager.getDefaultVoiceSubId());
- return TelephonyManager.getDefault().getCompleteVoiceMailNumber(subId);
- }
-
if (context == null) {
return null;
}