kill-Vision.patch
This commit is contained in:
parent
7f0ce41edc
commit
300566f2b7
1 changed files with 105 additions and 13 deletions
|
@ -4,17 +4,18 @@ Subject: kill Vision
|
|||
|
||||
Barcode, face and text detection APIs
|
||||
---
|
||||
chrome/android/BUILD.gn | 2 --
|
||||
services/shape_detection/BUILD.gn | 6 -----
|
||||
.../chromium/shape_detection/BitmapUtils.java | 12 ----------
|
||||
.../FaceDetectionProviderImpl.java | 10 +-------
|
||||
.../shape_detection/InterfaceRegistrar.java | 23 ++-----------------
|
||||
5 files changed, 3 insertions(+), 50 deletions(-)
|
||||
chrome/android/BUILD.gn | 2 -
|
||||
.../qrcode/scan_tab/QrCodeScanMediator.java | 54 -------------------
|
||||
services/shape_detection/BUILD.gn | 6 ---
|
||||
.../chromium/shape_detection/BitmapUtils.java | 12 -----
|
||||
.../FaceDetectionProviderImpl.java | 10 +---
|
||||
.../shape_detection/InterfaceRegistrar.java | 23 +-------
|
||||
6 files changed, 3 insertions(+), 104 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
|
||||
--- a/chrome/android/BUILD.gn
|
||||
+++ b/chrome/android/BUILD.gn
|
||||
@@ -287,8 +287,6 @@ android_library("chrome_java") {
|
||||
@@ -285,8 +285,6 @@ android_library("chrome_java") {
|
||||
"$google_play_services_package:google_play_services_gcm_java",
|
||||
"$google_play_services_package:google_play_services_iid_java",
|
||||
"$google_play_services_package:google_play_services_tasks_java",
|
||||
|
@ -22,7 +23,98 @@ diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
|
|||
- "$google_play_services_package:google_play_services_vision_java",
|
||||
"//base:base_java",
|
||||
"//base:jni_java",
|
||||
"//chrome/android/features/keyboard_accessory:public_java",
|
||||
"//cc:cc_java",
|
||||
diff --git a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/qrcode/scan_tab/QrCodeScanMediator.java b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/qrcode/scan_tab/QrCodeScanMediator.java
|
||||
--- a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/qrcode/scan_tab/QrCodeScanMediator.java
|
||||
+++ b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/qrcode/scan_tab/QrCodeScanMediator.java
|
||||
@@ -17,10 +17,6 @@ import android.provider.Browser;
|
||||
import android.util.SparseArray;
|
||||
import android.webkit.URLUtil;
|
||||
|
||||
-import com.google.android.gms.vision.Frame;
|
||||
-import com.google.android.gms.vision.barcode.Barcode;
|
||||
-import com.google.android.gms.vision.barcode.BarcodeDetector;
|
||||
-
|
||||
import org.chromium.base.metrics.RecordUserAction;
|
||||
import org.chromium.base.task.AsyncTask;
|
||||
import org.chromium.chrome.R;
|
||||
@@ -48,7 +44,6 @@ public class QrCodeScanMediator implements Camera.PreviewCallback {
|
||||
private final NavigationObserver mNavigationObserver;
|
||||
private final AndroidPermissionDelegate mPermissionDelegate;
|
||||
|
||||
- private BarcodeDetector mDetector;
|
||||
private Toast mToast;
|
||||
|
||||
/**
|
||||
@@ -67,7 +62,6 @@ public class QrCodeScanMediator implements Camera.PreviewCallback {
|
||||
mNavigationObserver = observer;
|
||||
|
||||
// Set detector to null until it gets initialized asynchronously.
|
||||
- mDetector = null;
|
||||
initBarcodeDetectorAsync();
|
||||
}
|
||||
|
||||
@@ -142,43 +136,6 @@ public class QrCodeScanMediator implements Camera.PreviewCallback {
|
||||
*/
|
||||
@Override
|
||||
public void onPreviewFrame(byte[] data, Camera camera) {
|
||||
- if (mDetector == null) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- ByteBuffer buffer = ByteBuffer.allocate(data.length);
|
||||
- buffer.put(data);
|
||||
- Frame frame =
|
||||
- new Frame.Builder()
|
||||
- .setImageData(buffer, camera.getParameters().getPreviewSize().width,
|
||||
- camera.getParameters().getPreviewSize().height, ImageFormat.NV21)
|
||||
- .build();
|
||||
- SparseArray<Barcode> barcodes = mDetector.detect(frame);
|
||||
- if (!mPropertyModel.get(QrCodeScanViewProperties.IS_ON_FOREGROUND)) {
|
||||
- return;
|
||||
- }
|
||||
- if (barcodes.size() == 0) {
|
||||
- camera.setOneShotPreviewCallback(this);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- Barcode firstCode = barcodes.valueAt(0);
|
||||
- if (!URLUtil.isValidUrl(firstCode.rawValue)) {
|
||||
- String toastMessage =
|
||||
- mContext.getString(R.string.qr_code_not_a_url_label, firstCode.rawValue);
|
||||
- if (mToast != null) {
|
||||
- mToast.cancel();
|
||||
- }
|
||||
- mToast = Toast.makeText(mContext, toastMessage, Toast.LENGTH_LONG);
|
||||
- mToast.show();
|
||||
- RecordUserAction.record("SharingQRCode.ScannedNonURL");
|
||||
- camera.setOneShotPreviewCallback(this);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- openUrl(firstCode.rawValue);
|
||||
- mNavigationObserver.onNavigation();
|
||||
- RecordUserAction.record("SharingQRCode.ScannedURL");
|
||||
}
|
||||
|
||||
private void openUrl(String url) {
|
||||
@@ -195,16 +152,5 @@ public class QrCodeScanMediator implements Camera.PreviewCallback {
|
||||
}
|
||||
|
||||
private void initBarcodeDetectorAsync() {
|
||||
- new AsyncTask<BarcodeDetector>() {
|
||||
- @Override
|
||||
- protected BarcodeDetector doInBackground() {
|
||||
- return new BarcodeDetector.Builder(mContext).build();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- protected void onPostExecute(BarcodeDetector detector) {
|
||||
- mDetector = detector;
|
||||
- }
|
||||
- }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
diff --git a/services/shape_detection/BUILD.gn b/services/shape_detection/BUILD.gn
|
||||
--- a/services/shape_detection/BUILD.gn
|
||||
+++ b/services/shape_detection/BUILD.gn
|
||||
|
@ -51,14 +143,14 @@ diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detect
|
|||
-import com.google.android.gms.vision.Frame;
|
||||
-
|
||||
import org.chromium.mojo_base.BigBufferUtil;
|
||||
import org.chromium.skia.mojom.ColorType;
|
||||
|
||||
@@ -44,14 +42,4 @@ public class BitmapUtils {
|
||||
|
||||
return bitmap;
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -43,14 +41,4 @@ public class BitmapUtils {
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
-
|
||||
- public static Frame convertToFrame(org.chromium.skia.mojom.Bitmap bitmapData) {
|
||||
- public static Frame convertToFrame(org.chromium.skia.mojom.BitmapN32 bitmapData) {
|
||||
- Bitmap bitmap = convertToBitmap(bitmapData);
|
||||
- if (bitmap == null) {
|
||||
- return null;
|
||||
|
|
Loading…
Add table
Reference in a new issue