Merge "Zen: Return of the alarm warning." into lmp-dev
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index edeb5b4..abbaacc 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -2271,6 +2271,22 @@
}
@Override
+ public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) {
+ if (mOutsetBottom != null) {
+ final DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
+ int bottom = (int) mOutsetBottom.getDimension(metrics);
+ WindowInsets newInsets = insets.replaceSystemWindowInsets(
+ insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(),
+ insets.getSystemWindowInsetRight(),
+ insets.getSystemWindowInsetBottom() + bottom);
+ return super.dispatchApplyWindowInsets(newInsets);
+ } else {
+ return super.dispatchApplyWindowInsets(insets);
+ }
+ }
+
+
+ @Override
public boolean onTouchEvent(MotionEvent event) {
return onInterceptTouchEvent(event);
}
diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java
index 65cb6c9..09cf392 100644
--- a/services/core/java/com/android/server/pm/LauncherAppsService.java
+++ b/services/core/java/com/android/server/pm/LauncherAppsService.java
@@ -269,13 +269,39 @@
Intent launchIntent = new Intent(Intent.ACTION_MAIN);
launchIntent.addCategory(Intent.CATEGORY_LAUNCHER);
- launchIntent.setComponent(component);
launchIntent.setSourceBounds(sourceBounds);
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ launchIntent.setPackage(component.getPackageName());
long ident = Binder.clearCallingIdentity();
try {
- mContext.startActivityAsUser(launchIntent, opts, user);
+ IPackageManager pm = AppGlobals.getPackageManager();
+ ActivityInfo info = pm.getActivityInfo(component, 0, user.getIdentifier());
+ if (!info.exported) {
+ throw new SecurityException("Cannot launch non-exported components "
+ + component);
+ }
+
+ // Check that the component actually has Intent.CATEGORY_LAUCNCHER
+ // as calling startActivityAsUser ignores the category and just
+ // resolves based on the component if present.
+ List<ResolveInfo> apps = mPm.queryIntentActivitiesAsUser(launchIntent,
+ PackageManager.NO_CROSS_PROFILE, // We only want the apps for this user
+ user.getIdentifier());
+ final int size = apps.size();
+ for (int i = 0; i < size; ++i) {
+ ActivityInfo activityInfo = apps.get(i).activityInfo;
+ if (activityInfo.packageName.equals(component.getPackageName()) &&
+ activityInfo.name.equals(component.getClassName())) {
+ // Found an activity with category launcher that matches
+ // this component so ok to launch.
+ launchIntent.setComponent(component);
+ mContext.startActivityAsUser(launchIntent, opts, user);
+ return;
+ }
+ }
+ throw new SecurityException("Attempt to launch activity without "
+ + " category Intent.CATEGORY_LAUNCHER " + component);
} finally {
Binder.restoreCallingIdentity(ident);
}
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index a3fd1df..e16894e 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -3171,25 +3171,34 @@
file.delete();
file = getUserPackagesStateBackupFile(userId);
file.delete();
- removeCrossProfileIntentFiltersToUserLPr(userId);
+ removeCrossProfileIntentFiltersLPw(userId);
removeCrossProfilePackagesLPw(userId);
}
- void removeCrossProfileIntentFiltersToUserLPr(int targetUserId) {
- for (int i = 0; i < mCrossProfileIntentResolvers.size(); i++) {
- int sourceUserId = mCrossProfileIntentResolvers.keyAt(i);
- CrossProfileIntentResolver cpir = mCrossProfileIntentResolvers.get(sourceUserId);
- boolean needsWriting = false;
- HashSet<CrossProfileIntentFilter> cpifs =
- new HashSet<CrossProfileIntentFilter>(cpir.filterSet());
- for (CrossProfileIntentFilter cpif : cpifs) {
- if (cpif.getTargetUserId() == targetUserId) {
- needsWriting = true;
- cpir.removeFilter(cpif);
- }
+ void removeCrossProfileIntentFiltersLPw(int userId) {
+ synchronized (mCrossProfileIntentResolvers) {
+ // userId is the source user
+ if (mCrossProfileIntentResolvers.get(userId) != null) {
+ mCrossProfileIntentResolvers.remove(userId);
+ writePackageRestrictionsLPr(userId);
}
- if (needsWriting) {
- writePackageRestrictionsLPr(sourceUserId);
+ // userId is the target user
+ int count = mCrossProfileIntentResolvers.size();
+ for (int i = 0; i < count; i++) {
+ int sourceUserId = mCrossProfileIntentResolvers.keyAt(i);
+ CrossProfileIntentResolver cpir = mCrossProfileIntentResolvers.get(sourceUserId);
+ boolean needsWriting = false;
+ HashSet<CrossProfileIntentFilter> cpifs =
+ new HashSet<CrossProfileIntentFilter>(cpir.filterSet());
+ for (CrossProfileIntentFilter cpif : cpifs) {
+ if (cpif.getTargetUserId() == userId) {
+ needsWriting = true;
+ cpir.removeFilter(cpif);
+ }
+ }
+ if (needsWriting) {
+ writePackageRestrictionsLPr(sourceUserId);
+ }
}
}
}