Merge "Use the permission for hotword recognition" into klp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
22ae5d6de1
@@ -37,6 +37,8 @@
|
|||||||
<uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW" />
|
<uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW" />
|
||||||
<uses-permission android:name="android.permission.BIND_DEVICE_ADMIN" />
|
<uses-permission android:name="android.permission.BIND_DEVICE_ADMIN" />
|
||||||
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
|
||||||
|
<!-- Permission to perform hotword recognition -->
|
||||||
|
<uses-permission android:name="android.permission.HOTWORD_RECOGNITION" />
|
||||||
|
|
||||||
<application android:label="@string/app_name"
|
<application android:label="@string/app_name"
|
||||||
android:process="com.android.systemui"
|
android:process="com.android.systemui"
|
||||||
|
|||||||
@@ -1784,30 +1784,23 @@ public class KeyguardHostView extends KeyguardViewBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onHotwordRecognized(final PendingIntent intent) {
|
public void onHotwordRecognized(final Intent intent) {
|
||||||
if (DEBUG) Log.d(TAG, "onHotwordRecognized");
|
if (DEBUG) Log.d(TAG, "onHotwordRecognized");
|
||||||
maybeStopHotwordDetector();
|
maybeStopHotwordDetector();
|
||||||
|
// See if an activity can handle this intent.
|
||||||
|
if (getContext().getPackageManager().resolveActivity(intent, 0) == null)
|
||||||
|
return;
|
||||||
if (SecurityMode.None == mCurrentSecuritySelection) {
|
if (SecurityMode.None == mCurrentSecuritySelection) {
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
try {
|
mActivityLauncher.launchActivity(intent, true, true, null, null);
|
||||||
intent.send();
|
|
||||||
} catch (PendingIntent.CanceledException e) {
|
|
||||||
Log.w(TAG, "Failed to launch PendingIntent. Encountered CanceledException");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mCallback.userActivity(0);
|
mCallback.userActivity(0);
|
||||||
mCallback.dismiss(false);
|
|
||||||
} else if (ENABLE_HOTWORD_SECURE && mLockPatternUtils.isSecure()) {
|
} else if (ENABLE_HOTWORD_SECURE && mLockPatternUtils.isSecure()) {
|
||||||
setOnDismissAction(new OnDismissAction() {
|
setOnDismissAction(new OnDismissAction() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onDismiss() {
|
public boolean onDismiss() {
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
try {
|
mActivityLauncher.launchActivity(intent, true, true, null, null);
|
||||||
intent.send();
|
|
||||||
} catch (PendingIntent.CanceledException e) {
|
|
||||||
Log.w(TAG, "Failed to launch PendingIntent."
|
|
||||||
+ "Encountered CanceledException");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user