summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2012-11-08 15:47:04 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-11-08 15:47:04 -0800
commit061b4fae3daf40c90b46e16b12e7f22142eb498c (patch)
tree152e92dd48a0043fae26e6bc18e524f847f3d617 /policy
parent70eeec5c06db3bf38e94d95a284d393e79bf87a0 (diff)
parenta2bf6181dfca0f93461fc041f2bd2444551a4515 (diff)
downloadframeworks_base-061b4fae3daf40c90b46e16b12e7f22142eb498c.zip
frameworks_base-061b4fae3daf40c90b46e16b12e7f22142eb498c.tar.gz
frameworks_base-061b4fae3daf40c90b46e16b12e7f22142eb498c.tar.bz2
am a2bf6181: am 2c29deaa: am 6be441c5: Merge "Add mechanism to kick keyguard to show the assistant" into jb-mr1-lockscreen-dev
* commit 'a2bf6181dfca0f93461fc041f2bd2444551a4515': Add mechanism to kick keyguard to show the assistant
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindowManager.java5
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java30
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java6
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java13
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java4
5 files changed, 58 insertions, 0 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 54bf20d..d9c07f8 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -4540,6 +4540,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
@Override
+ public void showAssistant() {
+ mKeyguardMediator.showAssistant();
+ }
+
+ @Override
public void dump(String prefix, PrintWriter pw, String[] args) {
pw.print(prefix); pw.print("mSafeMode="); pw.print(mSafeMode);
pw.print(" mSystemReady="); pw.print(mSystemReady);
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
index 8c9e30a..368cfce 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
@@ -20,11 +20,13 @@ import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.AlertDialog;
+import android.app.SearchManager;
import android.app.admin.DevicePolicyManager;
import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
+import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -37,6 +39,7 @@ import android.os.Looper;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
+import android.os.UserHandle;
import android.os.UserManager;
import android.util.AttributeSet;
import android.util.Log;
@@ -1442,4 +1445,31 @@ public class KeyguardHostView extends KeyguardViewBase {
public void dismiss() {
showNextSecurityScreenOrFinish(false);
}
+
+ public void showAssistant() {
+ final Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
+ .getAssistIntent(mContext, UserHandle.USER_CURRENT);
+
+ if (intent == null) return;
+
+ final ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
+ R.anim.keyguard_action_assist_enter, R.anim.keyguard_action_assist_exit,
+ getHandler(), null);
+
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ setOnDismissAction(new OnDismissAction() {
+ @Override
+ public boolean onDismiss() {
+ try {
+ mContext.startActivityAsUser(intent, opts.toBundle(),
+ new UserHandle(UserHandle.USER_CURRENT));
+ } catch (ActivityNotFoundException e) {
+ Slog.w(TAG, "Activity not found for " + intent.getAction());
+ }
+ return false;
+ }
+ });
+
+ mViewStateManager.showBouncer(true);
+ }
}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
index af34347..c81ff55 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
@@ -425,4 +425,10 @@ public class KeyguardViewManager {
public synchronized boolean isShowing() {
return (mKeyguardHost != null && mKeyguardHost.getVisibility() == View.VISIBLE);
}
+
+ public void showAssistant() {
+ if (mKeyguardView != null) {
+ mKeyguardView.showAssistant();
+ }
+ }
}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
index 128930a..23c642d 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
@@ -116,6 +116,7 @@ public class KeyguardViewMediator {
private static final int KEYGUARD_DONE_AUTHENTICATING = 11;
private static final int SET_HIDDEN = 12;
private static final int KEYGUARD_TIMEOUT = 13;
+ private static final int SHOW_ASSISTANT = 14;
/**
* The default amount of time we stay awake (used for all key input)
@@ -1130,6 +1131,9 @@ public class KeyguardViewMediator {
doKeyguardLocked((Bundle) msg.obj);
}
break;
+ case SHOW_ASSISTANT:
+ handleShowAssistant();
+ break;
}
}
};
@@ -1393,4 +1397,13 @@ public class KeyguardViewMediator {
return mKeyguardDonePending || !isSecure();
}
+ public void showAssistant() {
+ Message msg = mHandler.obtainMessage(SHOW_ASSISTANT);
+ mHandler.sendMessage(msg);
+ }
+
+ public void handleShowAssistant() {
+ mKeyguardViewManager.showAssistant();
+ }
+
}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
index 88cf343..945e9c2 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
@@ -120,6 +120,7 @@ public class KeyguardViewStateManager implements
// once the user swipes a page we clear that behavior
if (mKeyguardHostView != null) {
mKeyguardHostView.clearAppWidgetToShow();
+ mKeyguardHostView.setOnDismissAction(null);
}
if (mHideHintsRunnable != null) {
mMainQueue.removeCallbacks(mHideHintsRunnable);
@@ -316,6 +317,9 @@ public class KeyguardViewStateManager implements
mKeyguardWidgetPager.zoomOutToBouncer();
} else {
mKeyguardWidgetPager.zoomInFromBouncer();
+ if (mKeyguardHostView != null) {
+ mKeyguardHostView.setOnDismissAction(null);
+ }
}
}
}