am 6ebbe1b9: Merge "Invoking the global action dialog stops dreaming." into jb-mr1-dev
* commit '6ebbe1b97005a40850a1633aa4fc12af0392e986': Invoking the global action dialog stops dreaming.
This commit is contained in:
@@ -39,12 +39,15 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
import android.os.ServiceManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
import android.service.dreams.DreamService;
|
||||||
|
import android.service.dreams.IDreamManager;
|
||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
import android.telephony.ServiceState;
|
import android.telephony.ServiceState;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
@@ -83,6 +86,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
|
|||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final WindowManagerFuncs mWindowManagerFuncs;
|
private final WindowManagerFuncs mWindowManagerFuncs;
|
||||||
private final AudioManager mAudioManager;
|
private final AudioManager mAudioManager;
|
||||||
|
private final IDreamManager mDreamManager;
|
||||||
|
|
||||||
private ArrayList<Action> mItems;
|
private ArrayList<Action> mItems;
|
||||||
private GlobalActionsDialog mDialog;
|
private GlobalActionsDialog mDialog;
|
||||||
@@ -106,6 +110,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
|
|||||||
mContext = context;
|
mContext = context;
|
||||||
mWindowManagerFuncs = windowManagerFuncs;
|
mWindowManagerFuncs = windowManagerFuncs;
|
||||||
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
||||||
|
mDreamManager = IDreamManager.Stub.asInterface(
|
||||||
|
ServiceManager.getService(DreamService.DREAM_SERVICE));
|
||||||
|
|
||||||
// receive broadcasts
|
// receive broadcasts
|
||||||
IntentFilter filter = new IntentFilter();
|
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() {
|
private void handleShow() {
|
||||||
|
awakenIfNecessary();
|
||||||
mDialog = createDialog();
|
mDialog = createDialog();
|
||||||
prepareDialog();
|
prepareDialog();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user