Merge "lazy load enrollment application UID in VIMS" into rvc-dev am: fa47464c2b am: b17d19f595
Change-Id: Ibafea8ca1226dcde6106c584911dfea97d6217e2
This commit is contained in:
@@ -28,7 +28,6 @@ import android.content.res.XmlResourceParser;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArraySet;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
import android.util.Xml;
|
||||
|
||||
@@ -231,15 +230,7 @@ public class KeyphraseEnrollmentInfo {
|
||||
com.android.internal.R.styleable.VoiceEnrollmentApplication);
|
||||
keyphraseMetadata = getKeyphraseFromTypedArray(array, packageName, parseErrors);
|
||||
array.recycle();
|
||||
} catch (XmlPullParserException e) {
|
||||
String error = "Error parsing keyphrase enrollment meta-data for " + packageName;
|
||||
parseErrors.add(error + ": " + e);
|
||||
Slog.w(TAG, error, e);
|
||||
} catch (IOException e) {
|
||||
String error = "Error parsing keyphrase enrollment meta-data for " + packageName;
|
||||
parseErrors.add(error + ": " + e);
|
||||
Slog.w(TAG, error, e);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
} catch (XmlPullParserException | PackageManager.NameNotFoundException | IOException e) {
|
||||
String error = "Error parsing keyphrase enrollment meta-data for " + packageName;
|
||||
parseErrors.add(error + ": " + e);
|
||||
Slog.w(TAG, error, e);
|
||||
@@ -390,7 +381,6 @@ public class KeyphraseEnrollmentInfo {
|
||||
* False if not.
|
||||
*/
|
||||
public boolean isUidSupportedEnrollmentApplication(int uid) {
|
||||
Log.d(TAG, "isUidSupportedEnrollmentApplication: " + toString());
|
||||
return mEnrollmentApplicationUids.contains(uid);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import android.content.pm.UserInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.hardware.soundtrigger.IRecognitionStatusCallback;
|
||||
import android.hardware.soundtrigger.KeyphraseEnrollmentInfo;
|
||||
import android.hardware.soundtrigger.KeyphraseMetadata;
|
||||
import android.hardware.soundtrigger.ModelParams;
|
||||
import android.hardware.soundtrigger.SoundTrigger;
|
||||
@@ -223,6 +224,7 @@ public class VoiceInteractionManagerService extends SystemService {
|
||||
class VoiceInteractionManagerServiceStub extends IVoiceInteractionManagerService.Stub {
|
||||
|
||||
VoiceInteractionManagerServiceImpl mImpl;
|
||||
KeyphraseEnrollmentInfo mEnrollmentApplicationInfo;
|
||||
|
||||
private boolean mSafeMode;
|
||||
private int mCurUser;
|
||||
@@ -447,6 +449,15 @@ public class VoiceInteractionManagerService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
private void getOrCreateEnrollmentApplicationInfo() {
|
||||
synchronized (this) {
|
||||
if (mEnrollmentApplicationInfo == null) {
|
||||
mEnrollmentApplicationInfo = new KeyphraseEnrollmentInfo(
|
||||
mContext.getPackageManager());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setCurrentUserLocked(@UserIdInt int userHandle) {
|
||||
mCurUser = userHandle;
|
||||
final UserInfo userInfo = mUserManagerInternal.getUserInfo(mCurUser);
|
||||
@@ -1380,12 +1391,17 @@ public class VoiceInteractionManagerService extends SystemService {
|
||||
pw.println(" mCurUserUnlocked: " + mCurUserUnlocked);
|
||||
pw.println(" mCurUserSupported: " + mCurUserSupported);
|
||||
dumpSupportedUsers(pw, " ");
|
||||
if (mEnrollmentApplicationInfo == null) {
|
||||
pw.println(" (No enrollment application info)");
|
||||
} else {
|
||||
pw.println(" " + mEnrollmentApplicationInfo.toString());
|
||||
}
|
||||
mDbHelper.dump(pw);
|
||||
if (mImpl == null) {
|
||||
pw.println(" (No active implementation)");
|
||||
return;
|
||||
} else {
|
||||
mImpl.dumpLocked(fd, pw, args);
|
||||
}
|
||||
mImpl.dumpLocked(fd, pw, args);
|
||||
}
|
||||
mSoundTriggerInternal.dump(fd, pw, args);
|
||||
}
|
||||
@@ -1438,8 +1454,9 @@ public class VoiceInteractionManagerService extends SystemService {
|
||||
}
|
||||
|
||||
private boolean isCallerTrustedEnrollmentApplication() {
|
||||
return mImpl.mEnrollmentApplicationInfo.isUidSupportedEnrollmentApplication(
|
||||
Binder.getCallingUid());
|
||||
getOrCreateEnrollmentApplicationInfo();
|
||||
return mEnrollmentApplicationInfo.isUidSupportedEnrollmentApplication(
|
||||
Binder.getCallingUid());
|
||||
}
|
||||
|
||||
private void setImplLocked(VoiceInteractionManagerServiceImpl impl) {
|
||||
|
||||
@@ -36,7 +36,6 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.hardware.soundtrigger.KeyphraseEnrollmentInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
@@ -79,7 +78,6 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
|
||||
final IActivityManager mAm;
|
||||
final IActivityTaskManager mAtm;
|
||||
final VoiceInteractionServiceInfo mInfo;
|
||||
final KeyphraseEnrollmentInfo mEnrollmentApplicationInfo;
|
||||
final ComponentName mSessionComponentName;
|
||||
final IWindowManager mIWindowManager;
|
||||
boolean mBound = false;
|
||||
@@ -135,7 +133,6 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
|
||||
mComponent = service;
|
||||
mAm = ActivityManager.getService();
|
||||
mAtm = ActivityTaskManager.getService();
|
||||
mEnrollmentApplicationInfo = new KeyphraseEnrollmentInfo(context.getPackageManager());
|
||||
VoiceInteractionServiceInfo info;
|
||||
try {
|
||||
info = new VoiceInteractionServiceInfo(context.getPackageManager(), service, mUser);
|
||||
@@ -406,7 +403,6 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
|
||||
pw.println(" Active session:");
|
||||
mActiveSession.dump(" ", pw);
|
||||
}
|
||||
pw.println(" " + mEnrollmentApplicationInfo.toString());
|
||||
}
|
||||
|
||||
void startLocked() {
|
||||
|
||||
Reference in New Issue
Block a user