am f6f47e95
: Merge "Disable navbar searchlight if search assist not available." into jb-mr1.1-dev
* commit 'f6f47e950ddbb91fcce30f2f3e610a4d249b9bdb': Disable navbar searchlight if search assist not available.
This commit is contained in:
@ -858,6 +858,9 @@ public class SearchManager
|
|||||||
*/
|
*/
|
||||||
public Intent getAssistIntent(Context context, int userHandle) {
|
public Intent getAssistIntent(Context context, int userHandle) {
|
||||||
try {
|
try {
|
||||||
|
if (mService == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
ComponentName comp = mService.getAssistIntent(userHandle);
|
ComponentName comp = mService.getAssistIntent(userHandle);
|
||||||
if (comp == null) {
|
if (comp == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -22,6 +22,7 @@ import android.app.Activity;
|
|||||||
import android.app.ActivityManagerNative;
|
import android.app.ActivityManagerNative;
|
||||||
import android.app.AlarmManager;
|
import android.app.AlarmManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
import android.app.SearchManager;
|
||||||
import android.app.StatusBarManager;
|
import android.app.StatusBarManager;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
@ -166,6 +167,9 @@ public class KeyguardViewMediator {
|
|||||||
/** UserManager for querying number of users */
|
/** UserManager for querying number of users */
|
||||||
private UserManager mUserManager;
|
private UserManager mUserManager;
|
||||||
|
|
||||||
|
/** SearchManager for determining whether or not search assistant is available */
|
||||||
|
private SearchManager mSearchManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to keep the device awake while to ensure the keyguard finishes opening before
|
* Used to keep the device awake while to ensure the keyguard finishes opening before
|
||||||
* we sleep.
|
* we sleep.
|
||||||
@ -527,6 +531,7 @@ public class KeyguardViewMediator {
|
|||||||
* Let us know that the system is ready after startup.
|
* Let us know that the system is ready after startup.
|
||||||
*/
|
*/
|
||||||
public void onSystemReady() {
|
public void onSystemReady() {
|
||||||
|
mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (DEBUG) Log.d(TAG, "onSystemReady");
|
if (DEBUG) Log.d(TAG, "onSystemReady");
|
||||||
mSystemReady = true;
|
mSystemReady = true;
|
||||||
@ -1313,6 +1318,9 @@ public class KeyguardViewMediator {
|
|||||||
// showing secure lockscreen; disable ticker.
|
// showing secure lockscreen; disable ticker.
|
||||||
flags |= StatusBarManager.DISABLE_NOTIFICATION_TICKER;
|
flags |= StatusBarManager.DISABLE_NOTIFICATION_TICKER;
|
||||||
}
|
}
|
||||||
|
if (!isAssistantAvailable()) {
|
||||||
|
flags |= StatusBarManager.DISABLE_SEARCH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
@ -1410,4 +1418,8 @@ public class KeyguardViewMediator {
|
|||||||
mKeyguardViewManager.showAssistant();
|
mKeyguardViewManager.showAssistant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isAssistantAvailable() {
|
||||||
|
return mSearchManager != null
|
||||||
|
&& mSearchManager.getAssistIntent(mContext, UserHandle.USER_CURRENT) != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user