Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

frameworks-base: Commit

frameworks/base


Commit MetaInfo

Révision08f7df6c569648c35c739727c7e84a929f389183 (tree)
l'heure2018-12-21 17:57:42
AuteurChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Message de Log

Android 8.1.0 release 53
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCXAVsoQAKCRDorT+BmrEO
eBJkAJ9JZYexnmJnDVQlsx7QzjYEb/7b+QCfch4S6GWIsg1USRnxqRkBkhZ0jWw=
=ZDl6
-----END PGP SIGNATURE-----

Merge tag 'android-8.1.0_r53' into oreo-x86

Android 8.1.0 release 53

Change Summary

Modification

--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -54,6 +54,7 @@ import java.io.IOException;
5454 import java.io.PrintWriter;
5555 import java.util.ArrayList;
5656 import java.util.Arrays;
57+import java.util.Objects;
5758
5859 /**
5960 * Content providers are one of the primary building blocks of Android applications, providing
@@ -208,7 +209,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
208209 @Override
209210 public Cursor query(String callingPkg, Uri uri, @Nullable String[] projection,
210211 @Nullable Bundle queryArgs, @Nullable ICancellationSignal cancellationSignal) {
211- validateIncomingUri(uri);
212+ uri = validateIncomingUri(uri);
212213 uri = maybeGetUriWithoutUserId(uri);
213214 if (enforceReadPermission(callingPkg, uri, null) != AppOpsManager.MODE_ALLOWED) {
214215 // The caller has no access to the data, so return an empty cursor with
@@ -247,14 +248,14 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
247248
248249 @Override
249250 public String getType(Uri uri) {
250- validateIncomingUri(uri);
251+ uri = validateIncomingUri(uri);
251252 uri = maybeGetUriWithoutUserId(uri);
252253 return ContentProvider.this.getType(uri);
253254 }
254255
255256 @Override
256257 public Uri insert(String callingPkg, Uri uri, ContentValues initialValues) {
257- validateIncomingUri(uri);
258+ uri = validateIncomingUri(uri);
258259 int userId = getUserIdFromUri(uri);
259260 uri = maybeGetUriWithoutUserId(uri);
260261 if (enforceWritePermission(callingPkg, uri, null) != AppOpsManager.MODE_ALLOWED) {
@@ -270,7 +271,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
270271
271272 @Override
272273 public int bulkInsert(String callingPkg, Uri uri, ContentValues[] initialValues) {
273- validateIncomingUri(uri);
274+ uri = validateIncomingUri(uri);
274275 uri = maybeGetUriWithoutUserId(uri);
275276 if (enforceWritePermission(callingPkg, uri, null) != AppOpsManager.MODE_ALLOWED) {
276277 return 0;
@@ -292,11 +293,12 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
292293 for (int i = 0; i < numOperations; i++) {
293294 ContentProviderOperation operation = operations.get(i);
294295 Uri uri = operation.getUri();
295- validateIncomingUri(uri);
296296 userIds[i] = getUserIdFromUri(uri);
297- if (userIds[i] != UserHandle.USER_CURRENT) {
298- // Removing the user id from the uri.
299- operation = new ContentProviderOperation(operation, true);
297+ uri = validateIncomingUri(uri);
298+ uri = maybeGetUriWithoutUserId(uri);
299+ // Rebuild operation if we changed the Uri above
300+ if (!Objects.equals(operation.getUri(), uri)) {
301+ operation = new ContentProviderOperation(operation, uri);
300302 operations.set(i, operation);
301303 }
302304 if (operation.isReadOperation()) {
@@ -331,7 +333,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
331333
332334 @Override
333335 public int delete(String callingPkg, Uri uri, String selection, String[] selectionArgs) {
334- validateIncomingUri(uri);
336+ uri = validateIncomingUri(uri);
335337 uri = maybeGetUriWithoutUserId(uri);
336338 if (enforceWritePermission(callingPkg, uri, null) != AppOpsManager.MODE_ALLOWED) {
337339 return 0;
@@ -347,7 +349,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
347349 @Override
348350 public int update(String callingPkg, Uri uri, ContentValues values, String selection,
349351 String[] selectionArgs) {
350- validateIncomingUri(uri);
352+ uri = validateIncomingUri(uri);
351353 uri = maybeGetUriWithoutUserId(uri);
352354 if (enforceWritePermission(callingPkg, uri, null) != AppOpsManager.MODE_ALLOWED) {
353355 return 0;
@@ -364,7 +366,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
364366 public ParcelFileDescriptor openFile(
365367 String callingPkg, Uri uri, String mode, ICancellationSignal cancellationSignal,
366368 IBinder callerToken) throws FileNotFoundException {
367- validateIncomingUri(uri);
369+ uri = validateIncomingUri(uri);
368370 uri = maybeGetUriWithoutUserId(uri);
369371 enforceFilePermission(callingPkg, uri, mode, callerToken);
370372 final String original = setCallingPackage(callingPkg);
@@ -380,7 +382,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
380382 public AssetFileDescriptor openAssetFile(
381383 String callingPkg, Uri uri, String mode, ICancellationSignal cancellationSignal)
382384 throws FileNotFoundException {
383- validateIncomingUri(uri);
385+ uri = validateIncomingUri(uri);
384386 uri = maybeGetUriWithoutUserId(uri);
385387 enforceFilePermission(callingPkg, uri, mode, null);
386388 final String original = setCallingPackage(callingPkg);
@@ -406,7 +408,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
406408
407409 @Override
408410 public String[] getStreamTypes(Uri uri, String mimeTypeFilter) {
409- validateIncomingUri(uri);
411+ uri = validateIncomingUri(uri);
410412 uri = maybeGetUriWithoutUserId(uri);
411413 return ContentProvider.this.getStreamTypes(uri, mimeTypeFilter);
412414 }
@@ -415,7 +417,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
415417 public AssetFileDescriptor openTypedAssetFile(String callingPkg, Uri uri, String mimeType,
416418 Bundle opts, ICancellationSignal cancellationSignal) throws FileNotFoundException {
417419 Bundle.setDefusable(opts, true);
418- validateIncomingUri(uri);
420+ uri = validateIncomingUri(uri);
419421 uri = maybeGetUriWithoutUserId(uri);
420422 enforceFilePermission(callingPkg, uri, "r", null);
421423 final String original = setCallingPackage(callingPkg);
@@ -434,7 +436,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
434436
435437 @Override
436438 public Uri canonicalize(String callingPkg, Uri uri) {
437- validateIncomingUri(uri);
439+ uri = validateIncomingUri(uri);
438440 int userId = getUserIdFromUri(uri);
439441 uri = getUriWithoutUserId(uri);
440442 if (enforceReadPermission(callingPkg, uri, null) != AppOpsManager.MODE_ALLOWED) {
@@ -450,7 +452,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
450452
451453 @Override
452454 public Uri uncanonicalize(String callingPkg, Uri uri) {
453- validateIncomingUri(uri);
455+ uri = validateIncomingUri(uri);
454456 int userId = getUserIdFromUri(uri);
455457 uri = getUriWithoutUserId(uri);
456458 if (enforceReadPermission(callingPkg, uri, null) != AppOpsManager.MODE_ALLOWED) {
@@ -467,7 +469,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
467469 @Override
468470 public boolean refresh(String callingPkg, Uri uri, Bundle args,
469471 ICancellationSignal cancellationSignal) throws RemoteException {
470- validateIncomingUri(uri);
472+ uri = validateIncomingUri(uri);
471473 uri = getUriWithoutUserId(uri);
472474 if (enforceReadPermission(callingPkg, uri, null) != AppOpsManager.MODE_ALLOWED) {
473475 return false;
@@ -1901,7 +1903,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
19011903 */
19021904 if (mContext == null) {
19031905 mContext = context;
1904- if (context != null) {
1906+ if (context != null && mTransport != null) {
19051907 mTransport.mAppOpsManager = (AppOpsManager) context.getSystemService(
19061908 Context.APP_OPS_SERVICE);
19071909 }
@@ -2010,7 +2012,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
20102012 }
20112013
20122014 /** @hide */
2013- private void validateIncomingUri(Uri uri) throws SecurityException {
2015+ public Uri validateIncomingUri(Uri uri) throws SecurityException {
20142016 String auth = uri.getAuthority();
20152017 if (!mSingleUser) {
20162018 int userId = getUserIdFromAuthority(auth, UserHandle.USER_CURRENT);
@@ -2029,6 +2031,19 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
20292031 }
20302032 throw new SecurityException(message);
20312033 }
2034+
2035+ // Normalize the path by removing any empty path segments, which can be
2036+ // a source of security issues.
2037+ final String encodedPath = uri.getEncodedPath();
2038+ if (encodedPath != null && encodedPath.indexOf("//") != -1) {
2039+ final Uri normalized = uri.buildUpon()
2040+ .encodedPath(encodedPath.replaceAll("//+", "/")).build();
2041+ Log.w(TAG, "Normalized " + uri + " to " + normalized
2042+ + " to avoid possible security issues");
2043+ return normalized;
2044+ } else {
2045+ return uri;
2046+ }
20322047 }
20332048
20342049 /** @hide */
--- a/core/java/android/content/ContentProviderOperation.java
+++ b/core/java/android/content/ContentProviderOperation.java
@@ -94,13 +94,9 @@ public class ContentProviderOperation implements Parcelable {
9494 }
9595
9696 /** @hide */
97- public ContentProviderOperation(ContentProviderOperation cpo, boolean removeUserIdFromUri) {
97+ public ContentProviderOperation(ContentProviderOperation cpo, Uri withUri) {
9898 mType = cpo.mType;
99- if (removeUserIdFromUri) {
100- mUri = ContentProvider.getUriWithoutUserId(cpo.mUri);
101- } else {
102- mUri = cpo.mUri;
103- }
99+ mUri = withUri;
104100 mValues = cpo.mValues;
105101 mSelection = cpo.mSelection;
106102 mSelectionArgs = cpo.mSelectionArgs;
@@ -110,14 +106,6 @@ public class ContentProviderOperation implements Parcelable {
110106 mYieldAllowed = cpo.mYieldAllowed;
111107 }
112108
113- /** @hide */
114- public ContentProviderOperation getWithoutUserIdInUri() {
115- if (ContentProvider.uriHasUserId(mUri)) {
116- return new ContentProviderOperation(this, true);
117- }
118- return this;
119- }
120-
121109 public void writeToParcel(Parcel dest, int flags) {
122110 dest.writeInt(mType);
123111 Uri.writeToParcel(dest, mUri);
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -806,11 +806,19 @@ public final class Parcel {
806806 return;
807807 }
808808 Set<Map.Entry<String,Object>> entries = val.entrySet();
809- writeInt(entries.size());
809+ int size = entries.size();
810+ writeInt(size);
811+
810812 for (Map.Entry<String,Object> e : entries) {
811813 writeValue(e.getKey());
812814 writeValue(e.getValue());
815+ size--;
813816 }
817+
818+ if (size != 0) {
819+ throw new BadParcelableException("Map size does not match number of entries!");
820+ }
821+
814822 }
815823
816824 /**
--- a/core/res/res/values-mcc302-mnc220/config.xml
+++ b/core/res/res/values-mcc302-mnc220/config.xml
@@ -40,7 +40,7 @@
4040 <item>SUPL_PORT=7275</item>
4141 <item>SUPL_VER=0x20000</item>
4242 <item>SUPL_MODE=1</item>
43- <item>SUPL_ES=0</item>
43+ <item>SUPL_ES=1</item>
4444 <item>LPP_PROFILE=3</item>
4545 <item>USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=1</item>
4646 <item>A_GLONASS_POS_PROTOCOL_SELECT=0</item>
--- a/core/res/res/values-mcc302-mnc221/config.xml
+++ b/core/res/res/values-mcc302-mnc221/config.xml
@@ -38,7 +38,7 @@
3838 <item>SUPL_PORT=7275</item>
3939 <item>SUPL_VER=0x20000</item>
4040 <item>SUPL_MODE=1</item>
41- <item>SUPL_ES=0</item>
41+ <item>SUPL_ES=1</item>
4242 <item>LPP_PROFILE=3</item>
4343 <item>USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=1</item>
4444 <item>A_GLONASS_POS_PROTOCOL_SELECT=0</item>
--- a/core/res/res/values-mcc302-mnc370/config.xml
+++ b/core/res/res/values-mcc302-mnc370/config.xml
@@ -41,7 +41,7 @@
4141 <item>SUPL_PORT=7275</item>
4242 <item>SUPL_VER=0x20000</item>
4343 <item>SUPL_MODE=1</item>
44- <item>SUPL_ES=0</item>
44+ <item>SUPL_ES=1</item>
4545 <item>LPP_PROFILE=2</item>
4646 <item>USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=1</item>
4747 <item>A_GLONASS_POS_PROTOCOL_SELECT=0</item>
--- a/core/res/res/values-mcc302-mnc610/config.xml
+++ b/core/res/res/values-mcc302-mnc610/config.xml
@@ -28,7 +28,7 @@
2828 <item>SUPL_PORT=7275</item>
2929 <item>SUPL_VER=0x20000</item>
3030 <item>SUPL_MODE=1</item>
31- <item>SUPL_ES=0</item>
31+ <item>SUPL_ES=1</item>
3232 <item>LPP_PROFILE=2</item>
3333 <item>USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=1</item>
3434 <item>A_GLONASS_POS_PROTOCOL_SELECT=0</item>
--- a/core/res/res/values-mcc302-mnc640/config.xml
+++ b/core/res/res/values-mcc302-mnc640/config.xml
@@ -24,7 +24,7 @@
2424 <item>SUPL_PORT=7275</item>
2525 <item>SUPL_VER=0x20000</item>
2626 <item>SUPL_MODE=1</item>
27- <item>SUPL_ES=0</item>
27+ <item>SUPL_ES=1</item>
2828 <item>LPP_PROFILE=2</item>
2929 <item>USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=1</item>
3030 <item>A_GLONASS_POS_PROTOCOL_SELECT=0</item>
--- a/core/res/res/values-mcc302-mnc720/config.xml
+++ b/core/res/res/values-mcc302-mnc720/config.xml
@@ -43,7 +43,7 @@
4343 <item>SUPL_PORT=7275</item>
4444 <item>SUPL_VER=0x20000</item>
4545 <item>SUPL_MODE=1</item>
46- <item>SUPL_ES=0</item>
46+ <item>SUPL_ES=1</item>
4747 <item>LPP_PROFILE=2</item>
4848 <item>USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=1</item>
4949 <item>A_GLONASS_POS_PROTOCOL_SELECT=0</item>
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2497,7 +2497,7 @@
24972497 <item>SUPL_PORT=7275</item>
24982498 <item>SUPL_VER=0x20000</item>
24992499 <item>SUPL_MODE=1</item>
2500- <item>SUPL_ES=0</item>
2500+ <item>SUPL_ES=1</item>
25012501 <item>LPP_PROFILE=0</item>
25022502 <item>USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=1</item>
25032503 <item>A_GLONASS_POS_PROTOCOL_SELECT=0</item>
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -199,6 +199,9 @@
199199 <!-- to change themes - light or dark -->
200200 <uses-permission android:name="android.permission.CHANGE_OVERLAY_PACKAGES" />
201201
202+ <!-- permission necessary to hide non-system overlay windows from covering up the SystemUI -->
203+ <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS" />
204+
202205 <application
203206 android:name=".SystemUIApplication"
204207 android:persistent="true"
--- a/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java
@@ -16,6 +16,8 @@
1616
1717 package com.android.systemui.media;
1818
19+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
20+
1921 import android.app.Activity;
2022 import android.app.AlertDialog;
2123 import android.content.DialogInterface;
@@ -36,6 +38,7 @@ import android.text.TextPaint;
3638 import android.text.TextUtils;
3739 import android.text.style.StyleSpan;
3840 import android.util.Log;
41+import android.view.Window;
3942 import android.view.WindowManager;
4043 import android.widget.CheckBox;
4144 import android.widget.CompoundButton;
@@ -146,7 +149,9 @@ public class MediaProjectionPermissionActivity extends Activity
146149 mDialog.getButton(DialogInterface.BUTTON_POSITIVE).setFilterTouchesWhenObscured(true);
147150
148151 ((CheckBox) mDialog.findViewById(R.id.remember)).setOnCheckedChangeListener(this);
149- mDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
152+ final Window w = mDialog.getWindow();
153+ w.setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
154+ w.addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
150155
151156 mDialog.show();
152157 }
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -49,6 +49,7 @@ import static android.view.WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHA
4949 import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
5050 import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
5151 import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
52+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
5253 import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
5354 import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
5455 import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
@@ -1984,6 +1985,11 @@ public class WindowManagerService extends IWindowManager.Stub
19841985 // No move or resize, but the controller checks for title changes as well
19851986 mAccessibilityController.onSomeWindowResizedOrMovedLocked();
19861987 }
1988+
1989+ if ((flagChanges & PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS) != 0) {
1990+ updateNonSystemOverlayWindowsVisibilityIfNeeded(
1991+ win, win.mWinAnimator.getShown());
1992+ }
19871993 }
19881994
19891995 if (DEBUG_LAYOUT) Slog.v(TAG_WM, "Relayout " + win + ": viewVisibility=" + viewVisibility
@@ -7691,7 +7697,8 @@ public class WindowManagerService extends IWindowManager.Stub
76917697 }
76927698
76937699 void updateNonSystemOverlayWindowsVisibilityIfNeeded(WindowState win, boolean surfaceShown) {
7694- if (!win.hideNonSystemOverlayWindowsWhenVisible()) {
7700+ if (!win.hideNonSystemOverlayWindowsWhenVisible()
7701+ && !mHidingNonSystemOverlayWindows.contains(win)) {
76957702 return;
76967703 }
76977704 final boolean systemAlertWindowsHidden = !mHidingNonSystemOverlayWindows.isEmpty();
Afficher sur ancien navigateur de dépôt.