Merge "Force resize pre-N apps that don't have fixed orientation." into nyc-dev

This commit is contained in:
Wale Ogunwale
2016-02-16 17:54:32 +00:00
committed by Android (Google) Code Review
2 changed files with 17 additions and 2 deletions

View File

@@ -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

View File

@@ -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;
}