Force resize pre-N apps that don't have fixed orientation.

We were previously only doing it for SCREEN_ORIENTATION_UNSPECIFIED,
but there are other orientation settings that aren't fixed that we
need to handle.

Change-Id: If21fcd8312b6267407d94b6646158ac6eae44b44
This commit is contained in:
Wale Ogunwale
2016-02-15 19:31:50 -08:00
parent 3dbcd203c5
commit 508ff55e8c
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

@@ -3447,8 +3447,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;
}