diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-03-31 16:35:15 +0200 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2014-04-02 22:11:19 +0200 |
commit | cff0acb6b1eea23c3f44a078a0a5e81c11faea35 (patch) | |
tree | 900f324f271f8cfceccdc64575333b9aca15cbf1 /packages/SystemUI/src/com/android/systemui/SystemUIApplication.java | |
parent | 8533b95b4c217c588bddfbc1e57051377d963cc0 (diff) | |
download | frameworks_base-cff0acb6b1eea23c3f44a078a0a5e81c11faea35.zip frameworks_base-cff0acb6b1eea23c3f44a078a0a5e81c11faea35.tar.gz frameworks_base-cff0acb6b1eea23c3f44a078a0a5e81c11faea35.tar.bz2 |
Wait for Keyguard to be drawn after boot.
The old logic with waiting for the Keyguard to be drawn assumed that
it is in an own window, and just checked for the visibility. This is
no longer possible as the Keyguard is in the status bar, and the status
bar might have been drawn without the Keyguard. So we have to wait
explicitely until Keyguard told PhoneWindowManager that it has now been
drawn and we can turn on the screen.
In addition, the starting logic of SystemUI is moved into
SystemUIApplication such the we can make sure that the status bar
already exists when the callbacks from PhoneWindowManager reach
KeyguardService. This simplifies the logic a lot.
Bug: 13635952
Change-Id: Ifd6ba795647edcf3501641e39052e4d04bc826fb
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/SystemUIApplication.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/SystemUIApplication.java | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java new file mode 100644 index 0000000..8265c86 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java @@ -0,0 +1,89 @@ +/* + * 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; + +import android.app.Application; +import android.content.res.Configuration; +import android.util.Log; + +import java.util.HashMap; +import java.util.Map; + +/** + * Application class for SystemUI. + */ +public class SystemUIApplication extends Application { + + private static final String TAG = "SystemUIService"; + private static final boolean DEBUG = false; + + /** + * The classes of the stuff to start. + */ + private final Class<?>[] SERVICES = new Class[] { + com.android.systemui.keyguard.KeyguardViewMediator.class, + com.android.systemui.recent.Recents.class, + com.android.systemui.statusbar.SystemBars.class, + com.android.systemui.usb.StorageNotification.class, + com.android.systemui.power.PowerUI.class, + com.android.systemui.media.RingtonePlayer.class, + com.android.systemui.settings.SettingsUI.class, + }; + + /** + * Hold a reference on the stuff we start. + */ + private final SystemUI[] mServices = new SystemUI[SERVICES.length]; + private final Map<Class<?>, Object> mComponents = new HashMap<Class<?>, Object>(); + + @Override + public void onCreate() { + final int N = SERVICES.length; + for (int i=0; i<N; i++) { + Class<?> cl = SERVICES[i]; + if (DEBUG) Log.d(TAG, "loading: " + cl); + try { + mServices[i] = (SystemUI)cl.newInstance(); + } catch (IllegalAccessException ex) { + throw new RuntimeException(ex); + } catch (InstantiationException ex) { + throw new RuntimeException(ex); + } + mServices[i].mContext = this; + mServices[i].mComponents = mComponents; + if (DEBUG) Log.d(TAG, "running: " + mServices[i]); + mServices[i].start(); + } + } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + int len = mServices.length; + for (int i = 0; i < len; i++) { + mServices[i].onConfigurationChanged(newConfig); + } + } + + @SuppressWarnings("unchecked") + public <T> T getComponent(Class<T> interfaceType) { + return (T) mComponents.get(interfaceType); + } + + public SystemUI[] getServices() { + return mServices; + } +} |