summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/keyguard
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2014-04-02 21:22:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-04-02 21:22:59 +0000
commitae6ffcc3c74d12ebf59a26cce24d04fdd2b56f4e (patch)
treeb7e205cea9805bf2c79b4073a267cf3d75c63e66 /packages/SystemUI/src/com/android/systemui/keyguard
parentab6e1116340277bcb10637c44335cab37871d8ce (diff)
parentcff0acb6b1eea23c3f44a078a0a5e81c11faea35 (diff)
downloadframeworks_base-ae6ffcc3c74d12ebf59a26cce24d04fdd2b56f4e.zip
frameworks_base-ae6ffcc3c74d12ebf59a26cce24d04fdd2b56f4e.tar.gz
frameworks_base-ae6ffcc3c74d12ebf59a26cce24d04fdd2b56f4e.tar.bz2
Merge "Wait for Keyguard to be drawn after boot." into master-lockscreen-dev
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/keyguard')
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java38
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardStatusBarBinder.java33
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java42
3 files changed, 29 insertions, 84 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
index c7d29f0..fdf374f 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
@@ -16,15 +16,6 @@
package com.android.systemui.keyguard;
-import com.android.internal.policy.IKeyguardExitCallback;
-import com.android.internal.policy.IKeyguardService;
-import com.android.internal.policy.IKeyguardServiceConstants;
-import com.android.internal.policy.IKeyguardShowCallback;
-import com.android.internal.widget.LockPatternUtils;
-import com.android.systemui.statusbar.phone.PhoneStatusBar;
-import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
-import com.android.systemui.statusbar.phone.StatusBarWindowManager;
-
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
@@ -33,7 +24,12 @@ import android.os.Debug;
import android.os.IBinder;
import android.util.Log;
import android.view.MotionEvent;
-import android.view.ViewGroup;
+
+import com.android.internal.policy.IKeyguardExitCallback;
+import com.android.internal.policy.IKeyguardService;
+import com.android.internal.policy.IKeyguardServiceConstants;
+import com.android.internal.policy.IKeyguardShowCallback;
+import com.android.systemui.SystemUIApplication;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
@@ -41,23 +37,17 @@ public class KeyguardService extends Service {
static final String TAG = "KeyguardService";
static final String PERMISSION = android.Manifest.permission.CONTROL_KEYGUARD;
- public static final String ACTION_STATUS_BAR_BIND = "action.status_bar_bind";
-
private KeyguardViewMediator mKeyguardViewMediator;
@Override
public void onCreate() {
- LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
- mKeyguardViewMediator = new KeyguardViewMediator(this, lockPatternUtils);
+ mKeyguardViewMediator =
+ ((SystemUIApplication) getApplication()).getComponent(KeyguardViewMediator.class);
}
@Override
public IBinder onBind(Intent intent) {
- if (ACTION_STATUS_BAR_BIND.equals(intent.getAction())) {
- return mKeyguardStatusBarBinder;
- } else {
- return mBinder;
- }
+ return mBinder;
}
void checkPermission() {
@@ -68,16 +58,6 @@ public class KeyguardService extends Service {
}
}
- private final KeyguardStatusBarBinder mKeyguardStatusBarBinder = new KeyguardStatusBarBinder() {
-
- @Override
- public void registerStatusBar(PhoneStatusBar phoneStatusBar, ViewGroup container,
- StatusBarWindowManager statusBarWindowManager) {
- mKeyguardViewMediator.registerStatusBar(phoneStatusBar, container,
- statusBarWindowManager);
- }
- };
-
private final IKeyguardService.Stub mBinder = new IKeyguardService.Stub() {
private boolean mIsOccluded;
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardStatusBarBinder.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardStatusBarBinder.java
deleted file mode 100644
index 04b6c29..0000000
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardStatusBarBinder.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.systemui.keyguard;
-
-import com.android.systemui.statusbar.phone.PhoneStatusBar;
-import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
-import com.android.systemui.statusbar.phone.StatusBarWindowManager;
-
-import android.os.Binder;
-import android.view.ViewGroup;
-
-/**
- * Communication interface from status bar to {@link com.android.systemui.keyguard.KeyguardService}.
- */
-public abstract class KeyguardStatusBarBinder extends Binder {
-
- public abstract void registerStatusBar(PhoneStatusBar phoneStatusBar, ViewGroup container,
- StatusBarWindowManager statusBarWindowManager);
-}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index e0a6e67..3326dee 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -60,6 +60,7 @@ import com.android.keyguard.MultiUserAvatarCache;
import com.android.keyguard.ViewMediatorCallback;
import com.android.keyguard.analytics.KeyguardAnalytics;
import com.android.keyguard.analytics.Session;
+import com.android.systemui.SystemUI;
import com.android.systemui.statusbar.phone.PhoneStatusBar;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.phone.StatusBarWindowManager;
@@ -111,7 +112,7 @@ import static com.android.keyguard.analytics.KeyguardAnalytics.SessionTypeAdapte
* directly to the keyguard UI is posted to a {@link android.os.Handler} to ensure it is taken on the UI
* thread of the keyguard.
*/
-public class KeyguardViewMediator {
+public class KeyguardViewMediator extends SystemUI {
private static final int KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT = 30000;
final static boolean DEBUG = false;
private static final boolean ENABLE_ANALYTICS = Build.IS_DEBUGGABLE;
@@ -181,7 +182,6 @@ public class KeyguardViewMediator {
/** The stream type that the lock sounds are tied to. */
private int mMasterStreamType;
- private Context mContext;
private AlarmManager mAlarmManager;
private AudioManager mAudioManager;
private StatusBarManager mStatusBarManager;
@@ -211,7 +211,7 @@ public class KeyguardViewMediator {
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
- private final KeyguardAnalytics mKeyguardAnalytics;
+ private KeyguardAnalytics mKeyguardAnalytics;
// these are protected by synchronized (this)
@@ -284,7 +284,7 @@ public class KeyguardViewMediator {
/**
* The volume applied to the lock/unlock sounds.
*/
- private final float mLockSoundVolume;
+ private float mLockSoundVolume;
/**
* For managing external displays
@@ -460,42 +460,34 @@ public class KeyguardViewMediator {
mPM.userActivity(SystemClock.uptimeMillis(), false);
}
- /**
- * Construct a KeyguardViewMediator
- * @param context
- * @param lockPatternUtils optional mock interface for LockPatternUtils
- */
- public KeyguardViewMediator(Context context, LockPatternUtils lockPatternUtils) {
- mContext = context;
- mPM = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
+ private void setup() {
+ mPM = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
mShowKeyguardWakeLock = mPM.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "show keyguard");
mShowKeyguardWakeLock.setReferenceCounted(false);
mContext.registerReceiver(mBroadcastReceiver, new IntentFilter(DELAYED_KEYGUARD_ACTION));
- mKeyguardDisplayManager = new KeyguardDisplayManager(context);
+ mKeyguardDisplayManager = new KeyguardDisplayManager(mContext);
- mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
+ mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
- mUpdateMonitor = KeyguardUpdateMonitor.getInstance(context);
+ mUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
- mLockPatternUtils = lockPatternUtils != null
- ? lockPatternUtils : new LockPatternUtils(mContext);
+ mLockPatternUtils = new LockPatternUtils(mContext);
mLockPatternUtils.setCurrentUser(UserHandle.USER_OWNER);
// Assume keyguard is showing (unless it's disabled) until we know for sure...
mShowing = (mUpdateMonitor.isDeviceProvisioned() || mLockPatternUtils.isSecure())
&& !mLockPatternUtils.isLockScreenDisabled();
- mStatusBarKeyguardViewManager = new StatusBarKeyguardViewManager(mContext, mViewMediatorCallback,
- lockPatternUtils);
- WindowManager wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
+ mStatusBarKeyguardViewManager = new StatusBarKeyguardViewManager(mContext,
+ mViewMediatorCallback, mLockPatternUtils);
final ContentResolver cr = mContext.getContentResolver();
if (ENABLE_ANALYTICS && !LockPatternUtils.isSafeModeEnabled() &&
Settings.Secure.getInt(cr, KEYGUARD_ANALYTICS_SETTING, 0) == 1) {
- mKeyguardAnalytics = new KeyguardAnalytics(context, new SessionTypeAdapter() {
+ mKeyguardAnalytics = new KeyguardAnalytics(mContext, new SessionTypeAdapter() {
@Override
public int getSessionType() {
@@ -526,11 +518,17 @@ public class KeyguardViewMediator {
if (soundPath == null || mUnlockSoundId == 0) {
Log.w(TAG, "failed to load unlock sound from " + soundPath);
}
- int lockSoundDefaultAttenuation = context.getResources().getInteger(
+ int lockSoundDefaultAttenuation = mContext.getResources().getInteger(
com.android.internal.R.integer.config_lockSoundVolumeDb);
mLockSoundVolume = (float)Math.pow(10, (float)lockSoundDefaultAttenuation/20);
}
+ @Override
+ public void start() {
+ setup();
+ putComponent(KeyguardViewMediator.class, this);
+ }
+
/**
* Let us know that the system is ready after startup.
*/