Merge "Invoking the global action dialog stops dreaming." into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6ebbe1b970
@@ -39,12 +39,15 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.SystemClock;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.os.Vibrator;
|
||||
import android.provider.Settings;
|
||||
import android.service.dreams.DreamService;
|
||||
import android.service.dreams.IDreamManager;
|
||||
import android.telephony.PhoneStateListener;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.TelephonyManager;
|
||||
@@ -83,6 +86,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
|
||||
private final Context mContext;
|
||||
private final WindowManagerFuncs mWindowManagerFuncs;
|
||||
private final AudioManager mAudioManager;
|
||||
private final IDreamManager mDreamManager;
|
||||
|
||||
private ArrayList<Action> mItems;
|
||||
private GlobalActionsDialog mDialog;
|
||||
@@ -106,6 +110,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
|
||||
mContext = context;
|
||||
mWindowManagerFuncs = windowManagerFuncs;
|
||||
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
||||
mDreamManager = IDreamManager.Stub.asInterface(
|
||||
ServiceManager.getService(DreamService.DREAM_SERVICE));
|
||||
|
||||
// receive broadcasts
|
||||
IntentFilter filter = new IntentFilter();
|
||||
@@ -145,7 +151,20 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
|
||||
}
|
||||
}
|
||||
|
||||
private void awakenIfNecessary() {
|
||||
if (mDreamManager != null) {
|
||||
try {
|
||||
if (mDreamManager.isDreaming()) {
|
||||
mDreamManager.awaken();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
// we tried
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleShow() {
|
||||
awakenIfNecessary();
|
||||
mDialog = createDialog();
|
||||
prepareDialog();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user