diff options
author | dianlujitao <dianlujitao@lineageos.org> | 2019-05-31 16:06:44 +0800 |
---|---|---|
committer | Isaac Chen <tingyi364@gmail.com> | 2019-09-01 16:44:11 +0200 |
commit | cd5ba5fb3b1721df0d373c75d233afb867d128bf (patch) | |
tree | 40c6b9a1ba5e619642733c2deab9100fbb31550e /org.ifaa.android.manager | |
parent | 1f3925c3ae0743668b7438c6f2999c5b6943db35 (diff) |
wayne-common: Update IFAA for pie blobs
Change-Id: I2801cc3633416a1552c07230b68cf1d83b484edc
Diffstat (limited to 'org.ifaa.android.manager')
12 files changed, 363 insertions, 300 deletions
diff --git a/org.ifaa.android.manager/Android.mk b/org.ifaa.android.manager/Android.mk index 9fac348..c77d585 100644 --- a/org.ifaa.android.manager/Android.mk +++ b/org.ifaa.android.manager/Android.mk @@ -19,24 +19,11 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES := \ - $(call all-Iaidl-files-under, lib) \ - $(call all-java-files-under, lib) + $(call all-Iaidl-files-under, src) \ + $(call all-java-files-under, src) LOCAL_MODULE := org.ifaa.android.manager LOCAL_MODULE_TAGS := optional LOCAL_MODULE_CLASS := JAVA_LIBRARIES include $(BUILD_JAVA_LIBRARY) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_CERTIFICATE := platform -LOCAL_JAVA_LIBRARIES := org.ifaa.android.manager -LOCAL_MODULE_TAGS := optional -LOCAL_PACKAGE_NAME := IFAAService -LOCAL_PRIVATE_PLATFORM_APIS := true -LOCAL_PROGUARD_ENABLED := disabled - -include $(BUILD_PACKAGE) diff --git a/org.ifaa.android.manager/AndroidManifest.xml b/org.ifaa.android.manager/AndroidManifest.xml deleted file mode 100644 index 7a3b309..0000000 --- a/org.ifaa.android.manager/AndroidManifest.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (c) 2019 The LineageOS Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="org.ifaa.android.manager" - android:versionCode="1" - android:versionName="1" - android:sharedUserId="android.uid.system"> - - <uses-sdk - android:minSdkVersion="28" - android:targetSdkVersion="28" /> - - <application - android:label="IFAAService"> - - <service android:name=".IFAAService" - android:exported="true" /> - </application> -</manifest> diff --git a/org.ifaa.android.manager/lib/org/ifaa/android/manager/IFAAManagerImpl.java b/org.ifaa.android.manager/lib/org/ifaa/android/manager/IFAAManagerImpl.java deleted file mode 100644 index 34dd9d8..0000000 --- a/org.ifaa.android.manager/lib/org/ifaa/android/manager/IFAAManagerImpl.java +++ /dev/null @@ -1,180 +0,0 @@ -package org.ifaa.android.manager; - -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.ServiceConnection; -import android.os.Build; -import android.os.Build.VERSION; -import android.os.IBinder; -import android.os.IBinder.DeathRecipient; -import android.os.Parcel; -import android.os.RemoteException; -import android.os.SystemProperties; -import android.util.Slog; -import java.util.ArrayList; -import java.util.Arrays; -import org.json.JSONObject; - -public class IFAAManagerImpl extends IFAAManagerV3 { - private static final boolean DEBUG = false; - - private static final int IFAA_TYPE_FINGER = 1; - private static final int IFAA_TYPE_IRIS = (1 << 1); - private static final int IFAA_TYPE_SENSOR_FOD = (1 << 4); - - private static final int ACTIVITY_START_SUCCESS = 0; - private static final int ACTIVITY_START_FAILED = -1; - - private static volatile IFAAManagerImpl INSTANCE = null; - - private static final String TAG = "IfaaManagerImpl"; - - private static ServiceConnection ifaaconn = new ServiceConnection() { - @Override - public void onServiceConnected(ComponentName name, IBinder service) { - mService = IIFAAService.Stub.asInterface(service); - try { - mService.asBinder().linkToDeath(mDeathRecipient, 0); - } catch (RemoteException e) { - if (DEBUG) Slog.e(TAG, "linkToDeath fail.", e); - } - } - - @Override - public void onServiceDisconnected(ComponentName name) { - if (mContext != null) { - if (DEBUG) Slog.i(TAG, "re-bind the service."); - initService(); - } - } - }; - - private static Context mContext = null; - private static DeathRecipient mDeathRecipient = new DeathRecipient() { - @Override - public void binderDied() { - if (mService != null) { - if (DEBUG) Slog.d(TAG, "binderDied, unlink the service."); - mService.asBinder().unlinkToDeath(mDeathRecipient, 0); - } - } - }; - - private static final String mIfaaActName = "org.ifaa.android.manager.IFAAService"; - private static final String mIfaaPackName = "org.ifaa.android.manager"; - private static IIFAAService mService = null; - private static final String seperate = ","; - private String mDevModel = null; - - public static IFAAManagerV3 getInstance(Context context) { - if (INSTANCE == null) { - synchronized (IFAAManagerImpl.class) { - if (INSTANCE == null) { - INSTANCE = new IFAAManagerImpl(); - if (VERSION.SDK_INT >= 28) { - mContext = context; - initService(); - } - } - } - } - return INSTANCE; - } - - private String initExtString() { - String str = ""; - JSONObject location = new JSONObject(); - JSONObject fullView = new JSONObject(); - String xy = SystemProperties.get("persist.sys.fp.fod.location.X_Y", ""); - String wh = SystemProperties.get("persist.sys.fp.fod.size.width_height", ""); - - try { - if (validateVal(xy) && validateVal(wh)) { - String[] splitXy = xy.split(seperate); - String[] splitWh = wh.split(seperate); - fullView.put("startX", Integer.parseInt(splitXy[0])); - fullView.put("startY", Integer.parseInt(splitXy[1])); - fullView.put("width", Integer.parseInt(splitWh[0])); - fullView.put("height", Integer.parseInt(splitWh[1])); - fullView.put("navConflict", true); - location.put("type", 0); - location.put("fullView", fullView); - str = location.toString(); - } else { - if (DEBUG) Slog.e(TAG, "initExtString invalidate, xy:" + xy + " wh:" + wh); - } - } catch (Exception e) { - if (DEBUG) Slog.e(TAG, "Exception , xy:" + xy + " wh:" + wh, e); - } - return str; - } - - private static void initService() { - Intent intent = new Intent(); - intent.setClassName(mIfaaPackName, mIfaaActName); - if (!mContext.bindService(intent, ifaaconn, Context.BIND_AUTO_CREATE)) { - if (DEBUG) Slog.e(TAG, "cannot bind service org.ifaa.android.manager.IFAAService"); - } - } - - private boolean validateVal(String str) { - return !"".equalsIgnoreCase(str) && str.contains(","); - } - - public String getDeviceModel() { - if (mDevModel == null) { - mDevModel ="xiaomi" + "-" + "wayne"; - } - if (DEBUG) Slog.i(TAG, "getDeviceModel devcieModel:" + mDevModel); - return mDevModel; - } - - public String getExtInfo(int authType, String keyExtInfo) { - return initExtString(); - } - - public int getSupportBIOTypes(Context context) { - int ifaaType = SystemProperties.getInt("persist.sys.ifaa", 0); - String fpVendor = SystemProperties.get("persist.sys.fp.vendor", ""); - int supportBIOTypes = "none".equalsIgnoreCase(fpVendor) ? ifaaType & IFAA_TYPE_IRIS : - ifaaType & (IFAA_TYPE_FINGER | IFAA_TYPE_IRIS); - if ((supportBIOTypes & IFAA_TYPE_FINGER) == IFAA_TYPE_FINGER && sIsFod) { - supportBIOTypes |= IFAA_TYPE_SENSOR_FOD; - } - if (DEBUG) Slog.i(TAG, "getSupportBIOTypes:" + ifaaType + " " + sIsFod + " " + fpVendor + - " res:" + supportBIOTypes); - return supportBIOTypes; - } - - public int getVersion() { - if (DEBUG) Slog.i(TAG, "getVersion sdk:" + VERSION.SDK_INT + " ifaaVer:" + sIfaaVer); - return sIfaaVer; - } - - public byte[] processCmdV2(Context context, byte[] data) { - if (DEBUG) Slog.i(TAG, "processCmdV2 sdk:" + VERSION.SDK_INT); - - try { - return mService.processCmd_v2(data); - } catch (RemoteException e) { - if (DEBUG) Slog.e(TAG, "processCmdV2 transact failed. " + e); - } - return null; - } - - public void setExtInfo(int authType, String keyExtInfo, String valExtInfo) { - } - - public int startBIOManager(Context context, int authType) { - int res = ACTIVITY_START_FAILED; - if (authType == IFAA_TYPE_FINGER) { - Intent intent = new Intent("android.settings.SECURITY_SETTINGS"); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - context.startActivity(intent); - res = ACTIVITY_START_SUCCESS; - } - if (DEBUG) Slog.i(TAG, "startBIOManager authType:" + authType + " res:" + res); - return res; - } -} diff --git a/org.ifaa.android.manager/lib/org/ifaa/android/manager/IIFAAService.aidl b/org.ifaa.android.manager/lib/org/ifaa/android/manager/IIFAAService.aidl deleted file mode 100644 index 8dadb55..0000000 --- a/org.ifaa.android.manager/lib/org/ifaa/android/manager/IIFAAService.aidl +++ /dev/null @@ -1,5 +0,0 @@ -package org.ifaa.android.manager; - -interface IIFAAService { - byte[] processCmd_v2(in byte[] param); -} diff --git a/org.ifaa.android.manager/lib/org/ifaa/android/manager/IFAAManager.java b/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManager.java index d7ffc5a..b793d36 100644 --- a/org.ifaa.android.manager/lib/org/ifaa/android/manager/IFAAManager.java +++ b/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManager.java @@ -7,6 +7,7 @@ import android.os.SystemProperties; public abstract class IFAAManager { private static final int IFAA_VERSION_V2 = 2; private static final int IFAA_VERSION_V3 = 3; + private static final int IFAA_VERSION_V4 = 4; static int sIfaaVer; static boolean sIsFod = SystemProperties.getBoolean("ro.hardware.fp.fod", false); @@ -47,7 +48,9 @@ public abstract class IFAAManager { */ static { sIfaaVer = 1; - if (sIsFod) { + if (VERSION.SDK_INT >= 28) { + sIfaaVer = 4; + } else if (sIsFod) { sIfaaVer = 3; } else if (VERSION.SDK_INT >= 24) { sIfaaVer = 2; diff --git a/org.ifaa.android.manager/lib/org/ifaa/android/manager/IFAAManagerFactory.java b/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerFactory.java index 97a948a..97a948a 100644 --- a/org.ifaa.android.manager/lib/org/ifaa/android/manager/IFAAManagerFactory.java +++ b/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerFactory.java diff --git a/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerImpl.java b/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerImpl.java new file mode 100644 index 0000000..9c478ca --- /dev/null +++ b/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerImpl.java @@ -0,0 +1,338 @@ +package org.ifaa.android.manager; + +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; +import android.os.Build; +import android.os.Build.VERSION; +import android.os.HwBinder; +import android.os.HwBlob; +import android.os.HwParcel; +import android.os.IBinder; +import android.os.IBinder.DeathRecipient; +import android.os.IHwBinder; +import android.os.Parcel; +import android.os.RemoteException; +import android.os.SystemProperties; +import android.util.Slog; + +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.Arrays; + +public class IFAAManagerImpl extends IFAAManagerV4 { + private static final boolean DEBUG = false; + private static final String TAG = "IfaaManagerImpl"; + + private static final int CODE_PROCESS_CMD = 1; + private static final int CODE_GETIDLIST_CMD = 2; + + private static final int IFAA_TYPE_FINGER = 1; + private static final int IFAA_TYPE_IRIS = (1 << 1); + private static final int IFAA_TYPE_SENSOR_FOD = (1 << 4); + private static final int IFAA_TYPE_2DFA = (1 << 5); + + private static volatile IFAAManagerImpl INSTANCE = null; + + private static final String INTERFACE_DESCRIPTOR = "vendor.xiaomi.hardware.mlipay@1.0::IMlipayService"; + private static final String SERVICE_NAME = "vendor.xiaomi.hardware.mlipay@1.0::IMlipayService"; + + private static final int ACTIVITY_START_SUCCESS = 0; + private static final int ACTIVITY_START_FAILED = -1; + // private static final String mFingerActName = "com.android.settings.NewFingerprintActivity"; + // private static final String mFingerPackName = "com.android.settings"; + private static final String mIfaaActName = "org.ifaa.android.manager.IFAAService"; + private static final String mIfaaInterfaceDesc = "org.ifaa.android.manager.IIFAAService"; + private static final String mIfaaPackName = "com.tencent.soter.soterserver"; + + private static IBinder mService = null; + private static final String seperate = ","; + private String mDevModel = null; + + private static Context mContext = null; + + private static ServiceConnection ifaaconn = new ServiceConnection() { + public void onServiceConnected(ComponentName name, IBinder service) { + mService = service; + try { + mService.linkToDeath(mDeathRecipient, 0); + } catch (RemoteException e) { + Slog.e(TAG, "linkToDeath fail.", e); + } + } + + public void onServiceDisconnected(ComponentName name) { + if (mContext != null) { + Slog.i(IFAAManagerImpl.TAG, "re-bind the service."); + initService(); + } + } + }; + + private static DeathRecipient mDeathRecipient = new DeathRecipient() { + public void binderDied() { + if (mService != null) { + Slog.d(TAG, "binderDied, unlink the service."); + mService.unlinkToDeath(mDeathRecipient, 0); + } + } + }; + + public static IFAAManagerV4 getInstance(Context context) { + if (INSTANCE == null) { + synchronized (IFAAManagerImpl.class) { + if (INSTANCE == null) { + INSTANCE = new IFAAManagerImpl(); + if (VERSION.SDK_INT >= 28) { + mContext = context; + initService(); + } + } + } + } + return INSTANCE; + } + + private static void initService() { + Intent ifaaIntent = new Intent(); + ifaaIntent.setClassName(mIfaaPackName, mIfaaActName); + if (!mContext.bindService(ifaaIntent, ifaaconn, 1)) { + Slog.e(TAG, "cannot bind service org.ifaa.android.manager.IFAAService"); + } + } + + public int getSupportBIOTypes(Context context) { + int ifaaProp; + int res; + String fpVendor; + int ifaa_2dfa_support = 0; // FeatureParser.getInteger("ifaa_2dfa_support", 0); + + if (VERSION.SDK_INT >= 28) { + ifaaProp = SystemProperties.getInt("persist.vendor.sys.pay.ifaa", 0); + fpVendor = SystemProperties.get( + "persist.vendor.sys.fp.vendor", ""); + } else { + ifaaProp = SystemProperties.getInt("persist.sys.ifaa", 0); + fpVendor = SystemProperties.get("persist.sys.fp.vendor", ""); + } + + if ("none".equalsIgnoreCase(fpVendor)) { + res = ifaaProp & IFAA_TYPE_IRIS; + } else { + res = ifaaProp & (IFAA_TYPE_FINGER | IFAA_TYPE_IRIS); + } + + if ((res & IFAA_TYPE_FINGER) == IFAA_TYPE_FINGER && sIsFod) { + res |= IFAA_TYPE_SENSOR_FOD; + } + + if (ifaa_2dfa_support == 1 && IFAAManagerV3.VLAUE_FINGERPRINT_ENABLE.equals( + SystemProperties.get("ro.boot.hypvm", ""))) { + res |= IFAA_TYPE_2DFA; + } + + Slog.i(TAG, "getSupportBIOTypesV26:" + ifaaProp + " " + sIsFod + " " + fpVendor + + " res:" + res); + + return res; + } + + public int startBIOManager(Context context, int authType) { + int res = ACTIVITY_START_FAILED; + if (IFAA_TYPE_FINGER == authType) { + // Intent intent = new Intent(); + // intent.setClassName("com.android.settings", mFingerActName); + Intent intent = new Intent("android.settings.SECURITY_SETTINGS"); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(intent); + res = ACTIVITY_START_SUCCESS; + } + if (DEBUG) Slog.i(TAG, "startBIOManager authType:" + authType + " res:" + res); + return res; + } + + public String getDeviceModel() { + // String miuiFeature; + if (mDevModel == null) { + // miuiFeature = FeatureParser.getString("finger_alipay_ifaa_model"); + // if (miuiFeature != null) { + // if (!StringUtils.EMPTY.equalsIgnoreCase(miuiFeature)) { + // this.mDevModel = miuiFeature; + // } + // } + mDevModel = "xiaomi" + "-" + "wayne"; + } + if (DEBUG) Slog.i(TAG, "getDeviceModel devcieModel:" + mDevModel); + return mDevModel; + } + + public int getVersion() { + if (DEBUG) Slog.i(TAG, "getVersion sdk:" + VERSION.SDK_INT + " ifaaVer:" + sIfaaVer); + return sIfaaVer; + } + + public byte[] processCmdV2(Context context, byte[] param) { + Slog.i(TAG, "processCmdV2 sdk:" + VERSION.SDK_INT); + + if (VERSION.SDK_INT >= 28) { + int retry_count = 10; + + while (true) { + int retry_count2 = retry_count - 1; + if (retry_count <= 0) { + break; + } + if (mService == null || !mService.pingBinder()) { + Slog.i(TAG, "processCmdV2 waiting ifaaService, remain: " + + retry_count2 + " time(s)"); + try { + Thread.sleep(30); + } catch (InterruptedException e) { + Slog.e(TAG, "processCmdV2 InterruptedException while waiting: " + e); + } + } else { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + try { + data.writeInterfaceToken(mIfaaInterfaceDesc); + data.writeByteArray(param); + mService.transact(CODE_PROCESS_CMD, data, reply, 0); + reply.readException(); + return reply.createByteArray(); + } catch (RemoteException e) { + Slog.e(TAG, "processCmdV2 transact failed. " + e); + retry_count = retry_count2; + } finally { + data.recycle(); + reply.recycle(); + } + } + retry_count = retry_count2; + } + } + HwParcel hidl_reply = new HwParcel(); + try { + IHwBinder hwService = HwBinder.getService(SERVICE_NAME, "default"); + if (hwService != null) { + HwParcel hidl_request = new HwParcel(); + hidl_request.writeInterfaceToken(INTERFACE_DESCRIPTOR); + ArrayList<Byte> sbuf = new ArrayList(Arrays.asList(HwBlob.wrapArray(param))); + hidl_request.writeInt8Vector(sbuf); + hidl_request.writeInt32(sbuf.size()); + hwService.transact(CODE_PROCESS_CMD, hidl_request, hidl_reply, 0); + hidl_reply.verifySuccess(); + hidl_request.releaseTemporaryStorage(); + ArrayList<Byte> val = hidl_reply.readInt8Vector(); + int n = val.size(); + byte[] array = new byte[n]; + for (int i = 0; i < n; i++) { + array[i] = ((Byte) val.get(i)).byteValue(); + } + hidl_reply.release(); + return array; + } + } catch (RemoteException e) { + Slog.e(TAG, "transact failed. " + e); + } finally { + hidl_reply.release(); + } + Slog.e(TAG, "processCmdV2, return null"); + return null; + } + + public String getExtInfo(int authType, String keyExtInfo) { + return initExtString(); + } + + public void setExtInfo(int authType, String keyExtInfo, String valExtInfo) { + } + + public int getEnabled(int bioType) { + if (IFAA_TYPE_FINGER == bioType) { + return 1000; + } + return 1003; + } + + public int[] getIDList(int bioType) { + int[] idList = new int[]{0}; + if (IFAA_TYPE_FINGER == bioType) { + int retry_count = 10; + while (true) { + int retry_count2 = retry_count - 1; + if (retry_count <= 0) { + break; + } + if (mService == null || !mService.pingBinder()) { + try { + Thread.sleep(30); + } catch (InterruptedException e) { + Slog.e(TAG, "getIDList InterruptedException while waiting: " + e); + } + } else { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + try { + data.writeInterfaceToken(mIfaaInterfaceDesc); + data.writeInt(bioType); + mService.transact(CODE_GETIDLIST_CMD, data, reply, 0); + reply.readException(); + idList = reply.createIntArray(); + } catch (RemoteException e) { + Slog.e(TAG, "getIDList transact failed. " + e); + } finally { + data.recycle(); + reply.recycle(); + } + } + retry_count = retry_count2; + } + } + return idList; + } + + private String initExtString() { + String extStr = ""; + JSONObject obj = new JSONObject(); + JSONObject keyInfo = new JSONObject(); + String xy = ""; + String wh = ""; + + if (VERSION.SDK_INT >= 28) { + xy = SystemProperties.get("persist.vendor.sys.fp.fod.location.X_Y", ""); + wh = SystemProperties.get("persist.vendor.sys.fp.fod.size.width_height", ""); + } else { + xy = SystemProperties.get("persist.sys.fp.fod.location.X_Y", ""); + wh = SystemProperties.get("persist.sys.fp.fod.size.width_height", ""); + } + + try { + if (validateVal(xy) && validateVal(wh)) { + String[] splitXy = xy.split(seperate); + String[] splitWh = wh.split(seperate); + keyInfo.put("startX", Integer.parseInt(splitXy[0])); + keyInfo.put("startY", Integer.parseInt(splitXy[1])); + keyInfo.put("width", Integer.parseInt(splitWh[0])); + keyInfo.put("height", Integer.parseInt(splitWh[1])); + keyInfo.put("navConflict", true); + obj.put("type", 0); + obj.put("fullView", keyInfo); + extStr = obj.toString(); + } else { + Slog.e(TAG, "initExtString invalidate, xy:" + xy + " wh:" + wh); + } + } catch (Exception e) { + Slog.e(TAG, "Exception , xy:" + xy + " wh:" + wh, e); + } + return extStr; + } + + private boolean validateVal(String value) { + if ("".equalsIgnoreCase(value) || !value.contains(seperate)) { + return false; + } + return true; + } +} diff --git a/org.ifaa.android.manager/lib/org/ifaa/android/manager/IFAAManagerV2.java b/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerV2.java index 2d7e3f5..2d7e3f5 100644 --- a/org.ifaa.android.manager/lib/org/ifaa/android/manager/IFAAManagerV2.java +++ b/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerV2.java diff --git a/org.ifaa.android.manager/lib/org/ifaa/android/manager/IFAAManagerV3.java b/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerV3.java index 50e677d..50e677d 100644 --- a/org.ifaa.android.manager/lib/org/ifaa/android/manager/IFAAManagerV3.java +++ b/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerV3.java diff --git a/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerV4.java b/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerV4.java new file mode 100644 index 0000000..6d0a4d5 --- /dev/null +++ b/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerV4.java @@ -0,0 +1,7 @@ +package org.ifaa.android.manager; + +public abstract class IFAAManagerV4 extends IFAAManagerV3 { + public abstract int getEnabled(int bioType); + + public abstract int[] getIDList(int bioType); +} diff --git a/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAService.java b/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAService.java deleted file mode 100644 index 14299d3..0000000 --- a/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAService.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.ifaa.android.manager; - -import android.app.Service; -import android.content.Intent; -import android.os.HwBinder; -import android.os.HwBlob; -import android.os.HwParcel; -import android.os.IBinder; -import android.os.IHwBinder; -import android.os.RemoteException; -import android.util.Slog; -import java.util.ArrayList; -import java.util.Arrays; - -public class IFAAService extends Service { - private static final boolean DEBUG = false; - private static final String TAG = "IFAAService"; - - private final IBinder mIFAABinder = new IIFAAService.Stub() { - private static final String INTERFACE_DESCRIPTOR = - "vendor.xiaomi.hardware.mlipay@1.0::IMlipayService"; - private static final String SERVICE_NAME = - "vendor.xiaomi.hardware.mlipay@1.0::IMlipayService"; - - private static final int CODE_PROCESS_CMD = 1; - - private IHwBinder mService; - - @Override - public byte[] processCmd_v2(byte[] param) { - HwParcel reply = new HwParcel(); - try { - if (mService == null) { - mService = HwBinder.getService(SERVICE_NAME, "default"); - } - if (mService != null) { - HwParcel data = new HwParcel(); - data.writeInterfaceToken(INTERFACE_DESCRIPTOR); - ArrayList arrayList = new ArrayList(Arrays.asList(HwBlob.wrapArray(param))); - data.writeInt8Vector(arrayList); - data.writeInt32(arrayList.size()); - mService.transact(CODE_PROCESS_CMD, data, reply, 0); - reply.verifySuccess(); - data.releaseTemporaryStorage(); - ArrayList readInt8Vector = reply.readInt8Vector(); - int size = readInt8Vector.size(); - byte[] result = new byte[size]; - for (int i = 0; i < size; i++) { - result[i] = ((Byte) readInt8Vector.get(i)).byteValue(); - } - return result; - } - } catch (RemoteException e) { - if (DEBUG) Slog.e(TAG, "transact failed. " + e); - } finally { - reply.release(); - } - if (DEBUG) Slog.e(TAG, "processCmdV2, return null"); - return null; - } - }; - - @Override - public IBinder onBind(Intent intent) { - return mIFAABinder; - } -} diff --git a/org.ifaa.android.manager/src/org/ifaa/android/manager/IIFAAService.aidl b/org.ifaa.android.manager/src/org/ifaa/android/manager/IIFAAService.aidl new file mode 100644 index 0000000..80937fe --- /dev/null +++ b/org.ifaa.android.manager/src/org/ifaa/android/manager/IIFAAService.aidl @@ -0,0 +1,12 @@ +package org.ifaa.android.manager; + +interface IIFAAService { + byte[] processCmd_v2(in byte[] param); + int[] getIDList(int bioType); + int faceEnroll(String sessionId, int flags); + int faceUpgrade(int action, String path, int offset, in byte[] data, int data_len); + int faceAuthenticate_v2(String sessionId, int flags); + int faceCancel_v2(String sessionId); + byte[] faceInvokeCommand(in byte[] param); + int faceGetCellinfo(); +} |