KeyguardSelectorView.java revision 57f928fc4afc02d2fe45523efea687eee7f86c02
1dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller/* 2dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * Copyright (C) 2012 The Android Open Source Project 3dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * 4dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * Licensed under the Apache License, Version 2.0 (the "License"); 5dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * you may not use this file except in compliance with the License. 6dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * You may obtain a copy of the License at 7dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * 8dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * http://www.apache.org/licenses/LICENSE-2.0 9dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * 10dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * Unless required by applicable law or agreed to in writing, software 11dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * distributed under the License is distributed on an "AS IS" BASIS, 12dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * See the License for the specific language governing permissions and 14dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * limitations under the License. 15dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller */ 16dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerpackage com.android.internal.policy.impl.keyguard; 17dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 18dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport android.animation.ObjectAnimator; 19dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport android.app.SearchManager; 2048b9b0d068844af9eb37c215484831c4d6b831b0Jim Millerimport android.app.admin.DevicePolicyManager; 21dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport android.content.ComponentName; 22dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport android.content.Context; 23dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport android.content.Intent; 24dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport android.os.UserHandle; 25fafdb6f9ca2ded293ed45e9436f04bbc03e75072John Spurlockimport android.provider.Settings; 26dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport android.util.AttributeSet; 27dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport android.util.Log; 28dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport android.util.Slog; 29dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport android.view.View; 30dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport android.widget.LinearLayout; 31dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 3247df44aad773fb2a46d4c07e20278c7d8c0b16beJim Millerimport com.android.internal.telephony.IccCardConstants.State; 33dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport com.android.internal.widget.LockPatternUtils; 34dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport com.android.internal.widget.multiwaveview.GlowPadView; 35dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport com.android.internal.widget.multiwaveview.GlowPadView.OnTriggerListener; 36dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerimport com.android.internal.R; 37dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 38dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerpublic class KeyguardSelectorView extends LinearLayout implements KeyguardSecurityView { 39dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller private static final boolean DEBUG = KeyguardHostView.DEBUG; 40dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller private static final String TAG = "SecuritySelectorView"; 41dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller private static final String ASSIST_ICON_METADATA_NAME = 42dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller "com.android.systemui.action_assist_icon"; 4347df44aad773fb2a46d4c07e20278c7d8c0b16beJim Miller 44dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller private KeyguardSecurityCallback mCallback; 45dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller private GlowPadView mGlowPadView; 46dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller private ObjectAnimator mAnim; 47109f1fd80c90409c0d7f21d49989641dfdf2ad1bJim Miller private View mFadeView; 48dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller private boolean mCameraDisabled; 49dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller private boolean mSearchDisabled; 50dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller private LockPatternUtils mLockPatternUtils; 51dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 52dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller OnTriggerListener mOnTriggerListener = new OnTriggerListener() { 53dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 54dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public void onTrigger(View v, int target) { 55dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller final int resId = mGlowPadView.getResourceIdForTarget(target); 56dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller switch (resId) { 57dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller case com.android.internal.R.drawable.ic_action_assist_generic: 58dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller Intent assistIntent = 59dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) 60dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller .getAssistIntent(mContext, UserHandle.USER_CURRENT); 61dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller if (assistIntent != null) { 6257f928fc4afc02d2fe45523efea687eee7f86c02John Spurlock mActivityLauncher.launchActivity(assistIntent, false, true, null, null); 63dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } else { 64dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller Log.w(TAG, "Failed to get intent for assist activity"); 65dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 66dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller mCallback.userActivity(0); 67dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller break; 68dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 69dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller case com.android.internal.R.drawable.ic_lockscreen_camera: 7057f928fc4afc02d2fe45523efea687eee7f86c02John Spurlock mActivityLauncher.launchCamera(null, null); 71dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller mCallback.userActivity(0); 72dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller break; 73dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 74dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller case com.android.internal.R.drawable.ic_lockscreen_unlock_phantom: 75dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller case com.android.internal.R.drawable.ic_lockscreen_unlock: 763dc524bc31a1578693ca958ef442dfa092b7aa7fJeff Brown mCallback.userActivity(0); 77dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller mCallback.dismiss(false); 78dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller break; 79dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 80dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 81dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 82dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public void onReleased(View v, int handle) { 83109f1fd80c90409c0d7f21d49989641dfdf2ad1bJim Miller doTransition(mFadeView, 1.0f); 84dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 85dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 86dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public void onGrabbed(View v, int handle) { 873dc524bc31a1578693ca958ef442dfa092b7aa7fJeff Brown mCallback.userActivity(0); 88109f1fd80c90409c0d7f21d49989641dfdf2ad1bJim Miller doTransition(mFadeView, 0.0f); 89dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 90dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 91dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public void onGrabbedStateChange(View v, int handle) { 92dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 93dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 94dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 95dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public void onFinishFinalAnimation() { 96dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 97dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 98dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 99dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller }; 100dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 10147df44aad773fb2a46d4c07e20278c7d8c0b16beJim Miller KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() { 102dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 103dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller @Override 104dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public void onDevicePolicyManagerStateChanged() { 105dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller updateTargets(); 106dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 107dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 108dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller @Override 10947df44aad773fb2a46d4c07e20278c7d8c0b16beJim Miller public void onSimStateChanged(State simState) { 110dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller updateTargets(); 111dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 112dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller }; 113dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 114dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock private final KeyguardActivityLauncher mActivityLauncher = new KeyguardActivityLauncher() { 115dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 116dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock @Override 117dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock KeyguardSecurityCallback getCallback() { 118dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock return mCallback; 119ee82f8fa2d47fc1dbfc29582ae348b3c45ff8fe0Jim Miller } 120ee82f8fa2d47fc1dbfc29582ae348b3c45ff8fe0Jim Miller 121dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock @Override 122dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock LockPatternUtils getLockPatternUtils() { 123dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock return mLockPatternUtils; 1245f75aa15d7c1c5ea1c1eecd95bf2bb0920173eb2Jim Miller } 125dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock 126dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock @Override 127dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock Context getContext() { 128dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock return mContext; 129dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock }}; 130dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock 131dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock public KeyguardSelectorView(Context context) { 132dcc9681b0d4f52e1f441ef2abdda3eb949cc0c4bJohn Spurlock this(context, null); 1335f75aa15d7c1c5ea1c1eecd95bf2bb0920173eb2Jim Miller } 1345f75aa15d7c1c5ea1c1eecd95bf2bb0920173eb2Jim Miller 135dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public KeyguardSelectorView(Context context, AttributeSet attrs) { 136dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller super(context, attrs); 137dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller mLockPatternUtils = new LockPatternUtils(getContext()); 138dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 139dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 140dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller @Override 141dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller protected void onFinishInflate() { 142dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller super.onFinishInflate(); 143dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller mGlowPadView = (GlowPadView) findViewById(R.id.glow_pad_view); 144dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller mGlowPadView.setOnTriggerListener(mOnTriggerListener); 145dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller updateTargets(); 146dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 147dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 1480ff7f010f8bfd011f0915031b02739ae3bee401eJim Miller public void setCarrierArea(View carrierArea) { 1490ff7f010f8bfd011f0915031b02739ae3bee401eJim Miller mFadeView = carrierArea; 1500ff7f010f8bfd011f0915031b02739ae3bee401eJim Miller } 1510ff7f010f8bfd011f0915031b02739ae3bee401eJim Miller 152dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public boolean isTargetPresent(int resId) { 153dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller return mGlowPadView.getTargetPosition(resId) != -1; 154dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 155dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 1566fb841fa219eaae3e87f2fdc05e105d7a1813c42Adam Cohen @Override 1576fb841fa219eaae3e87f2fdc05e105d7a1813c42Adam Cohen public void showUsabilityHint() { 1580a8d32673b3d34153c287916f0ca8d4439f3087eAdam Cohen mGlowPadView.ping(); 1590a8d32673b3d34153c287916f0ca8d4439f3087eAdam Cohen } 1600a8d32673b3d34153c287916f0ca8d4439f3087eAdam Cohen 161dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller private void updateTargets() { 162599dd7ce9adf8ca067cefb0b191a5ac20ec35a79Amith Yamasani int currentUserHandle = mLockPatternUtils.getCurrentUser(); 16348b9b0d068844af9eb37c215484831c4d6b831b0Jim Miller DevicePolicyManager dpm = mLockPatternUtils.getDevicePolicyManager(); 16448b9b0d068844af9eb37c215484831c4d6b831b0Jim Miller int disabledFeatures = dpm.getKeyguardDisabledFeatures(null, currentUserHandle); 16548b9b0d068844af9eb37c215484831c4d6b831b0Jim Miller boolean secureCameraDisabled = mLockPatternUtils.isSecure() 16648b9b0d068844af9eb37c215484831c4d6b831b0Jim Miller && (disabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0; 16748b9b0d068844af9eb37c215484831c4d6b831b0Jim Miller boolean cameraDisabledByAdmin = dpm.getCameraDisabled(null, currentUserHandle) 16848b9b0d068844af9eb37c215484831c4d6b831b0Jim Miller || secureCameraDisabled; 169dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller final KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(getContext()); 170dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller boolean disabledBySimState = monitor.isSimLocked(); 171dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller boolean cameraTargetPresent = 172dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller isTargetPresent(com.android.internal.R.drawable.ic_lockscreen_camera); 173dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller boolean searchTargetPresent = 174dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller isTargetPresent(com.android.internal.R.drawable.ic_action_assist_generic); 175dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 17648b9b0d068844af9eb37c215484831c4d6b831b0Jim Miller if (cameraDisabledByAdmin) { 177dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller Log.v(TAG, "Camera disabled by Device Policy"); 178dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } else if (disabledBySimState) { 179dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller Log.v(TAG, "Camera disabled by Sim State"); 180dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 181fafdb6f9ca2ded293ed45e9436f04bbc03e75072John Spurlock boolean currentUserSetup = 0 != Settings.Secure.getIntForUser( 182fafdb6f9ca2ded293ed45e9436f04bbc03e75072John Spurlock mContext.getContentResolver(), 183fafdb6f9ca2ded293ed45e9436f04bbc03e75072John Spurlock Settings.Secure.USER_SETUP_COMPLETE, 184fafdb6f9ca2ded293ed45e9436f04bbc03e75072John Spurlock 0 /*default */, 185fafdb6f9ca2ded293ed45e9436f04bbc03e75072John Spurlock currentUserHandle); 186dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller boolean searchActionAvailable = 187dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) 188dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller .getAssistIntent(mContext, UserHandle.USER_CURRENT) != null; 189fafdb6f9ca2ded293ed45e9436f04bbc03e75072John Spurlock mCameraDisabled = cameraDisabledByAdmin || disabledBySimState || !cameraTargetPresent 190fafdb6f9ca2ded293ed45e9436f04bbc03e75072John Spurlock || !currentUserSetup; 191fafdb6f9ca2ded293ed45e9436f04bbc03e75072John Spurlock mSearchDisabled = disabledBySimState || !searchActionAvailable || !searchTargetPresent 192fafdb6f9ca2ded293ed45e9436f04bbc03e75072John Spurlock || !currentUserSetup; 193dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller updateResources(); 194dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 195dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 196dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public void updateResources() { 197dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller // Update the search icon with drawable from the search .apk 198dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller if (!mSearchDisabled) { 199dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) 200dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller .getAssistIntent(mContext, UserHandle.USER_CURRENT); 201dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller if (intent != null) { 202dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller // XXX Hack. We need to substitute the icon here but haven't formalized 203dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller // the public API. The "_google" metadata will be going away, so 204dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller // DON'T USE IT! 205dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller ComponentName component = intent.getComponent(); 206dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller boolean replaced = mGlowPadView.replaceTargetDrawablesIfPresent(component, 207dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller ASSIST_ICON_METADATA_NAME + "_google", 208dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller com.android.internal.R.drawable.ic_action_assist_generic); 209dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 210dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller if (!replaced && !mGlowPadView.replaceTargetDrawablesIfPresent(component, 211dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller ASSIST_ICON_METADATA_NAME, 212dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller com.android.internal.R.drawable.ic_action_assist_generic)) { 213dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller Slog.w(TAG, "Couldn't grab icon from package " + component); 214dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 215dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 216dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 217dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 218dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller mGlowPadView.setEnableTarget(com.android.internal.R.drawable 219dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller .ic_lockscreen_camera, !mCameraDisabled); 220dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller mGlowPadView.setEnableTarget(com.android.internal.R.drawable 221dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller .ic_action_assist_generic, !mSearchDisabled); 222dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 223dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 224109f1fd80c90409c0d7f21d49989641dfdf2ad1bJim Miller void doTransition(View view, float to) { 225dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller if (mAnim != null) { 226dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller mAnim.cancel(); 227dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 228109f1fd80c90409c0d7f21d49989641dfdf2ad1bJim Miller mAnim = ObjectAnimator.ofFloat(view, "alpha", to); 229dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller mAnim.start(); 230dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 231dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 232dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public void setKeyguardCallback(KeyguardSecurityCallback callback) { 233dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller mCallback = callback; 234dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 235dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 236dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public void setLockPatternUtils(LockPatternUtils utils) { 237dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller mLockPatternUtils = utils; 238dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 239dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 240dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller @Override 241dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public void reset() { 242dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller mGlowPadView.reset(false); 243dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 244dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 245dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller @Override 246dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public boolean needsInput() { 247dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller return false; 248dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 249dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 250dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller @Override 251dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public void onPause() { 252dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller KeyguardUpdateMonitor.getInstance(getContext()).removeCallback(mInfoCallback); 253dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 254dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 255dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller @Override 256dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public void onResume() { 257dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller KeyguardUpdateMonitor.getInstance(getContext()).registerCallback(mInfoCallback); 258dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 259dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller 260dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller @Override 261dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller public KeyguardSecurityCallback getCallback() { 262dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller return mCallback; 263dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller } 264dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller} 265