55import java .io .FileDescriptor ;
66import java .io .PrintWriter ;
77
8- import com .android .internal .view .IInputMethod ;
9-
108import android .content .ComponentName ;
119import android .content .Context ;
1210import android .content .Intent ;
1614import android .os .IBinder ;
1715import android .os .RemoteException ;
1816import android .os .ServiceManager ;
19- import android .os .SystemClock ;
2017import android .provider .Settings ;
21- import android .util .Log ;
2218import android .util .Slog ;
2319import android .view .IWindowManager ;
2420import android .view .WindowManager ;
2521
2622/**
27- *
23+ *
2824 * @hide
2925 *
3026 */
3127
32- public class DreamManagerService
33- extends IDreamManager .Stub
28+ public class DreamManagerService
29+ extends IDreamManager .Stub
3430 implements ServiceConnection
3531{
3632 private static final boolean DEBUG = true ;
3733 private static final String TAG = "DreamManagerService" ;
38-
34+
3935 final Object mLock = new Object [0 ];
4036
4137 private Context mContext ;
4238 private IWindowManager mIWindowManager ;
43-
39+
4440 private ComponentName mCurrentDreamComponent ;
4541 private IDreamService mCurrentDream ;
46- private Binder mCurrentDreamToken ;
42+ private Binder mCurrentDreamToken ;
4743
4844 public DreamManagerService (Context context ) {
4945 if (DEBUG ) Slog .v (TAG , "DreamManagerService startup" );
@@ -60,6 +56,7 @@ private void checkPermission(String permission) {
6056 }
6157
6258 // IDreamManager method
59+ @ Override
6360 public void dream () {
6461 ComponentName name = getDreamComponent ();
6562 if (name != null ) {
@@ -75,26 +72,26 @@ public void dream() {
7572 }
7673
7774 // IDreamManager method
75+ @ Override
7876 public void setDreamComponent (ComponentName name ) {
7977 Settings .Secure .putString (mContext .getContentResolver (), SCREENSAVER_COMPONENT , name .flattenToString ());
8078 }
81-
79+
8280 // IDreamManager method
81+ @ Override
8382 public ComponentName getDreamComponent () {
84- // TODO(dsandler) don't load this every time, watch the value
83+ // TODO(dsandler) don't load this every time, watch the value
8584 String component = Settings .Secure .getString (mContext .getContentResolver (), SCREENSAVER_COMPONENT );
86- if (component == null ) {
87- component = mContext .getResources ().getString (
88- com .android .internal .R .string .config_defaultDreamComponent );
89- }
9085 if (component != null ) {
9186 return ComponentName .unflattenFromString (component );
9287 } else {
88+ // We rely on DatabaseHelper to set a sane default for us when the settings DB is upgraded
9389 return null ;
9490 }
9591 }
96-
92+
9793 // IDreamManager method
94+ @ Override
9895 public void testDream (ComponentName name ) {
9996 if (DEBUG ) Slog .v (TAG , "startDream name=" + name
10097 + " pid=" + Binder .getCallingPid () + ", uid=" + Binder .getCallingUid ());
@@ -110,6 +107,7 @@ public void testDream(ComponentName name) {
110107 }
111108
112109 // IDreamManager method
110+ @ Override
113111 public void awaken () {
114112 if (DEBUG ) Slog .v (TAG , "awaken()" );
115113 synchronized (mLock ) {
@@ -123,6 +121,7 @@ public void awaken() {
123121 }
124122
125123 // IDreamManager method
124+ @ Override
126125 public boolean isDreaming () {
127126 return mCurrentDream != null ;
128127 }
@@ -141,14 +140,14 @@ public void bindDreamComponentL(ComponentName componentName, boolean test) {
141140 mCurrentDreamComponent = componentName ;
142141 mCurrentDreamToken = new Binder ();
143142 try {
144- if (DEBUG ) Slog .v (TAG , "Adding window token: " + mCurrentDreamToken
143+ if (DEBUG ) Slog .v (TAG , "Adding window token: " + mCurrentDreamToken
145144 + " for window type: " + WindowManager .LayoutParams .TYPE_DREAM );
146145 mIWindowManager .addWindowToken (mCurrentDreamToken ,
147146 WindowManager .LayoutParams .TYPE_DREAM );
148147 } catch (RemoteException e ) {
149148 Slog .w (TAG , "Unable to add window token. Proceed at your own risk." );
150149 }
151-
150+
152151 if (!mContext .bindService (intent , this , Context .BIND_AUTO_CREATE )) {
153152 Slog .w (TAG , "unable to bind service: " + componentName );
154153 }
@@ -172,7 +171,7 @@ public void onServiceDisconnected(ComponentName name) {
172171 if (DEBUG ) Slog .v (TAG , "disconnected: " + name + " service: " + mCurrentDream );
173172 // Only happens in exceptional circumstances
174173 }
175-
174+
176175 @ Override
177176 protected void dump (FileDescriptor fd , PrintWriter pw , String [] args ) {
178177 mContext .enforceCallingOrSelfPermission (android .Manifest .permission .DUMP , TAG );
0 commit comments