Merge "Request keyguard dismissal from suspend dialog" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
08e440cab2
@@ -26,6 +26,7 @@ import android.Manifest;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AppGlobals;
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentSender;
|
||||
@@ -208,9 +209,32 @@ public class SuspendedAppActivity extends AlertActivity
|
||||
ap.mPositiveButtonText = getString(android.R.string.ok);
|
||||
ap.mNeutralButtonText = resolveNeutralButtonText();
|
||||
ap.mPositiveButtonListener = ap.mNeutralButtonListener = this;
|
||||
|
||||
requestDismissKeyguardIfNeeded(ap.mMessage);
|
||||
|
||||
setupAlert();
|
||||
}
|
||||
|
||||
private void requestDismissKeyguardIfNeeded(CharSequence dismissMessage) {
|
||||
final KeyguardManager km = getSystemService(KeyguardManager.class);
|
||||
if (km.isKeyguardLocked()) {
|
||||
km.requestDismissKeyguard(this, dismissMessage,
|
||||
new KeyguardManager.KeyguardDismissCallback() {
|
||||
@Override
|
||||
public void onDismissError() {
|
||||
Slog.e(TAG, "Error while dismissing keyguard."
|
||||
+ " Keeping the dialog visible.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismissCancelled() {
|
||||
Slog.w(TAG, "Keyguard dismiss was cancelled. Finishing.");
|
||||
SuspendedAppActivity.this.finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
switch (which) {
|
||||
|
||||
Reference in New Issue
Block a user