Android build for ungoogled-chromium. https://uc.droidware.info
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
675 lines
30 KiB
675 lines
30 KiB
From: Wengling Chen <[email protected]>
|
|
Date: Fri, 1 Nov 2019 23:10:47 +0100
|
|
Subject: Remove dependency on com.google.android.gms.vision,
|
|
com.google.android.gms.clearcut, com.google.android.gms.phenotype
|
|
|
|
---
|
|
chrome/android/BUILD.gn | 2
|
|
chrome/android/features/cablev2_authenticator/BUILD.gn | 2
|
|
chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/qrcode/scan_tab/QrCodeScanMediator.java | 49 ----
|
|
services/BUILD.gn | 4
|
|
services/shape_detection/BUILD.gn | 2
|
|
services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java | 114 ---------
|
|
services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java | 22 -
|
|
services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImplGmsCore.java | 122 ----------
|
|
services/shape_detection/android/java/src/org/chromium/shape_detection/TextDetectionImpl.java | 60 ----
|
|
third_party/android_deps/BUILD.gn | 69 -----
|
|
10 files changed, 10 insertions(+), 436 deletions(-)
|
|
|
|
--- a/services/BUILD.gn
|
|
+++ b/services/BUILD.gn
|
|
@@ -105,8 +105,6 @@ if (is_android) {
|
|
deps = [
|
|
"$google_play_services_package:google_play_services_base_java",
|
|
"$google_play_services_package:google_play_services_basement_java",
|
|
- "$google_play_services_package:google_play_services_vision_common_java",
|
|
- "$google_play_services_package:google_play_services_vision_java",
|
|
"//base:base_java",
|
|
"//base:base_java_test_support",
|
|
"//base:base_junit_test_support",
|
|
@@ -136,8 +134,6 @@ if (is_android) {
|
|
deps = [
|
|
"$google_play_services_package:google_play_services_base_java",
|
|
"$google_play_services_package:google_play_services_basement_java",
|
|
- "$google_play_services_package:google_play_services_vision_common_java",
|
|
- "$google_play_services_package:google_play_services_vision_java",
|
|
"//base:base_java",
|
|
"//base:base_java_test_support",
|
|
"//mojo/public/java:base_java",
|
|
--- a/services/shape_detection/BUILD.gn
|
|
+++ b/services/shape_detection/BUILD.gn
|
|
@@ -91,8 +91,6 @@ if (is_android) {
|
|
deps = [
|
|
"$google_play_services_package:google_play_services_base_java",
|
|
"$google_play_services_package:google_play_services_basement_java",
|
|
- "$google_play_services_package:google_play_services_vision_common_java",
|
|
- "$google_play_services_package:google_play_services_vision_java",
|
|
"//base:base_java",
|
|
"//mojo/public/java:base_java",
|
|
"//mojo/public/java:bindings_java",
|
|
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java
|
|
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java
|
|
@@ -8,10 +8,6 @@ import android.graphics.Point;
|
|
import android.graphics.Rect;
|
|
import android.util.SparseArray;
|
|
|
|
-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.ContextUtils;
|
|
import org.chromium.base.Log;
|
|
import org.chromium.gfx.mojom.PointF;
|
|
@@ -28,50 +24,7 @@ import org.chromium.shape_detection.mojo
|
|
public class BarcodeDetectionImpl implements BarcodeDetection {
|
|
private static final String TAG = "BarcodeDetectionImpl";
|
|
|
|
- private BarcodeDetector mBarcodeDetector;
|
|
-
|
|
public BarcodeDetectionImpl(BarcodeDetectorOptions options) {
|
|
- int formats = Barcode.ALL_FORMATS;
|
|
- if (options.formats != null && options.formats.length > 0) {
|
|
- formats = 0;
|
|
- // Keep this list in sync with the constants defined in
|
|
- // com.google.android.gms.vision.barcode.Barcode and the list of
|
|
- // supported formats in BarcodeDetectionProviderImpl.
|
|
- for (int i = 0; i < options.formats.length; ++i) {
|
|
- if (options.formats[i] == BarcodeFormat.AZTEC) {
|
|
- formats |= Barcode.AZTEC;
|
|
- } else if (options.formats[i] == BarcodeFormat.CODE_128) {
|
|
- formats |= Barcode.CODE_128;
|
|
- } else if (options.formats[i] == BarcodeFormat.CODE_39) {
|
|
- formats |= Barcode.CODE_39;
|
|
- } else if (options.formats[i] == BarcodeFormat.CODE_93) {
|
|
- formats |= Barcode.CODE_93;
|
|
- } else if (options.formats[i] == BarcodeFormat.CODABAR) {
|
|
- formats |= Barcode.CODABAR;
|
|
- } else if (options.formats[i] == BarcodeFormat.DATA_MATRIX) {
|
|
- formats |= Barcode.DATA_MATRIX;
|
|
- } else if (options.formats[i] == BarcodeFormat.EAN_13) {
|
|
- formats |= Barcode.EAN_13;
|
|
- } else if (options.formats[i] == BarcodeFormat.EAN_8) {
|
|
- formats |= Barcode.EAN_8;
|
|
- } else if (options.formats[i] == BarcodeFormat.ITF) {
|
|
- formats |= Barcode.ITF;
|
|
- } else if (options.formats[i] == BarcodeFormat.PDF417) {
|
|
- formats |= Barcode.PDF417;
|
|
- } else if (options.formats[i] == BarcodeFormat.QR_CODE) {
|
|
- formats |= Barcode.QR_CODE;
|
|
- } else if (options.formats[i] == BarcodeFormat.UPC_A) {
|
|
- formats |= Barcode.UPC_A;
|
|
- } else if (options.formats[i] == BarcodeFormat.UPC_E) {
|
|
- formats |= Barcode.UPC_E;
|
|
- } else {
|
|
- Log.e(TAG, "Unsupported barcode format hint: " + options.formats[i]);
|
|
- }
|
|
- }
|
|
- }
|
|
- mBarcodeDetector = new BarcodeDetector.Builder(ContextUtils.getApplicationContext())
|
|
- .setBarcodeFormats(formats)
|
|
- .build();
|
|
}
|
|
|
|
@Override
|
|
@@ -80,47 +33,12 @@ public class BarcodeDetectionImpl implem
|
|
// on the device; this happens "fast", but it might have not completed,
|
|
// bail in this case. Also, the API was disabled between and v.9.0 and
|
|
// v.9.2, see https://developers.google.com/android/guides/releases.
|
|
- if (!mBarcodeDetector.isOperational()) {
|
|
- Log.e(TAG, "BarcodeDetector is not operational");
|
|
- callback.call(new BarcodeDetectionResult[0]);
|
|
- return;
|
|
- }
|
|
-
|
|
- Frame frame = BitmapUtils.convertToFrame(bitmapData);
|
|
- if (frame == null) {
|
|
- Log.e(TAG, "Error converting Mojom Bitmap to Frame");
|
|
- callback.call(new BarcodeDetectionResult[0]);
|
|
- return;
|
|
- }
|
|
-
|
|
- final SparseArray<Barcode> barcodes = mBarcodeDetector.detect(frame);
|
|
-
|
|
- BarcodeDetectionResult[] barcodeArray = new BarcodeDetectionResult[barcodes.size()];
|
|
- for (int i = 0; i < barcodes.size(); i++) {
|
|
- barcodeArray[i] = new BarcodeDetectionResult();
|
|
- final Barcode barcode = barcodes.valueAt(i);
|
|
- barcodeArray[i].rawValue = barcode.rawValue;
|
|
- final Rect rect = barcode.getBoundingBox();
|
|
- barcodeArray[i].boundingBox = new RectF();
|
|
- barcodeArray[i].boundingBox.x = rect.left;
|
|
- barcodeArray[i].boundingBox.y = rect.top;
|
|
- barcodeArray[i].boundingBox.width = rect.width();
|
|
- barcodeArray[i].boundingBox.height = rect.height();
|
|
- final Point[] corners = barcode.cornerPoints;
|
|
- barcodeArray[i].cornerPoints = new PointF[corners.length];
|
|
- for (int j = 0; j < corners.length; j++) {
|
|
- barcodeArray[i].cornerPoints[j] = new PointF();
|
|
- barcodeArray[i].cornerPoints[j].x = corners[j].x;
|
|
- barcodeArray[i].cornerPoints[j].y = corners[j].y;
|
|
- }
|
|
- barcodeArray[i].format = toBarcodeFormat(barcode.format);
|
|
- }
|
|
- callback.call(barcodeArray);
|
|
+ Log.e(TAG, "BarcodeDetector is not operational");
|
|
+ callback.call(new BarcodeDetectionResult[0]);
|
|
}
|
|
|
|
@Override
|
|
public void close() {
|
|
- mBarcodeDetector.release();
|
|
}
|
|
|
|
@Override
|
|
@@ -129,34 +47,6 @@ public class BarcodeDetectionImpl implem
|
|
}
|
|
|
|
private int toBarcodeFormat(int format) {
|
|
- switch (format) {
|
|
- case Barcode.CODE_128:
|
|
- return BarcodeFormat.CODE_128;
|
|
- case Barcode.CODE_39:
|
|
- return BarcodeFormat.CODE_39;
|
|
- case Barcode.CODE_93:
|
|
- return BarcodeFormat.CODE_93;
|
|
- case Barcode.CODABAR:
|
|
- return BarcodeFormat.CODABAR;
|
|
- case Barcode.DATA_MATRIX:
|
|
- return BarcodeFormat.DATA_MATRIX;
|
|
- case Barcode.EAN_13:
|
|
- return BarcodeFormat.EAN_13;
|
|
- case Barcode.EAN_8:
|
|
- return BarcodeFormat.EAN_8;
|
|
- case Barcode.ITF:
|
|
- return BarcodeFormat.ITF;
|
|
- case Barcode.QR_CODE:
|
|
- return BarcodeFormat.QR_CODE;
|
|
- case Barcode.UPC_A:
|
|
- return BarcodeFormat.UPC_A;
|
|
- case Barcode.UPC_E:
|
|
- return BarcodeFormat.UPC_E;
|
|
- case Barcode.PDF417:
|
|
- return BarcodeFormat.PDF417;
|
|
- case Barcode.AZTEC:
|
|
- return BarcodeFormat.AZTEC;
|
|
- }
|
|
return BarcodeFormat.UNKNOWN;
|
|
}
|
|
}
|
|
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImplGmsCore.java
|
|
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImplGmsCore.java
|
|
@@ -7,11 +7,6 @@ package org.chromium.shape_detection;
|
|
import android.graphics.PointF;
|
|
import android.util.SparseArray;
|
|
|
|
-import com.google.android.gms.vision.Frame;
|
|
-import com.google.android.gms.vision.face.Face;
|
|
-import com.google.android.gms.vision.face.FaceDetector;
|
|
-import com.google.android.gms.vision.face.Landmark;
|
|
-
|
|
import org.chromium.base.ContextUtils;
|
|
import org.chromium.base.Log;
|
|
import org.chromium.gfx.mojom.RectF;
|
|
@@ -36,133 +31,20 @@ public class FaceDetectionImplGmsCore im
|
|
private static final int MAX_EULER_Z = 15;
|
|
private final int mMaxFaces;
|
|
private final boolean mFastMode;
|
|
- private final FaceDetector mFaceDetector;
|
|
|
|
FaceDetectionImplGmsCore(FaceDetectorOptions options) {
|
|
- FaceDetector.Builder builder =
|
|
- new FaceDetector.Builder(ContextUtils.getApplicationContext());
|
|
mMaxFaces = Math.min(options.maxDetectedFaces, MAX_FACES);
|
|
mFastMode = options.fastMode;
|
|
-
|
|
- try {
|
|
- builder.setMode(mFastMode ? FaceDetector.FAST_MODE : FaceDetector.ACCURATE_MODE);
|
|
- builder.setLandmarkType(FaceDetector.ALL_LANDMARKS);
|
|
- if (mMaxFaces == 1) {
|
|
- builder.setProminentFaceOnly(true);
|
|
- }
|
|
- } catch (IllegalArgumentException e) {
|
|
- Log.e(TAG, "Unexpected exception " + e);
|
|
- assert false;
|
|
- }
|
|
-
|
|
- mFaceDetector = builder.build();
|
|
}
|
|
|
|
@Override
|
|
public void detect(org.chromium.skia.mojom.Bitmap bitmapData, DetectResponse callback) {
|
|
- // The vision library will be downloaded the first time the API is used
|
|
- // on the device; this happens "fast", but it might have not completed,
|
|
- // bail in this case.
|
|
- if (!mFaceDetector.isOperational()) {
|
|
- Log.e(TAG, "FaceDetector is not operational");
|
|
-
|
|
- // Fallback to Android's FaceDetectionImpl.
|
|
- FaceDetectorOptions options = new FaceDetectorOptions();
|
|
- options.fastMode = mFastMode;
|
|
- options.maxDetectedFaces = mMaxFaces;
|
|
- FaceDetectionImpl detector = new FaceDetectionImpl(options);
|
|
- detector.detect(bitmapData, callback);
|
|
- return;
|
|
- }
|
|
-
|
|
- Frame frame = BitmapUtils.convertToFrame(bitmapData);
|
|
- if (frame == null) {
|
|
- Log.e(TAG, "Error converting Mojom Bitmap to Frame");
|
|
- callback.call(new FaceDetectionResult[0]);
|
|
- return;
|
|
- }
|
|
-
|
|
- final SparseArray<Face> faces = mFaceDetector.detect(frame);
|
|
-
|
|
- FaceDetectionResult[] faceArray = new FaceDetectionResult[faces.size()];
|
|
- for (int i = 0; i < faces.size(); i++) {
|
|
- faceArray[i] = new FaceDetectionResult();
|
|
- final Face face = faces.valueAt(i);
|
|
-
|
|
- final List<Landmark> landmarks = face.getLandmarks();
|
|
- ArrayList<org.chromium.shape_detection.mojom.Landmark> mojoLandmarks =
|
|
- new ArrayList<org.chromium.shape_detection.mojom.Landmark>(landmarks.size());
|
|
-
|
|
- int leftEyeIndex = -1;
|
|
- int rightEyeIndex = -1;
|
|
- int bottomMouthIndex = -1;
|
|
- for (int j = 0; j < landmarks.size(); j++) {
|
|
- final Landmark landmark = landmarks.get(j);
|
|
- final int landmarkType = landmark.getType();
|
|
- if (landmarkType != Landmark.LEFT_EYE && landmarkType != Landmark.RIGHT_EYE
|
|
- && landmarkType != Landmark.BOTTOM_MOUTH
|
|
- && landmarkType != Landmark.NOSE_BASE) {
|
|
- continue;
|
|
- }
|
|
-
|
|
- org.chromium.shape_detection.mojom.Landmark mojoLandmark =
|
|
- new org.chromium.shape_detection.mojom.Landmark();
|
|
- mojoLandmark.locations = new org.chromium.gfx.mojom.PointF[1];
|
|
- mojoLandmark.locations[0] = new org.chromium.gfx.mojom.PointF();
|
|
- mojoLandmark.locations[0].x = landmark.getPosition().x;
|
|
- mojoLandmark.locations[0].y = landmark.getPosition().y;
|
|
-
|
|
- if (landmarkType == Landmark.LEFT_EYE) {
|
|
- mojoLandmark.type = LandmarkType.EYE;
|
|
- leftEyeIndex = j;
|
|
- } else if (landmarkType == Landmark.RIGHT_EYE) {
|
|
- mojoLandmark.type = LandmarkType.EYE;
|
|
- rightEyeIndex = j;
|
|
- } else if (landmarkType == Landmark.BOTTOM_MOUTH) {
|
|
- mojoLandmark.type = LandmarkType.MOUTH;
|
|
- bottomMouthIndex = j;
|
|
- } else {
|
|
- assert landmarkType == Landmark.NOSE_BASE;
|
|
- mojoLandmark.type = LandmarkType.NOSE;
|
|
- }
|
|
- mojoLandmarks.add(mojoLandmark);
|
|
- }
|
|
- faceArray[i].landmarks = mojoLandmarks.toArray(
|
|
- new org.chromium.shape_detection.mojom.Landmark[mojoLandmarks.size()]);
|
|
-
|
|
- final PointF corner = face.getPosition();
|
|
- faceArray[i].boundingBox = new RectF();
|
|
- if (leftEyeIndex != -1 && rightEyeIndex != -1
|
|
- && Math.abs(face.getEulerZ()) < MAX_EULER_Z) {
|
|
- // Tighter calculation of the bounding box because the GMScore
|
|
- // and Android Face APIs give different results.
|
|
- final PointF leftEyePoint = landmarks.get(leftEyeIndex).getPosition();
|
|
- final PointF rightEyePoint = landmarks.get(rightEyeIndex).getPosition();
|
|
- final float eyesDistance = leftEyePoint.x - rightEyePoint.x;
|
|
- final float eyeMouthDistance = bottomMouthIndex != -1
|
|
- ? landmarks.get(bottomMouthIndex).getPosition().y - leftEyePoint.y
|
|
- : -1;
|
|
- final PointF midEyePoint =
|
|
- new PointF(corner.x + face.getWidth() / 2, leftEyePoint.y);
|
|
- faceArray[i].boundingBox.x = 2 * rightEyePoint.x - midEyePoint.x;
|
|
- faceArray[i].boundingBox.y = midEyePoint.y - eyesDistance;
|
|
- faceArray[i].boundingBox.width = 2 * eyesDistance;
|
|
- faceArray[i].boundingBox.height = eyeMouthDistance > eyesDistance
|
|
- ? eyeMouthDistance + eyesDistance
|
|
- : 2 * eyesDistance;
|
|
- } else {
|
|
- faceArray[i].boundingBox.x = corner.x;
|
|
- faceArray[i].boundingBox.y = corner.y;
|
|
- faceArray[i].boundingBox.width = face.getWidth();
|
|
- faceArray[i].boundingBox.height = face.getHeight();
|
|
- }
|
|
- }
|
|
- callback.call(faceArray);
|
|
+ Log.e(TAG, "FaceDetector is not operational");
|
|
+ callback.call(new FaceDetectionResult[0]);
|
|
}
|
|
|
|
@Override
|
|
public void close() {
|
|
- mFaceDetector.release();
|
|
}
|
|
|
|
@Override
|
|
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/TextDetectionImpl.java
|
|
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/TextDetectionImpl.java
|
|
@@ -8,12 +8,6 @@ import android.graphics.Point;
|
|
import android.graphics.Rect;
|
|
import android.util.SparseArray;
|
|
|
|
-import com.google.android.gms.common.ConnectionResult;
|
|
-import com.google.android.gms.common.GoogleApiAvailability;
|
|
-import com.google.android.gms.vision.Frame;
|
|
-import com.google.android.gms.vision.text.TextBlock;
|
|
-import com.google.android.gms.vision.text.TextRecognizer;
|
|
-
|
|
import org.chromium.base.ContextUtils;
|
|
import org.chromium.base.Log;
|
|
import org.chromium.gfx.mojom.PointF;
|
|
@@ -29,58 +23,17 @@ import org.chromium.shape_detection.mojo
|
|
public class TextDetectionImpl implements TextDetection {
|
|
private static final String TAG = "TextDetectionImpl";
|
|
|
|
- private TextRecognizer mTextRecognizer;
|
|
-
|
|
public TextDetectionImpl() {
|
|
- mTextRecognizer = new TextRecognizer.Builder(ContextUtils.getApplicationContext()).build();
|
|
}
|
|
|
|
@Override
|
|
public void detect(org.chromium.skia.mojom.Bitmap bitmapData, DetectResponse callback) {
|
|
- // The vision library will be downloaded the first time the API is used
|
|
- // on the device; this happens "fast", but it might have not completed,
|
|
- // bail in this case. Also, the API was disabled between and v.9.0 and
|
|
- // v.9.2, see https://developers.google.com/android/guides/releases.
|
|
- if (!mTextRecognizer.isOperational()) {
|
|
- Log.e(TAG, "TextDetector is not operational");
|
|
- callback.call(new TextDetectionResult[0]);
|
|
- return;
|
|
- }
|
|
-
|
|
- Frame frame = BitmapUtils.convertToFrame(bitmapData);
|
|
- if (frame == null) {
|
|
- Log.e(TAG, "Error converting Mojom Bitmap to Frame");
|
|
- callback.call(new TextDetectionResult[0]);
|
|
- return;
|
|
- }
|
|
-
|
|
- final SparseArray<TextBlock> textBlocks = mTextRecognizer.detect(frame);
|
|
-
|
|
- TextDetectionResult[] detectedTextArray = new TextDetectionResult[textBlocks.size()];
|
|
- for (int i = 0; i < textBlocks.size(); i++) {
|
|
- detectedTextArray[i] = new TextDetectionResult();
|
|
- final TextBlock textBlock = textBlocks.valueAt(i);
|
|
- detectedTextArray[i].rawValue = textBlock.getValue();
|
|
- final Rect rect = textBlock.getBoundingBox();
|
|
- detectedTextArray[i].boundingBox = new RectF();
|
|
- detectedTextArray[i].boundingBox.x = rect.left;
|
|
- detectedTextArray[i].boundingBox.y = rect.top;
|
|
- detectedTextArray[i].boundingBox.width = rect.width();
|
|
- detectedTextArray[i].boundingBox.height = rect.height();
|
|
- final Point[] corners = textBlock.getCornerPoints();
|
|
- detectedTextArray[i].cornerPoints = new PointF[corners.length];
|
|
- for (int j = 0; j < corners.length; j++) {
|
|
- detectedTextArray[i].cornerPoints[j] = new PointF();
|
|
- detectedTextArray[i].cornerPoints[j].x = corners[j].x;
|
|
- detectedTextArray[i].cornerPoints[j].y = corners[j].y;
|
|
- }
|
|
- }
|
|
- callback.call(detectedTextArray);
|
|
+ Log.e(TAG, "TextDetector is not operational");
|
|
+ callback.call(new TextDetectionResult[0]);
|
|
}
|
|
|
|
@Override
|
|
public void close() {
|
|
- mTextRecognizer.release();
|
|
}
|
|
|
|
@Override
|
|
@@ -89,12 +42,7 @@ public class TextDetectionImpl implement
|
|
}
|
|
|
|
public static TextDetection create() {
|
|
- if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(
|
|
- ContextUtils.getApplicationContext())
|
|
- != ConnectionResult.SUCCESS) {
|
|
- Log.e(TAG, "Google Play Services not available");
|
|
- return null;
|
|
- }
|
|
- return new TextDetectionImpl();
|
|
+ Log.e(TAG, "Google Play Services not available");
|
|
+ return null;
|
|
}
|
|
}
|
|
--- a/third_party/android_deps/BUILD.gn
|
|
+++ b/third_party/android_deps/BUILD.gn
|
|
@@ -1013,36 +1013,6 @@ android_aar_prebuilt("google_play_servic
|
|
}
|
|
|
|
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
|
-android_aar_prebuilt("google_play_services_vision_java") {
|
|
- aar_path = "libs/com_google_android_gms_play_services_vision/play-services-vision-18.0.0.aar"
|
|
- info_path = "libs/com_google_android_gms_play_services_vision/com_google_android_gms_play_services_vision.info"
|
|
- deps = [
|
|
- ":google_play_services_base_java",
|
|
- ":google_play_services_basement_java",
|
|
- ":google_play_services_vision_common_java",
|
|
- ]
|
|
-
|
|
- # Removing drawables from GMS .aars as they are unused bloat.
|
|
- strip_drawables = true
|
|
-}
|
|
-
|
|
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
|
-android_aar_prebuilt("google_play_services_vision_common_java") {
|
|
- aar_path = "libs/com_google_android_gms_play_services_vision_common/play-services-vision-common-18.0.0.aar"
|
|
- info_path = "libs/com_google_android_gms_play_services_vision_common/com_google_android_gms_play_services_vision_common.info"
|
|
- deps = [
|
|
- ":google_play_services_base_java",
|
|
- ":google_play_services_basement_java",
|
|
- ":google_play_services_clearcut_java",
|
|
- ":google_play_services_flags_java",
|
|
- ":google_play_services_phenotype_java",
|
|
- ]
|
|
-
|
|
- # Removing drawables from GMS .aars as they are unused bloat.
|
|
- strip_drawables = true
|
|
-}
|
|
-
|
|
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
|
android_aar_prebuilt("com_google_android_material_material_java") {
|
|
aar_path = "libs/com_google_android_material_material/material-1.0.0-rc02.aar"
|
|
info_path = "libs/com_google_android_material_material/com_google_android_material_material.info"
|
|
@@ -1940,26 +1910,6 @@ java_prebuilt("com_github_kevinstern_sof
|
|
}
|
|
|
|
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
|
-android_aar_prebuilt("google_play_services_clearcut_java") {
|
|
- aar_path = "libs/com_google_android_gms_play_services_clearcut/play-services-clearcut-17.0.0.aar"
|
|
- info_path = "libs/com_google_android_gms_play_services_clearcut/com_google_android_gms_play_services_clearcut.info"
|
|
-
|
|
- # To remove visibility constraint, add this dependency to
|
|
- # //third_party/android_deps/build.gradle.
|
|
- visibility = [ ":*" ]
|
|
- deps = [
|
|
- ":androidx_core_core_java",
|
|
- ":google_play_services_base_java",
|
|
- ":google_play_services_basement_java",
|
|
- ":google_play_services_phenotype_java",
|
|
- ":google_play_services_tasks_java",
|
|
- ]
|
|
-
|
|
- # Removing drawables from GMS .aars as they are unused bloat.
|
|
- strip_drawables = true
|
|
-}
|
|
-
|
|
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
|
android_aar_prebuilt("google_play_services_flags_java") {
|
|
aar_path = "libs/com_google_android_gms_play_services_flags/play-services-flags-17.0.0.aar"
|
|
info_path = "libs/com_google_android_gms_play_services_flags/com_google_android_gms_play_services_flags.info"
|
|
@@ -1973,25 +1923,6 @@ android_aar_prebuilt("google_play_servic
|
|
]
|
|
|
|
# Removing drawables from GMS .aars as they are unused bloat.
|
|
- strip_drawables = true
|
|
-}
|
|
-
|
|
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
|
-android_aar_prebuilt("google_play_services_phenotype_java") {
|
|
- aar_path = "libs/com_google_android_gms_play_services_phenotype/play-services-phenotype-17.0.0.aar"
|
|
- info_path = "libs/com_google_android_gms_play_services_phenotype/com_google_android_gms_play_services_phenotype.info"
|
|
-
|
|
- # To remove visibility constraint, add this dependency to
|
|
- # //third_party/android_deps/build.gradle.
|
|
- visibility = [ ":*" ]
|
|
- deps = [
|
|
- ":androidx_core_core_java",
|
|
- ":google_play_services_base_java",
|
|
- ":google_play_services_basement_java",
|
|
- ":google_play_services_tasks_java",
|
|
- ]
|
|
-
|
|
- # Removing drawables from GMS .aars as they are unused bloat.
|
|
strip_drawables = true
|
|
}
|
|
|
|
--- 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,8 +44,6 @@ public class QrCodeScanMediator implemen
|
|
private final NavigationObserver mNavigationObserver;
|
|
private final AndroidPermissionDelegate mPermissionDelegate;
|
|
|
|
- private BarcodeDetector mDetector;
|
|
-
|
|
/**
|
|
* The QrCodeScanMediator constructor.
|
|
*
|
|
@@ -66,7 +60,6 @@ public class QrCodeScanMediator implemen
|
|
mNavigationObserver = observer;
|
|
|
|
// Set detector to null until it gets initialized asynchronously.
|
|
- mDetector = null;
|
|
initBarcodeDetectorAsync();
|
|
}
|
|
|
|
@@ -141,36 +134,7 @@ public class QrCodeScanMediator implemen
|
|
*/
|
|
@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 (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);
|
|
- Toast.makeText(mContext, toastMessage, Toast.LENGTH_LONG).show();
|
|
- RecordUserAction.record("SharingQRCode.ScannedNonURL");
|
|
- camera.setOneShotPreviewCallback(this);
|
|
- return;
|
|
- }
|
|
-
|
|
- openUrl(firstCode.rawValue);
|
|
- mNavigationObserver.onNavigation();
|
|
- RecordUserAction.record("SharingQRCode.ScannedURL");
|
|
+ return;
|
|
}
|
|
|
|
private void openUrl(String url) {
|
|
@@ -187,16 +151,5 @@ public class QrCodeScanMediator implemen
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
--- a/chrome/android/BUILD.gn
|
|
+++ b/chrome/android/BUILD.gn
|
|
@@ -278,8 +278,6 @@ android_library("chrome_java") {
|
|
"$google_play_services_package:google_play_services_base_java",
|
|
"$google_play_services_package:google_play_services_basement_java",
|
|
"$google_play_services_package:google_play_services_tasks_java",
|
|
- "$google_play_services_package:google_play_services_vision_common_java",
|
|
- "$google_play_services_package:google_play_services_vision_java",
|
|
"//base:base_java",
|
|
"//base:jni_java",
|
|
"//chrome/android/features/keyboard_accessory:public_java",
|
|
--- a/chrome/android/features/cablev2_authenticator/BUILD.gn
|
|
+++ b/chrome/android/features/cablev2_authenticator/BUILD.gn
|
|
@@ -16,8 +16,6 @@ android_library("java") {
|
|
deps = [
|
|
"$google_play_services_package:google_play_services_base_java",
|
|
"$google_play_services_package:google_play_services_tasks_java",
|
|
- "$google_play_services_package:google_play_services_vision_common_java",
|
|
- "$google_play_services_package:google_play_services_vision_java",
|
|
"//base:base_java",
|
|
"//base:jni_java",
|
|
"//chrome/android:chrome_java",
|
|
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java
|
|
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java
|
|
@@ -8,9 +8,6 @@ import android.content.Context;
|
|
import android.content.pm.PackageInfo;
|
|
import android.content.pm.PackageManager.NameNotFoundException;
|
|
|
|
-import com.google.android.gms.common.ConnectionResult;
|
|
-import com.google.android.gms.common.GoogleApiAvailability;
|
|
-
|
|
import org.chromium.base.ContextUtils;
|
|
import org.chromium.base.Log;
|
|
import org.chromium.mojo.bindings.InterfaceRequest;
|
|
@@ -55,23 +52,6 @@ public class BarcodeDetectionProviderImp
|
|
|
|
public static BarcodeDetectionProvider create() {
|
|
Context ctx = ContextUtils.getApplicationContext();
|
|
- if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(ctx)
|
|
- != ConnectionResult.SUCCESS) {
|
|
- Log.w(TAG, "Google Play Services not available");
|
|
- return null;
|
|
- }
|
|
- try {
|
|
- PackageInfo playServicesPackage = ctx.getPackageManager().getPackageInfo(
|
|
- GoogleApiAvailability.GOOGLE_PLAY_SERVICES_PACKAGE, 0);
|
|
- if (playServicesPackage.versionCode < 19742000) {
|
|
- // https://crbug.com/1020746
|
|
- Log.w(TAG, "Detection disabled (%s < 19.7.42)", playServicesPackage.versionName);
|
|
- return null;
|
|
- }
|
|
- } catch (NameNotFoundException e) {
|
|
- Log.w(TAG, "Google Play Services not available");
|
|
- return null;
|
|
- }
|
|
- return new BarcodeDetectionProviderImpl();
|
|
+ return null;
|
|
}
|
|
}
|
|
|