Merge "Force resize pre-N apps that don't have fixed orientation." into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b305e16051
@@ -789,6 +789,22 @@ public class ActivityInfo extends ComponentInfo
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the activity's orientation is fixed.
|
||||
* @hide
|
||||
*/
|
||||
boolean isFixedOrientation() {
|
||||
return screenOrientation == SCREEN_ORIENTATION_LANDSCAPE
|
||||
|| screenOrientation == SCREEN_ORIENTATION_PORTRAIT
|
||||
|| screenOrientation == SCREEN_ORIENTATION_SENSOR_LANDSCAPE
|
||||
|| screenOrientation == SCREEN_ORIENTATION_SENSOR_PORTRAIT
|
||||
|| screenOrientation == SCREEN_ORIENTATION_REVERSE_LANDSCAPE
|
||||
|| screenOrientation == SCREEN_ORIENTATION_REVERSE_PORTRAIT
|
||||
|| screenOrientation == SCREEN_ORIENTATION_USER_LANDSCAPE
|
||||
|| screenOrientation == SCREEN_ORIENTATION_USER_PORTRAIT
|
||||
|| screenOrientation == SCREEN_ORIENTATION_LOCKED;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public static boolean isResizeableMode(int mode) {
|
||||
return mode == RESIZE_MODE_RESIZEABLE
|
||||
|
||||
@@ -3449,8 +3449,7 @@ public class PackageParser {
|
||||
}
|
||||
} else if (owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.N) {
|
||||
a.info.resizeMode = RESIZE_MODE_UNRESIZEABLE;
|
||||
} else if (a.info.screenOrientation == SCREEN_ORIENTATION_UNSPECIFIED
|
||||
&& (a.info.flags & FLAG_IMMERSIVE) == 0) {
|
||||
} else if (!a.info.isFixedOrientation() && (a.info.flags & FLAG_IMMERSIVE) == 0) {
|
||||
a.info.resizeMode = RESIZE_MODE_FORCE_RESIZEABLE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user