mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-23 22:49:28 -05:00
082bc48c32
https://review.lineageos.org/q/topic:P_asb_2022-05 https://review.lineageos.org/q/topic:P_asb_2022-06 https://review.lineageos.org/q/topic:P_asb_2022-07 https://review.lineageos.org/q/topic:P_asb_2022-08 https://review.lineageos.org/q/topic:P_asb_2022-09 https://review.lineageos.org/q/topic:P_asb_2022-10 https://review.lineageos.org/q/topic:P_asb_2022-11 https://review.lineageos.org/q/topic:P_asb_2022-12 https://review.lineageos.org/q/topic:P_asb_2023-01 https://review.lineageos.org/q/topic:P_asb_2023-02 https://review.lineageos.org/q/topic:P_asb_2023-03 https://review.lineageos.org/q/topic:P_asb_2023-04 https://review.lineageos.org/q/topic:P_asb_2023-05 https://review.lineageos.org/q/topic:P_asb_2023-06 https://review.lineageos.org/q/topic:P_asb_2023-07 accounted for via manifest change: https://review.lineageos.org/c/LineageOS/android_external_freetype/+/361250 https://review.lineageos.org/q/topic:P_asb_2023-08 accounted for via manifest change: https://review.lineageos.org/c/LineageOS/android_external_freetype/+/364606 accounted for via patches: https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/365328 https://review.lineageos.org/q/topic:P_asb_2023-09 https://review.lineageos.org/q/topic:P_asb_2023-10 https://review.lineageos.org/q/topic:P_asb_2023-11 accounted for via patches: https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/374916 https://review.lineageos.org/q/topic:P_asb_2023-12 https://review.lineageos.org/q/topic:P_asb_2024-01 https://review.lineageos.org/q/topic:P_asb_2024-02 https://review.lineageos.org/q/topic:P_asb_2024-03 https://review.lineageos.org/q/topic:P_asb_2024-04 Signed-off-by: Tavi <tavi@divested.dev>
124 lines
5.5 KiB
Diff
124 lines
5.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Oli Lan <olilan@google.com>
|
|
Date: Wed, 27 Jul 2022 17:17:51 +0000
|
|
Subject: [PATCH] Revert "Prevent exfiltration of system files via user image
|
|
settings."
|
|
|
|
This reverts commit 8950a9002402de6e1218bab3da52868a51104a95.
|
|
|
|
Reason for revert: regression if multiple crop system crop handlers are present
|
|
|
|
Change-Id: Ib83dbb2f1109d26b7e85192379291bffef187e77
|
|
Merged-In: I15e15ad88b768a5b679de32c5429d921d850a3cb
|
|
(cherry picked from commit c0742e745da55452a412b4bb7bd28c5ecf3a8cb2)
|
|
Merged-In: Ib83dbb2f1109d26b7e85192379291bffef187e77
|
|
---
|
|
.../users/EditUserPhotoController.java | 42 ++++++-------------
|
|
1 file changed, 13 insertions(+), 29 deletions(-)
|
|
|
|
diff --git a/src/com/android/settings/users/EditUserPhotoController.java b/src/com/android/settings/users/EditUserPhotoController.java
|
|
index cdf392b9df0..0f67b181de3 100644
|
|
--- a/src/com/android/settings/users/EditUserPhotoController.java
|
|
+++ b/src/com/android/settings/users/EditUserPhotoController.java
|
|
@@ -22,7 +22,6 @@ import android.content.ClipData;
|
|
import android.content.ContentResolver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
-import android.content.pm.ActivityInfo;
|
|
import android.content.pm.PackageManager;
|
|
import android.database.Cursor;
|
|
import android.graphics.Bitmap;
|
|
@@ -76,7 +75,6 @@ public class EditUserPhotoController {
|
|
private static final int REQUEST_CODE_TAKE_PHOTO = 1002;
|
|
private static final int REQUEST_CODE_CROP_PHOTO = 1003;
|
|
|
|
- private static final String PRE_CROP_PICTURE_FILE_NAME = "PreCropEditUserPhoto.jpg";
|
|
private static final String CROP_PICTURE_FILE_NAME = "CropEditUserPhoto.jpg";
|
|
private static final String TAKE_PICTURE_FILE_NAME = "TakeEditUserPhoto2.jpg";
|
|
private static final String NEW_USER_PHOTO_FILE_NAME = "NewUserPhoto.png";
|
|
@@ -87,7 +85,6 @@ public class EditUserPhotoController {
|
|
private final Fragment mFragment;
|
|
private final ImageView mImageView;
|
|
|
|
- private final Uri mPreCropPictureUri;
|
|
private final Uri mCropPictureUri;
|
|
private final Uri mTakePictureUri;
|
|
|
|
@@ -99,8 +96,6 @@ public class EditUserPhotoController {
|
|
mContext = view.getContext();
|
|
mFragment = fragment;
|
|
mImageView = view;
|
|
-
|
|
- mPreCropPictureUri = createTempImageUri(mContext, PRE_CROP_PICTURE_FILE_NAME, !waiting);
|
|
mCropPictureUri = createTempImageUri(mContext, CROP_PICTURE_FILE_NAME, !waiting);
|
|
mTakePictureUri = createTempImageUri(mContext, TAKE_PICTURE_FILE_NAME, !waiting);
|
|
mPhotoSize = getPhotoSize(mContext);
|
|
@@ -135,7 +130,7 @@ public class EditUserPhotoController {
|
|
case REQUEST_CODE_TAKE_PHOTO:
|
|
case REQUEST_CODE_CHOOSE_PHOTO:
|
|
if (mTakePictureUri.equals(pictureUri)) {
|
|
- cropPhoto(pictureUri);
|
|
+ cropPhoto();
|
|
} else {
|
|
copyAndCropPhoto(pictureUri);
|
|
}
|
|
@@ -244,7 +239,7 @@ public class EditUserPhotoController {
|
|
protected Void doInBackground(Void... params) {
|
|
final ContentResolver cr = mContext.getContentResolver();
|
|
try (InputStream in = cr.openInputStream(pictureUri);
|
|
- OutputStream out = cr.openOutputStream(mPreCropPictureUri)) {
|
|
+ OutputStream out = cr.openOutputStream(mTakePictureUri)) {
|
|
Streams.copy(in, out);
|
|
} catch (IOException e) {
|
|
Log.w(TAG, "Failed to copy photo", e);
|
|
@@ -255,38 +250,27 @@ public class EditUserPhotoController {
|
|
@Override
|
|
protected void onPostExecute(Void result) {
|
|
if (!mFragment.isAdded()) return;
|
|
- cropPhoto(mPreCropPictureUri);
|
|
+ cropPhoto();
|
|
}
|
|
}.execute();
|
|
}
|
|
|
|
- private void cropPhoto(final Uri pictureUri) {
|
|
+ private void cropPhoto() {
|
|
// TODO: Use a public intent, when there is one.
|
|
Intent intent = new Intent("com.android.camera.action.CROP");
|
|
- intent.setDataAndType(pictureUri, "image/*");
|
|
+ intent.setDataAndType(mTakePictureUri, "image/*");
|
|
appendOutputExtra(intent, mCropPictureUri);
|
|
appendCropExtras(intent);
|
|
- try {
|
|
- StrictMode.disableDeathOnFileUriExposure();
|
|
- if (startSystemActivityForResult(intent, REQUEST_CODE_CROP_PHOTO)) {
|
|
- return;
|
|
+ if (intent.resolveActivity(mContext.getPackageManager()) != null) {
|
|
+ try {
|
|
+ StrictMode.disableDeathOnFileUriExposure();
|
|
+ mFragment.startActivityForResult(intent, REQUEST_CODE_CROP_PHOTO);
|
|
+ } finally {
|
|
+ StrictMode.enableDeathOnFileUriExposure();
|
|
}
|
|
- } finally {
|
|
- StrictMode.enableDeathOnFileUriExposure();
|
|
- }
|
|
- onPhotoCropped(mTakePictureUri, false);
|
|
- }
|
|
-
|
|
- private boolean startSystemActivityForResult(Intent intent, int code) {
|
|
- ActivityInfo info = intent.resolveActivityInfo(mContext.getPackageManager(),
|
|
- PackageManager.MATCH_SYSTEM_ONLY);
|
|
- if (info == null) {
|
|
- Log.w(TAG, "No system package activity could be found for code " + code);
|
|
- return false;
|
|
+ } else {
|
|
+ onPhotoCropped(mTakePictureUri, false);
|
|
}
|
|
- intent.setPackage(info.packageName);
|
|
- mFragment.startActivityForResult(intent, code);
|
|
- return true;
|
|
}
|
|
|
|
private void appendOutputExtra(Intent intent, Uri pictureUri) {
|