use of android.view.IWindowManager in project android_frameworks_base by ResurrectionRemix.
the class TrustManagerService method refreshDeviceLockedForUser.
private void refreshDeviceLockedForUser(int userId) {
if (userId != UserHandle.USER_ALL && userId < UserHandle.USER_SYSTEM) {
Log.e(TAG, "refreshDeviceLockedForUser(userId=" + userId + "): Invalid user handle," + " must be USER_ALL or a specific user.", new Throwable("here"));
userId = UserHandle.USER_ALL;
}
List<UserInfo> userInfos;
if (userId == UserHandle.USER_ALL) {
userInfos = mUserManager.getUsers(true);
} else {
userInfos = new ArrayList<>();
userInfos.add(mUserManager.getUserInfo(userId));
}
IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
for (int i = 0; i < userInfos.size(); i++) {
UserInfo info = userInfos.get(i);
if (info == null || info.partial || !info.isEnabled() || info.guestToRemove || !info.supportsSwitchToByUser()) {
continue;
}
int id = info.id;
boolean secure = mLockPatternUtils.isSecure(id);
boolean trusted = aggregateIsTrusted(id);
boolean showingKeyguard = true;
if (mCurrentUser == id) {
try {
showingKeyguard = wm.isKeyguardLocked();
} catch (RemoteException e) {
}
}
boolean deviceLocked = secure && showingKeyguard && !trusted;
boolean changed;
synchronized (mDeviceLockedForUser) {
changed = isDeviceLockedInner(id) != deviceLocked;
mDeviceLockedForUser.put(id, deviceLocked);
}
if (changed) {
dispatchDeviceLocked(id, deviceLocked);
}
}
}
use of android.view.IWindowManager in project android_frameworks_base by ResurrectionRemix.
the class RotationPolicy method getRotationLockOrientation.
/**
* Returns the orientation that will be used when locking the orientation from system UI
* with {@link #setRotationLock}.
*
* If the device only supports locking to its natural orientation, this will be either
* Configuration.ORIENTATION_PORTRAIT or Configuration.ORIENTATION_LANDSCAPE,
* otherwise Configuration.ORIENTATION_UNDEFINED if any orientation is lockable.
*/
public static int getRotationLockOrientation(Context context) {
if (!isCurrentRotationAllowed(context)) {
final Point size = new Point();
final IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
try {
wm.getInitialDisplaySize(Display.DEFAULT_DISPLAY, size);
return size.x < size.y ? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE;
} catch (RemoteException e) {
Log.w(TAG, "Unable to get the display size");
}
}
return Configuration.ORIENTATION_UNDEFINED;
}
use of android.view.IWindowManager in project android_frameworks_base by ResurrectionRemix.
the class RotationPolicy method isCurrentRotationAllowed.
private static boolean isCurrentRotationAllowed(Context context) {
int userRotationAngles = Settings.System.getInt(context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION_ANGLES, -1);
boolean allowAllRotations = context.getResources().getBoolean(com.android.internal.R.bool.config_allowAllRotations);
final IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
try {
return isRotationAllowed(wm.getRotation(), userRotationAngles, allowAllRotations);
} catch (RemoteException exc) {
Log.w(TAG, "Unable to getWindowManagerService.getRotation()");
}
return false;
}
use of android.view.IWindowManager in project android_frameworks_base by ResurrectionRemix.
the class DisplayDensityUtils method clearForcedDisplayDensity.
/**
* Asynchronously applies display density changes to the specified display.
* <p>
* The change will be applied to the user specified by the value of
* {@link UserHandle#myUserId()} at the time the method is called.
*
* @param displayId the identifier of the display to modify
*/
public static void clearForcedDisplayDensity(final int displayId) {
final int userId = UserHandle.myUserId();
AsyncTask.execute(() -> {
try {
final IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
wm.clearForcedDisplayDensityForUser(displayId, userId);
} catch (RemoteException exc) {
Log.w(LOG_TAG, "Unable to clear forced display density setting");
}
});
}
use of android.view.IWindowManager in project android_frameworks_base by ResurrectionRemix.
the class ShellUiAutomatorBridge method getRotation.
@Override
public int getRotation() {
IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService(Context.WINDOW_SERVICE));
int ret = -1;
try {
ret = wm.getRotation();
} catch (RemoteException e) {
Log.e(LOG_TAG, "Error getting screen rotation", e);
throw new RuntimeException(e);
}
return ret;
}
Aggregations