Repo Created
This commit is contained in:
parent
eb305e2886
commit
a8c22c65db
4784 changed files with 329907 additions and 2 deletions
6
play-services-vision/src/main/AndroidManifest.xml
Normal file
6
play-services-vision/src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
~ SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<manifest />
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.barcode;
|
||||
|
||||
parcelable Barcode;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.barcode.internal.client;
|
||||
|
||||
parcelable BarcodeDetectorOptions;
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.barcode.internal.client;
|
||||
|
||||
import com.google.android.gms.vision.barcode.Barcode;
|
||||
import com.google.android.gms.vision.barcode.internal.client.BarcodeDetectorOptions;
|
||||
import com.google.android.gms.vision.internal.FrameMetadataParcel;
|
||||
import com.google.android.gms.dynamic.IObjectWrapper;
|
||||
|
||||
interface INativeBarcodeDetector {
|
||||
Barcode[] detectBytes(IObjectWrapper byteBuffer, in FrameMetadataParcel metadata) = 0;
|
||||
Barcode[] detectBitmap(IObjectWrapper bitmap, in FrameMetadataParcel metadata) = 1;
|
||||
void close() = 2;
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.barcode.internal.client;
|
||||
|
||||
import com.google.android.gms.vision.barcode.internal.client.BarcodeDetectorOptions;
|
||||
import com.google.android.gms.vision.barcode.internal.client.INativeBarcodeDetector;
|
||||
import com.google.android.gms.dynamic.IObjectWrapper;
|
||||
|
||||
interface INativeBarcodeDetectorCreator {
|
||||
INativeBarcodeDetector create(IObjectWrapper context, in BarcodeDetectorOptions options) = 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.face;
|
||||
|
||||
parcelable Contour;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.face;
|
||||
|
||||
parcelable Landmark;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.face.internal.client;
|
||||
|
||||
parcelable DetectionOptions;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.face.internal.client;
|
||||
|
||||
parcelable FaceParcel;
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.face.internal.client;
|
||||
|
||||
import com.google.android.gms.vision.face.internal.client.FaceParcel;
|
||||
import com.google.android.gms.dynamic.IObjectWrapper;
|
||||
import com.google.android.gms.vision.internal.FrameMetadataParcel;
|
||||
|
||||
interface INativeFaceDetector {
|
||||
FaceParcel[] detectFaceParcels(IObjectWrapper byteBuffer, in FrameMetadataParcel metadata) = 0;
|
||||
boolean isNativeFaceDetectorAvailable(int type) = 1;
|
||||
void closeDetectorJni() = 2;
|
||||
FaceParcel[] detectFacesFromPlanes(IObjectWrapper planeFirst, IObjectWrapper planeSecond, IObjectWrapper planeThird, int firstPixelStride, int secondPixelStride, int thirdPixelStride, int firstRowStride, int secondRowStride, int thirdRowStride, in FrameMetadataParcel metadata) = 3;
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.face.internal.client;
|
||||
|
||||
import com.google.android.gms.vision.face.internal.client.DetectionOptions;
|
||||
import com.google.android.gms.dynamic.IObjectWrapper;
|
||||
import com.google.android.gms.vision.face.internal.client.INativeFaceDetector;
|
||||
|
||||
interface INativeFaceDetectorCreator {
|
||||
INativeFaceDetector newFaceDetector(IObjectWrapper context, in DetectionOptions detectionOptions) = 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,593 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Notice: Portions of this file are reproduced from work created and shared by Google and used
|
||||
* according to terms described in the Creative Commons 4.0 Attribution License.
|
||||
* See https://developers.google.com/readme/policies for details.
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.barcode;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.microg.gms.common.PublicApi;
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
/**
|
||||
* Barcode represents a single recognized barcode and its value.
|
||||
* <p>
|
||||
* The barcode's raw, unmodified, and uninterpreted content is returned in the {@link #rawValue} field, while the barcode type (i.e. its encoding) can be found in the {@link #format} field.
|
||||
* <p>
|
||||
* Barcodes that contain structured data (commonly done with QR codes) are parsed and iff valid, the {@link #valueFormat} field is set to one of the value format constants (e.g. {@link #GEO}) and the corresponding field is set (e.g. {@link #geoPoint}).
|
||||
*/
|
||||
@PublicApi
|
||||
public class Barcode extends AutoSafeParcelable {
|
||||
/**
|
||||
* Barcode value format constant for contact information.
|
||||
* Specifies the format of a Barcode value via the {@link #valueFormat} field.
|
||||
*/
|
||||
public static final int CONTACT_INFO = 1;
|
||||
/**
|
||||
* Barcode value format constant for email message details.
|
||||
* Specifies the format of a Barcode value via the {@link #valueFormat} field.
|
||||
*/
|
||||
public static final int EMAIL = 2;
|
||||
/**
|
||||
* Barcode value format constant for ISBNs.
|
||||
* Specifies the format of a Barcode value via the {@link #valueFormat} field.
|
||||
*/
|
||||
public static final int ISBN = 3;
|
||||
/**
|
||||
* Barcode value format constant for phone numbers.
|
||||
* Specifies the format of a Barcode value via the {@link #valueFormat} field.
|
||||
*/
|
||||
public static final int PHONE = 4;
|
||||
/**
|
||||
* Barcode value format constant for product codes.
|
||||
* Specifies the format of a Barcode value via the {@link #valueFormat} field.
|
||||
*/
|
||||
public static final int PRODUCT = 5;
|
||||
/**
|
||||
* Barcode value format constant for SMS details.
|
||||
* Specifies the format of a Barcode value via the {@link #valueFormat} field.
|
||||
*/
|
||||
public static final int SMS = 6;
|
||||
/**
|
||||
* Barcode value format constant for plain text.
|
||||
* Specifies the format of a Barcode value via the {@link #valueFormat} field.
|
||||
*/
|
||||
public static final int TEXT = 7;
|
||||
/**
|
||||
* Barcode value format constant for URLs/bookmarks.
|
||||
* Specifies the format of a Barcode value via the {@link #valueFormat} field.
|
||||
*/
|
||||
public static final int URL = 8;
|
||||
/**
|
||||
* Barcode value format constant for WiFi access point details.
|
||||
* Specifies the format of a Barcode value via the {@link #valueFormat} field.
|
||||
*/
|
||||
public static final int WIFI = 9;
|
||||
/**
|
||||
* Barcode value format constant for geographic coordinates.
|
||||
* Specifies the format of a Barcode value via the {@link #valueFormat} field.
|
||||
*/
|
||||
public static final int GEO = 10;
|
||||
/**
|
||||
* Barcode value format constant for calendar events.
|
||||
* Specifies the format of a Barcode value via the {@link #valueFormat} field.
|
||||
*/
|
||||
public static final int CALENDAR_EVENT = 11;
|
||||
public static final int DRIVER_LICENSE = 12;
|
||||
|
||||
/**
|
||||
* Barcode format constant representing the union of all supported formats.
|
||||
* Pass into {@link BarcodeDetector.Builder#setBarcodeFormats(int)} to select formats to recognize.
|
||||
* This is also the default setting.
|
||||
*/
|
||||
public static final int ALL_FORMATS = 0;
|
||||
/**
|
||||
* Barcode format constant for Code 128.
|
||||
* Pass into {@link BarcodeDetector.Builder#setBarcodeFormats(int)} to select formats to recognize,
|
||||
* and also specifies a detected Barcode's {@link #format} via the format field.
|
||||
*/
|
||||
public static final int CODE_128 = 1;
|
||||
/**
|
||||
* Barcode format constant for Code 39.
|
||||
* Pass into {@link BarcodeDetector.Builder#setBarcodeFormats(int)} to select formats to recognize,
|
||||
* and also specifies a detected Barcode's {@link #format} via the format field.
|
||||
*/
|
||||
public static final int CODE_39 = 2;
|
||||
/**
|
||||
* Barcode format constant for Code 93.
|
||||
* Pass into {@link BarcodeDetector.Builder#setBarcodeFormats(int)} to select formats to recognize,
|
||||
* and also specifies a detected Barcode's {@link #format} via the format field.
|
||||
*/
|
||||
public static final int CODE_93 = 4;
|
||||
/**
|
||||
* Barcode format constant for Codebar.
|
||||
* Pass into {@link BarcodeDetector.Builder#setBarcodeFormats(int)} to select formats to recognize,
|
||||
* and also specifies a detected Barcode's {@link #format} via the format field.
|
||||
*/
|
||||
public static final int CODABAR = 8;
|
||||
/**
|
||||
* Barcode format constant for Data Matrix.
|
||||
* Pass into {@link BarcodeDetector.Builder#setBarcodeFormats(int)} to select formats to recognize,
|
||||
* and also specifies a detected Barcode's {@link #format} via the format field.
|
||||
*/
|
||||
public static final int DATA_MATRIX = 16;
|
||||
/**
|
||||
* Barcode format constant for EAN-13.
|
||||
* Pass into {@link BarcodeDetector.Builder#setBarcodeFormats(int)} to select formats to recognize,
|
||||
* and also specifies a detected Barcode's {@link #format} via the format field.
|
||||
*/
|
||||
public static final int EAN_13 = 32;
|
||||
/**
|
||||
* Barcode format constant for EAN-8.
|
||||
* Pass into {@link BarcodeDetector.Builder#setBarcodeFormats(int)} to select formats to recognize,
|
||||
* and also specifies a detected Barcode's {@link #format} via the format field.
|
||||
*/
|
||||
public static final int EAN_8 = 64;
|
||||
/**
|
||||
* Barcode format constant for ITF (Interleaved Two-of-Five).
|
||||
* Pass into {@link BarcodeDetector.Builder#setBarcodeFormats(int)} to select formats to recognize,
|
||||
* and also specifies a detected Barcode's {@link #format} via the format field.
|
||||
*/
|
||||
public static final int ITF = 128;
|
||||
/**
|
||||
* Barcode format constant for QR Code.
|
||||
* Pass into {@link BarcodeDetector.Builder#setBarcodeFormats(int)} to select formats to recognize,
|
||||
* and also specifies a detected Barcode's {@link #format} via the format field.
|
||||
*/
|
||||
public static final int QR_CODE = 256;
|
||||
/**
|
||||
* Barcode format constant for UPC-A.
|
||||
* Pass into {@link BarcodeDetector.Builder#setBarcodeFormats(int)} to select formats to recognize,
|
||||
* and also specifies a detected Barcode's {@link #format} via the format field.
|
||||
*/
|
||||
public static final int UPC_A = 512;
|
||||
/**
|
||||
* Barcode format constant for UPC-E.
|
||||
* Pass into {@link BarcodeDetector.Builder#setBarcodeFormats(int)} to select formats to recognize,
|
||||
* and also specifies a detected Barcode's {@link #format} via the format field.
|
||||
*/
|
||||
public static final int UPC_E = 1024;
|
||||
/**
|
||||
* Barcode format constant for PDF-417.
|
||||
* Pass into {@link BarcodeDetector.Builder#setBarcodeFormats(int)} to select formats to recognize,
|
||||
* and also specifies a detected Barcode's {@link #format} via the format field.
|
||||
*/
|
||||
public static final int PDF417 = 2048;
|
||||
/**
|
||||
* Barcode format constant for AZTEC.
|
||||
* Pass into {@link BarcodeDetector.Builder#setBarcodeFormats(int)} to select formats to recognize,
|
||||
* and also specifies a detected Barcode's {@link #format} via the format field.
|
||||
*/
|
||||
public static final int AZTEC = 4096;
|
||||
|
||||
@Field(1)
|
||||
private final int versionCode = 1;
|
||||
/**
|
||||
* Barcode format, for example {@link #EAN_13}.
|
||||
* <p>
|
||||
* Note that this field may contain values not present in the current set of format constants.
|
||||
* When mapping this value to something else, it is advisable to have a default/fallback case.
|
||||
*/
|
||||
@Field(2)
|
||||
public int format;
|
||||
/**
|
||||
* Barcode value as it was encoded in the barcode. Structured values are not parsed, for example: 'MEBKM:TITLE:Google;URL://www.google.com;;' Does not include the supplement value.
|
||||
*/
|
||||
@Field(3)
|
||||
public String rawValue;
|
||||
/**
|
||||
* Barcode value in a user-friendly format.
|
||||
* May omit some of the information encoded in the barcode.
|
||||
* For example, in the case above the display_value might be '//www.google.com'.
|
||||
* If {@link #valueFormat}=={@link #TEXT}, this field will be equal to {@link #rawValue}.
|
||||
* This value may be multiline, for example, when line breaks are encoded into the original {@link #TEXT} barcode value.
|
||||
* May include the supplement value.
|
||||
*/
|
||||
@Field(4)
|
||||
public String displayValue;
|
||||
/**
|
||||
* Format of the barcode value. For example, {@link #TEXT}, {@link #PRODUCT}, {@link #URL}, etc.
|
||||
* <p>
|
||||
* Note that this field may contain values not present in the current set of value format constants.
|
||||
* When mapping this value to something else, it is advisable to have a default/fallback case.
|
||||
*/
|
||||
@Field(5)
|
||||
public int valueFormat;
|
||||
/**
|
||||
* 4 corner points in clockwise direction starting with top-left.
|
||||
* Due to the possible perspective distortions, this is not necessarily a rectangle.
|
||||
*/
|
||||
@Field(6)
|
||||
public Point[] cornerPoints;
|
||||
/**
|
||||
* Parsed email details (set iff {@link #valueFormat} is {@link #EMAIL}).
|
||||
*/
|
||||
@Nullable
|
||||
@Field(7)
|
||||
public Barcode.Email email;
|
||||
/**
|
||||
* Parsed phone details (set iff {@link #valueFormat} is {@link #PHONE}).
|
||||
*/
|
||||
@Nullable
|
||||
@Field(8)
|
||||
public Barcode.Phone phone;
|
||||
/**
|
||||
* Parsed SMS details (set iff {@link #valueFormat} is {@link #SMS}).
|
||||
*/
|
||||
@Nullable
|
||||
@Field(9)
|
||||
public Barcode.Sms sms;
|
||||
/**
|
||||
* Parsed WiFi AP details (set iff {@link #valueFormat} is {@link #WIFI}).
|
||||
*/
|
||||
@Nullable
|
||||
@Field(10)
|
||||
public Barcode.WiFi wifi;
|
||||
/**
|
||||
* Parsed URL bookmark details (set iff {@link #valueFormat} is {@link #URL}).
|
||||
*/
|
||||
@Nullable
|
||||
@Field(11)
|
||||
public Barcode.UrlBookmark url;
|
||||
/**
|
||||
* Parsed geo coordinates (set iff {@link #valueFormat} is {@link #GEO}).
|
||||
*/
|
||||
@Nullable
|
||||
@Field(12)
|
||||
public Barcode.GeoPoint geoPoint;
|
||||
/**
|
||||
* Parsed calendar event details (set iff {@link #valueFormat} is {@link #CALENDAR_EVENT}).
|
||||
*/
|
||||
@Nullable
|
||||
@Field(13)
|
||||
public Barcode.CalendarEvent calendarEvent;
|
||||
/**
|
||||
* Parsed contact details (set iff {@link #valueFormat} is {@link #CONTACT_INFO}).
|
||||
*/
|
||||
@Nullable
|
||||
@Field(14)
|
||||
public Barcode.ContactInfo contactInfo;
|
||||
/**
|
||||
* Parsed driver's license details (set iff {@link #valueFormat} is {@link #DRIVER_LICENSE}).
|
||||
*/
|
||||
@Nullable
|
||||
@Field(15)
|
||||
public Barcode.DriverLicense driverLicense;
|
||||
/**
|
||||
* Barcode value as it was encoded in the barcode as byte array.
|
||||
*/
|
||||
@Field(16)
|
||||
public byte[] rawBytes;
|
||||
/**
|
||||
* If outputUnrecognizedBarcodes is set, isRecognized can be set to false to indicate failure in decoding the detected barcode.
|
||||
*/
|
||||
@Field(17)
|
||||
public boolean isRecognized;
|
||||
|
||||
/**
|
||||
* Returns the barcode's axis-aligned bounding box.
|
||||
*/
|
||||
public Rect getBoundingBox() {
|
||||
int left = Integer.MAX_VALUE, top = Integer.MIN_VALUE, right = Integer.MIN_VALUE, bottom = Integer.MAX_VALUE;
|
||||
for (Point point : cornerPoints) {
|
||||
left = Math.min(left, point.x);
|
||||
top = Math.max(top, point.y);
|
||||
right = Math.max(right, point.x);
|
||||
bottom = Math.min(bottom, point.y);
|
||||
}
|
||||
return new Rect(left, top, right, bottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* An address.
|
||||
*/
|
||||
public static class Address extends AutoSafeParcelable {
|
||||
/**
|
||||
* Address type.
|
||||
*/
|
||||
public static final int UNKNOWN = 0;
|
||||
public static final int WORK = 1;
|
||||
public static final int HOME = 2;
|
||||
|
||||
@Field(1)
|
||||
private int versionCode = 1;
|
||||
@Field(2)
|
||||
public int type;
|
||||
/**
|
||||
* Formatted address, multiple lines when appropriate. This field always contains at least one line.
|
||||
*/
|
||||
@Field(3)
|
||||
public String[] addressLines;
|
||||
|
||||
public static Creator<Address> CREATOR = new AutoCreator<>(Address.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* DateTime data type used in calendar events. If hours/minutes/seconds are not specified in the barcode value, they will be set to -1.
|
||||
*/
|
||||
public static class CalendarDateTime extends AutoSafeParcelable {
|
||||
@Field(1)
|
||||
private int versionCode = 1;
|
||||
@Field(2)
|
||||
public int year;
|
||||
@Field(3)
|
||||
public int month;
|
||||
@Field(4)
|
||||
public int day;
|
||||
@Field(5)
|
||||
public int hours;
|
||||
@Field(6)
|
||||
public int minutes;
|
||||
@Field(7)
|
||||
public int seconds;
|
||||
@Field(8)
|
||||
public boolean isUtc;
|
||||
@Field(9)
|
||||
public String rawValue;
|
||||
|
||||
public static Creator<CalendarDateTime> CREATOR = new AutoCreator<>(CalendarDateTime.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* A calendar event extracted from QRCode.
|
||||
*/
|
||||
public static class CalendarEvent extends AutoSafeParcelable {
|
||||
@Field(1)
|
||||
private int versionCode = 1;
|
||||
@Field(2)
|
||||
public String summary;
|
||||
@Field(3)
|
||||
public String description;
|
||||
@Field(4)
|
||||
public String location;
|
||||
@Field(5)
|
||||
public String organizer;
|
||||
@Field(6)
|
||||
public String status;
|
||||
@Field(7)
|
||||
public Barcode.CalendarDateTime start;
|
||||
@Field(8)
|
||||
public Barcode.CalendarDateTime end;
|
||||
|
||||
public static Creator<CalendarEvent> CREATOR = new AutoCreator<>(CalendarEvent.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* A person's or organization's business card. For example a VCARD.
|
||||
*/
|
||||
public static class ContactInfo extends AutoSafeParcelable {
|
||||
@Field(1)
|
||||
private int versionCode = 1;
|
||||
@Field(2)
|
||||
public Barcode.PersonName name;
|
||||
@Field(3)
|
||||
public String organization;
|
||||
@Field(4)
|
||||
public String title;
|
||||
@Field(5)
|
||||
public Barcode.Phone[] phones;
|
||||
@Field(6)
|
||||
public Barcode.Email[] emails;
|
||||
@Field(7)
|
||||
public String[] urls;
|
||||
@Field(8)
|
||||
public Barcode.Address[] addresses;
|
||||
|
||||
public static Creator<ContactInfo> CREATOR = new AutoCreator<>(ContactInfo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* A driver license or ID card.
|
||||
*/
|
||||
public static class DriverLicense extends AutoSafeParcelable {
|
||||
@Field(1)
|
||||
private int versionCode = 1;
|
||||
/**
|
||||
* "DL" for driver licenses, "ID" for ID cards.
|
||||
*/
|
||||
@Field(2)
|
||||
public String documentType;
|
||||
/**
|
||||
* Holder's first name.
|
||||
*/
|
||||
@Field(3)
|
||||
public String firstName;
|
||||
@Field(4)
|
||||
public String middleName;
|
||||
@Field(5)
|
||||
public String lastName;
|
||||
/**
|
||||
* Gender. 1 - male, 2 - female.
|
||||
*/
|
||||
@Field(6)
|
||||
public String gender;
|
||||
/**
|
||||
* Holder's street address.
|
||||
*/
|
||||
@Field(7)
|
||||
public String addressStreet;
|
||||
@Field(8)
|
||||
public String addressCity;
|
||||
@Field(9)
|
||||
public String addressState;
|
||||
@Field(10)
|
||||
public String addressZip;
|
||||
/**
|
||||
* Driver license ID number.
|
||||
*/
|
||||
@Field(11)
|
||||
public String licenseNumber;
|
||||
/**
|
||||
* The date format depends on the issuing country. MMDDYYYY for the US, YYYYMMDD for Canada.
|
||||
*/
|
||||
@Field(12)
|
||||
public String issueDate;
|
||||
@Field(13)
|
||||
public String expiryDate;
|
||||
@Field(14)
|
||||
public String birthDate;
|
||||
/**
|
||||
* Country in which DL/ID was issued. US = "USA", Canada = "CAN".
|
||||
*/
|
||||
@Field(15)
|
||||
public String issuingCountry;
|
||||
|
||||
public static Creator<DriverLicense> CREATOR = new AutoCreator<>(DriverLicense.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* An email message from a 'MAILTO:' or similar QRCode type.
|
||||
*/
|
||||
public static class Email extends AutoSafeParcelable {
|
||||
/**
|
||||
* Email type.
|
||||
*/
|
||||
public static final int UNKNOWN = 0;
|
||||
public static final int WORK = 1;
|
||||
public static final int HOME = 2;
|
||||
|
||||
@Field(1)
|
||||
private int versionCode = 1;
|
||||
@Field(2)
|
||||
public int type;
|
||||
@Field(3)
|
||||
public String address;
|
||||
@Field(4)
|
||||
public String subject;
|
||||
@Field(5)
|
||||
public String body;
|
||||
|
||||
public static Creator<Email> CREATOR = new AutoCreator<>(Email.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* GPS coordinates from a 'GEO:' or similar QRCode type.
|
||||
*/
|
||||
public static class GeoPoint extends AutoSafeParcelable {
|
||||
@Field(1)
|
||||
private int versionCode = 1;
|
||||
@Field(2)
|
||||
public double lat;
|
||||
@Field(3)
|
||||
public double lng;
|
||||
|
||||
public static Creator<GeoPoint> CREATOR = new AutoCreator<>(GeoPoint.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* A person's name, both formatted version and individual name components.
|
||||
*/
|
||||
public static class PersonName extends AutoSafeParcelable {
|
||||
@Field(1)
|
||||
private int versionCode = 1;
|
||||
/**
|
||||
* Properly formatted name.
|
||||
*/
|
||||
@Field(2)
|
||||
public String formattedName;
|
||||
/**
|
||||
* Designates a text string to be set as the kana name in the phonebook. Used for Japanese contacts.
|
||||
*/
|
||||
@Field(3)
|
||||
public String pronunciation;
|
||||
@Field(4)
|
||||
public String prefix;
|
||||
@Field(5)
|
||||
public String first;
|
||||
@Field(6)
|
||||
public String middle;
|
||||
@Field(7)
|
||||
public String last;
|
||||
@Field(8)
|
||||
public String suffix;
|
||||
|
||||
public static Creator<PersonName> CREATOR = new AutoCreator<>(PersonName.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* A phone number from a 'TEL:' or similar QRCode type.
|
||||
*/
|
||||
public static class Phone extends AutoSafeParcelable {
|
||||
/**
|
||||
* Phone type.
|
||||
*/
|
||||
public static final int UNKNOWN = 0;
|
||||
public static final int WORK = 1;
|
||||
public static final int HOME = 2;
|
||||
public static final int FAX = 3;
|
||||
public static final int MOBILE = 4;
|
||||
|
||||
@Field(1)
|
||||
private int versionCode = 1;
|
||||
@Field(2)
|
||||
public int type;
|
||||
@Field(3)
|
||||
public String number;
|
||||
|
||||
public static Creator<Phone> CREATOR = new AutoCreator<>(Phone.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* An sms message from an 'SMS:' or similar QRCode type.
|
||||
*/
|
||||
public static class Sms extends AutoSafeParcelable {
|
||||
@Field(1)
|
||||
private int versionCode = 1;
|
||||
@Field(2)
|
||||
public String message;
|
||||
@Field(3)
|
||||
public String phoneNumber;
|
||||
|
||||
public static Creator<Sms> CREATOR = new AutoCreator<>(Sms.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* A URL and title from a 'MEBKM:' or similar QRCode type.
|
||||
*/
|
||||
public static class UrlBookmark extends AutoSafeParcelable {
|
||||
@Field(1)
|
||||
private int versionCode = 1;
|
||||
@Field(2)
|
||||
public String title;
|
||||
/**
|
||||
* Bookmark URL. Note that some common errors may be corrected here. For example, "http//...", "http:...", etc. will be replaced with "//".
|
||||
*/
|
||||
@Field(3)
|
||||
public String url;
|
||||
|
||||
public static Creator<UrlBookmark> CREATOR = new AutoCreator<>(UrlBookmark.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* A wifi network parameters from a 'WIFI:' or similar QRCode type.
|
||||
*/
|
||||
public static class WiFi extends AutoSafeParcelable {
|
||||
/**
|
||||
* WiFi encryption type.
|
||||
*/
|
||||
public static final int OPEN = 1;
|
||||
public static final int WPA = 2;
|
||||
public static final int WEP = 3;
|
||||
|
||||
@Field(1)
|
||||
private int versionCode = 1;
|
||||
@Field(2)
|
||||
public String ssid;
|
||||
@Nullable
|
||||
@Field(3)
|
||||
public String password;
|
||||
@Field(4)
|
||||
public int encryptionType;
|
||||
|
||||
public static Creator<WiFi> CREATOR = new AutoCreator<>(WiFi.class);
|
||||
}
|
||||
|
||||
public static final Creator<Barcode> CREATOR = new AutoCreator<>(Barcode.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.barcode;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.IInterface;
|
||||
import android.os.RemoteException;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import com.google.android.gms.dynamic.ObjectWrapper;
|
||||
import com.google.android.gms.vision.Detector;
|
||||
import com.google.android.gms.vision.Frame;
|
||||
import com.google.android.gms.vision.barcode.internal.client.BarcodeDetectorOptions;
|
||||
import com.google.android.gms.vision.barcode.internal.client.INativeBarcodeDetector;
|
||||
import com.google.android.gms.vision.barcode.internal.client.INativeBarcodeDetectorCreator;
|
||||
import com.google.android.gms.vision.internal.FrameMetadataParcel;
|
||||
|
||||
import org.microg.gms.common.PublicApi;
|
||||
|
||||
/**
|
||||
* Recognizes barcodes (in a variety of 1D and 2D formats) in a supplied {@link Frame}.
|
||||
* <p>
|
||||
* Build new BarcodeDetector instances using {@link BarcodeDetector.Builder}. By default, BarcodeDetector searches for barcodes in every supported format. For the best performance it is highly recommended that you specify a narrower set of barcode formats to detect.
|
||||
* <p>
|
||||
* Recognition results are returned by {@link #detect(Frame)} as Barcode instances.
|
||||
*/
|
||||
@PublicApi
|
||||
public class BarcodeDetector extends Detector<Barcode> {
|
||||
private INativeBarcodeDetector remote;
|
||||
|
||||
private BarcodeDetector(INativeBarcodeDetector remote) {
|
||||
this.remote = remote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recognizes barcodes in the supplied {@link Frame}.
|
||||
*
|
||||
* @return mapping of int to {@link Barcode}, where the int domain represents an opaque ID for the barcode. Identical barcodes (as determined by their raw value) will have the same ID across frames.
|
||||
*/
|
||||
@Override
|
||||
public SparseArray<Barcode> detect(Frame frame) {
|
||||
if (frame == null) throw new IllegalArgumentException("No frame supplied.");
|
||||
SparseArray<Barcode> result = new SparseArray<>();
|
||||
if (remote != null) {
|
||||
FrameMetadataParcel metadataParcel = frame.getMetadata().createParcel();
|
||||
Barcode[] barcodes = null;
|
||||
if (frame.getBitmap() != null) {
|
||||
try {
|
||||
barcodes = remote.detectBitmap(ObjectWrapper.wrap(frame.getBitmap()), metadataParcel);
|
||||
} catch (RemoteException e) {
|
||||
// Ignore
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
barcodes = remote.detectBytes(ObjectWrapper.wrap(frame.getGrayscaleImageData()), metadataParcel);
|
||||
} catch (RemoteException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (barcodes != null) {
|
||||
for (Barcode barcode : barcodes) {
|
||||
result.append(barcode.rawValue.hashCode(), barcode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOperational() {
|
||||
return remote != null && super.isOperational();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
super.release();
|
||||
try {
|
||||
remote.close();
|
||||
} catch (RemoteException e) {
|
||||
// Ignore
|
||||
}
|
||||
remote = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Barcode detector builder.
|
||||
*/
|
||||
public static class Builder {
|
||||
private Context context;
|
||||
private BarcodeDetectorOptions options = new BarcodeDetectorOptions();
|
||||
|
||||
/**
|
||||
* Builder for BarcodeDetector.
|
||||
*/
|
||||
public Builder(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bit mask (containing values like {@link Barcode#QR_CODE} and so on) that selects which formats this barcode detector should recognize.
|
||||
* <p>
|
||||
* By default, the detector will recognize all supported formats. This corresponds to the special {@link Barcode#ALL_FORMATS} constant.
|
||||
*/
|
||||
public Builder setBarcodeFormats(int formats) {
|
||||
options.formats = formats;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a barcode detector instance using the provided settings. If the underlying native implementation is unavailable (e.g. hasn't been downloaded yet), the detector will always return an empty result set. In this case, it will report that it is non-operational via {@link BarcodeDetector#isOperational()}.
|
||||
* <p>
|
||||
* Note that this method may cause blocking disk reads and should not be called on an application's main thread. To avoid blocking the main thread, consider moving Detector construction to a background thread using {@link android.os.AsyncTask}. Enable {@link android.os.StrictMode} to automatically detect blocking operations on the main thread.
|
||||
*
|
||||
* @return new {@link BarcodeDetector} instance
|
||||
*/
|
||||
public BarcodeDetector build() {
|
||||
// TODO: Actually implement dynamite or load from remote
|
||||
INativeBarcodeDetector remote = null;
|
||||
try {
|
||||
Class<?> clazz = Class.forName("com.google.android.gms.vision.barcode.ChimeraNativeBarcodeDetectorCreator");
|
||||
Object instance = clazz.getConstructor().newInstance();
|
||||
INativeBarcodeDetectorCreator creator = INativeBarcodeDetectorCreator.Stub.asInterface(((IInterface) instance).asBinder());
|
||||
remote = creator.create(ObjectWrapper.wrap(context), options);
|
||||
} catch (Exception e) {
|
||||
// Ignore
|
||||
}
|
||||
return new BarcodeDetector(remote);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.barcode.internal.client;
|
||||
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
public class BarcodeDetectorOptions extends AutoSafeParcelable {
|
||||
@Field(1)
|
||||
public int versionCode = 1;
|
||||
@Field(2)
|
||||
public int formats;
|
||||
|
||||
public static Creator<BarcodeDetectorOptions> CREATOR = new AutoCreator<>(BarcodeDetectorOptions.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.face;
|
||||
|
||||
import android.graphics.PointF;
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SafeParcelable.Class
|
||||
public class Contour extends AbstractSafeParcelable {
|
||||
|
||||
@Field(1)
|
||||
public int type;
|
||||
@Field(2)
|
||||
public List<PointF> points;
|
||||
|
||||
@Constructor
|
||||
public Contour(@Param(1) int type, @Param(2) List<PointF> points) {
|
||||
this.type = type;
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<Contour> CREATOR = findCreator(Contour.class);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.face;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
|
||||
@SafeParcelable.Class
|
||||
public class Landmark extends AbstractSafeParcelable {
|
||||
|
||||
@Field(1)
|
||||
public int id;
|
||||
@Field(2)
|
||||
public Float x;
|
||||
@Field(3)
|
||||
public Float y;
|
||||
@Field(4)
|
||||
public int type;
|
||||
|
||||
@Constructor
|
||||
public Landmark(@Param(1) int id, @Param(2) Float x, @Param(3) Float y, @Param(4) int type) {
|
||||
this.id = id;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<Landmark> CREATOR = findCreator(Landmark.class);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.face.internal.client;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
|
||||
@SafeParcelable.Class
|
||||
public class DetectionOptions extends AbstractSafeParcelable {
|
||||
|
||||
@Field(2)
|
||||
public int mode;
|
||||
@Field(3)
|
||||
public int landmarkType;
|
||||
@Field(4)
|
||||
public int classificationType;
|
||||
@Field(5)
|
||||
public boolean prominentFaceOnly;
|
||||
@Field(6)
|
||||
public boolean trackingEnabled;
|
||||
@Field(7)
|
||||
public float minFaceSize;
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<DetectionOptions> CREATOR = findCreator(DetectionOptions.class);
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2025 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.vision.face.internal.client;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
|
||||
import com.google.android.gms.vision.face.Contour;
|
||||
import com.google.android.gms.vision.face.Landmark;
|
||||
|
||||
@SafeParcelable.Class
|
||||
public class FaceParcel extends AbstractSafeParcelable {
|
||||
|
||||
@Field(value = 1, defaultValue = "1")
|
||||
public final int versionCode;
|
||||
@Field(2)
|
||||
public final int id;
|
||||
@Field(3)
|
||||
public final float centerX;
|
||||
@Field(4)
|
||||
public final float centerY;
|
||||
@Field(5)
|
||||
public final float width;
|
||||
@Field(6)
|
||||
public final float height;
|
||||
@Field(7)
|
||||
public final float eulerY;
|
||||
@Field(8)
|
||||
public final float eulerZ;
|
||||
@Field(14)
|
||||
public final float eulerX;
|
||||
@Field(9)
|
||||
public final Landmark[] landmarks;
|
||||
@Field(10)
|
||||
public final float leftEyeOpenProbability;
|
||||
@Field(11)
|
||||
public final float rightEyeOpenProbability;
|
||||
@Field(12)
|
||||
public final float smileProbability;
|
||||
@Field(13)
|
||||
public final Contour[] contours;
|
||||
@Field(value = 15, defaultValue = "-1.0f")
|
||||
public final float confidenceScore;
|
||||
|
||||
@Constructor
|
||||
public FaceParcel(@Param(1) int versionCode, @Param(2) int id, @Param(3) float centerX, @Param(4) float centerY, @Param(5) float width, @Param(6) float height, @Param(7) float eulerY, @Param(8) float eulerZ, @Param(14) float eulerX, @Param(9) Landmark[] landmarks, @Param(10) float leftEyeOpenProbability, @Param(11) float rightEyeOpenProbability, @Param(12) float smileProbability, @Param(13) Contour[] contours, @Param(15) float confidenceScore) {
|
||||
this.versionCode = versionCode;
|
||||
this.id = id;
|
||||
this.centerX = centerX;
|
||||
this.centerY = centerY;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.eulerY = eulerY;
|
||||
this.eulerZ = eulerZ;
|
||||
this.eulerX = eulerX;
|
||||
this.landmarks = landmarks;
|
||||
this.leftEyeOpenProbability = leftEyeOpenProbability;
|
||||
this.rightEyeOpenProbability = rightEyeOpenProbability;
|
||||
this.smileProbability = smileProbability;
|
||||
this.contours = contours;
|
||||
this.confidenceScore = confidenceScore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
CREATOR.writeToParcel(this, dest, flags);
|
||||
}
|
||||
|
||||
public static final SafeParcelableCreatorAndWriter<FaceParcel> CREATOR = findCreator(FaceParcel.class);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue