Merge "Allow unknown mcc/mnc when constructing a CellIdentity from Parcel."
am: 45e1c58591
Change-Id: Ic4da1daf9e47e064068d007f3e5a4fff3d8ef2e6
diff --git a/api/system-current.txt b/api/system-current.txt
index 9bce265..1f053b2 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -257,6 +257,7 @@
field public static final java.lang.String UPDATE_APP_OPS_STATS = "android.permission.UPDATE_APP_OPS_STATS";
field public static final java.lang.String UPDATE_DEVICE_STATS = "android.permission.UPDATE_DEVICE_STATS";
field public static final java.lang.String UPDATE_LOCK = "android.permission.UPDATE_LOCK";
+ field public static final java.lang.String UPDATE_TIME_ZONE_RULES = "android.permission.UPDATE_TIME_ZONE_RULES";
field public static final java.lang.String USER_ACTIVITY = "android.permission.USER_ACTIVITY";
field public static final java.lang.String USE_FINGERPRINT = "android.permission.USE_FINGERPRINT";
field public static final java.lang.String USE_SIP = "android.permission.USE_SIP";
@@ -38525,6 +38526,22 @@
field public static final java.lang.String TYPE = "type";
}
+ public final class TimeZoneRulesDataContract {
+ field public static final java.lang.String AUTHORITY = "com.android.timezone";
+ }
+
+ public static final class TimeZoneRulesDataContract.Operation {
+ field public static final java.lang.String COLUMN_DISTRO_MAJOR_VERSION = "distro_major_version";
+ field public static final java.lang.String COLUMN_DISTRO_MINOR_VERSION = "distro_minor_version";
+ field public static final java.lang.String COLUMN_REVISION = "revision";
+ field public static final java.lang.String COLUMN_RULES_VERSION = "rules_version";
+ field public static final java.lang.String COLUMN_TYPE = "type";
+ field public static final android.net.Uri CONTENT_URI;
+ field public static final java.lang.String TYPE_INSTALL = "INSTALL";
+ field public static final java.lang.String TYPE_NO_OP = "NOOP";
+ field public static final java.lang.String TYPE_UNINSTALL = "UNINSTALL";
+ }
+
public class UserDictionary {
ctor public UserDictionary();
field public static final java.lang.String AUTHORITY = "user_dictionary";
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 8c78ccb..0ff3215 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -16,6 +16,8 @@
package android.app;
+import static android.os.Build.VERSION_CODES.O;
+
import static java.lang.Character.MIN_VALUE;
import android.annotation.CallSuper;
@@ -974,6 +976,18 @@
@CallSuper
protected void onCreate(@Nullable Bundle savedInstanceState) {
if (DEBUG_LIFECYCLE) Slog.v(TAG, "onCreate " + this + ": " + savedInstanceState);
+
+ if (getApplicationInfo().targetSdkVersion > O && mActivityInfo.isFixedOrientation()) {
+ final TypedArray ta = obtainStyledAttributes(com.android.internal.R.styleable.Window);
+ final boolean isTranslucentOrFloating = ActivityInfo.isTranslucentOrFloating(ta);
+ ta.recycle();
+
+ if (isTranslucentOrFloating) {
+ throw new IllegalStateException(
+ "Only fullscreen opaque activities can request orientation");
+ }
+ }
+
if (mLastNonConfigurationInstances != null) {
mFragments.restoreLoaderNonConfig(mLastNonConfigurationInstances.loaders);
}
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 8659140..18f9e53 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -20,6 +20,7 @@
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Configuration.NativeConfig;
+import android.content.res.TypedArray;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Printer;
@@ -438,7 +439,6 @@
* @hide
*/
public static final int FLAG_SUPPORTS_PICTURE_IN_PICTURE = 0x400000;
-
/**
* @hide Bit in {@link #flags}: If set, this component will only be seen
* by the system user. Only works with broadcast receivers. Set from the
@@ -976,12 +976,20 @@
* Returns true if the activity's orientation is fixed.
* @hide
*/
- boolean isFixedOrientation() {
+ public boolean isFixedOrientation() {
return isFixedOrientationLandscape() || isFixedOrientationPortrait()
|| screenOrientation == SCREEN_ORIENTATION_LOCKED;
}
/**
+ * Returns true if the specified orientation is considered fixed.
+ * @hide
+ */
+ static public boolean isFixedOrientation(int orientation) {
+ return isFixedOrientationLandscape(orientation) || isFixedOrientationPortrait(orientation);
+ }
+
+ /**
* Returns true if the activity's orientation is fixed to landscape.
* @hide
*/
@@ -1160,6 +1168,25 @@
dest.writeFloat(maxAspectRatio);
}
+ /**
+ * Determines whether the {@link Activity} is considered translucent or floating.
+ * @hide
+ */
+ public static boolean isTranslucentOrFloating(TypedArray attributes) {
+ final boolean isTranslucent =
+ attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsTranslucent,
+ false);
+ final boolean isSwipeToDismiss = !attributes.hasValue(
+ com.android.internal.R.styleable.Window_windowIsTranslucent)
+ && attributes.getBoolean(
+ com.android.internal.R.styleable.Window_windowSwipeToDismiss, false);
+ final boolean isFloating =
+ attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsFloating,
+ false);
+
+ return isFloating || isTranslucent || isSwipeToDismiss;
+ }
+
public static final Parcelable.Creator<ActivityInfo> CREATOR
= new Parcelable.Creator<ActivityInfo>() {
public ActivityInfo createFromParcel(Parcel source) {
diff --git a/core/java/android/provider/TimeZoneRulesDataContract.java b/core/java/android/provider/TimeZoneRulesDataContract.java
index 7896385..33d2588 100644
--- a/core/java/android/provider/TimeZoneRulesDataContract.java
+++ b/core/java/android/provider/TimeZoneRulesDataContract.java
@@ -16,6 +16,7 @@
package android.provider;
+import android.annotation.SystemApi;
import android.net.Uri;
/**
@@ -24,6 +25,7 @@
*
* @hide
*/
+@SystemApi
public final class TimeZoneRulesDataContract {
private TimeZoneRulesDataContract() {}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index e1318c3..3477611 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2236,7 +2236,7 @@
<p>An application requesting this permission is responsible for
verifying the source and integrity of the update before passing
it off to the installer components.
- @hide -->
+ @SystemApi @hide -->
<permission android:name="android.permission.UPDATE_TIME_ZONE_RULES"
android:protectionLevel="signature|privileged" />
diff --git a/packages/SettingsLib/src/com/android/settingslib/Utils.java b/packages/SettingsLib/src/com/android/settingslib/Utils.java
index e8c4884..dee5a93 100644
--- a/packages/SettingsLib/src/com/android/settingslib/Utils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/Utils.java
@@ -19,7 +19,6 @@
import android.net.ConnectivityManager;
import android.net.NetworkBadging;
import android.os.BatteryManager;
-import android.os.UserHandle;
import android.os.UserManager;
import android.print.PrintManager;
import android.provider.Settings;
@@ -31,12 +30,6 @@
import java.text.NumberFormat;
public class Utils {
- /** Broadcast intent action when the location mode is about to change. */
- private static final String MODE_CHANGING_ACTION =
- "com.android.settings.location.MODE_CHANGING";
- private static final String CURRENT_MODE_KEY = "CURRENT_MODE";
- private static final String NEW_MODE_KEY = "NEW_MODE";
-
private static Signature[] sSystemSignature;
private static String sPermissionControllerPackageName;
private static String sServicesSystemSharedLibPackageName;
@@ -50,18 +43,6 @@
com.android.internal.R.drawable.ic_signal_wifi_badged_4_bars
};
- public static boolean updateLocationMode(Context context, int oldMode, int newMode,
- int userId) {
- Intent intent = new Intent(MODE_CHANGING_ACTION);
- intent.putExtra(CURRENT_MODE_KEY, oldMode);
- intent.putExtra(NEW_MODE_KEY, newMode);
- intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
- context.sendBroadcastAsUser(intent, UserHandle.of(userId),
- android.Manifest.permission.WRITE_SECURE_SETTINGS);
- return Settings.Secure.putIntForUser(context.getContentResolver(),
- Settings.Secure.LOCATION_MODE, newMode, userId);
- }
-
/**
* Return string resource that best describes combination of tethering
* options available on this device.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java
index 6d6aa52..874f0d9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java
@@ -39,8 +39,6 @@
import java.util.ArrayList;
import java.util.List;
-import static com.android.settingslib.Utils.updateLocationMode;
-
/**
* A controller to manage changes of location related states and update the views accordingly.
*/
@@ -108,13 +106,12 @@
final ContentResolver cr = mContext.getContentResolver();
// When enabling location, a user consent dialog will pop up, and the
// setting won't be fully enabled until the user accepts the agreement.
- int currentMode = Settings.Secure.getIntForUser(cr, Settings.Secure.LOCATION_MODE,
- Settings.Secure.LOCATION_MODE_OFF, currentUserId);
int mode = enabled
? Settings.Secure.LOCATION_MODE_PREVIOUS : Settings.Secure.LOCATION_MODE_OFF;
// QuickSettings always runs as the owner, so specifically set the settings
// for the current foreground user.
- return updateLocationMode(mContext, currentMode, mode, currentUserId);
+ return Settings.Secure
+ .putIntForUser(cr, Settings.Secure.LOCATION_MODE, mode, currentUserId);
}
/**
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 90b8e29..d9944a7 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -3857,7 +3857,7 @@
}
if (app.info.isPrivilegedApp() &&
- SystemProperties.getBoolean("pm.dexopt.priv-apps-oob", false)) {
+ !SystemProperties.getBoolean("pm.dexopt.priv-apps", true)) {
runtimeFlags |= Zygote.DISABLE_VERIFIER;
runtimeFlags |= Zygote.ONLY_USE_SYSTEM_OAT_FILES;
}
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index 253bdc5..fe006fc 100644
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -133,6 +133,7 @@
import android.graphics.Bitmap;
import android.graphics.GraphicBuffer;
import android.graphics.Rect;
+import android.os.Build;
import android.os.Bundle;
import android.os.Debug;
import android.os.IBinder;
@@ -896,15 +897,7 @@
Entry ent = AttributeCache.instance().get(packageName,
realTheme, com.android.internal.R.styleable.Window, userId);
- final boolean translucent = ent != null && (ent.array.getBoolean(
- com.android.internal.R.styleable.Window_windowIsTranslucent, false)
- || (!ent.array.hasValue(
- com.android.internal.R.styleable.Window_windowIsTranslucent)
- && ent.array.getBoolean(
- com.android.internal.R.styleable.Window_windowSwipeToDismiss,
- false)));
- fullscreen = ent != null && !ent.array.getBoolean(
- com.android.internal.R.styleable.Window_windowIsFloating, false) && !translucent;
+ fullscreen = ent != null && !ActivityInfo.isTranslucentOrFloating(ent.array);
noDisplay = ent != null && ent.array.getBoolean(
com.android.internal.R.styleable.Window_windowNoDisplay, false);
@@ -2202,6 +2195,11 @@
}
void setRequestedOrientation(int requestedOrientation) {
+ if (ActivityInfo.isFixedOrientation(requestedOrientation) && !fullscreen
+ && appInfo.targetSdkVersion > O) {
+ throw new IllegalStateException("Only fullscreen activities can request orientation");
+ }
+
final int displayId = getDisplayId();
final Configuration displayConfig =
mStackSupervisor.getDisplayOverrideConfiguration(displayId);
diff --git a/services/core/java/com/android/server/pm/PackageDexOptimizer.java b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
index 401eb62..ef015e7 100644
--- a/services/core/java/com/android/server/pm/PackageDexOptimizer.java
+++ b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
@@ -110,9 +110,9 @@
return false;
}
- // We do not dexopt a priv-app package when pm.dexopt.priv-apps-oob is true.
+ // We do not dexopt a priv-app package when pm.dexopt.priv-apps is false.
if (pkg.isPrivilegedApp()) {
- return !SystemProperties.getBoolean("pm.dexopt.priv-apps-oob", false);
+ return SystemProperties.getBoolean("pm.dexopt.priv-apps", true);
}
return true;
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 8853aa0..242a76d 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -10270,7 +10270,7 @@
if (Build.IS_DEBUGGABLE &&
pkg.isPrivilegedApp() &&
- SystemProperties.getBoolean("pm.dexopt.priv-apps-oob", false)) {
+ !SystemProperties.getBoolean("pm.dexopt.priv-apps", true)) {
PackageManagerServiceUtils.logPackageHasUncompressedCode(pkg);
}
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index d176d94..2e4de8c 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -72,6 +72,8 @@
import java.util.ArrayDeque;
import java.util.ArrayList;
+import static android.os.Build.VERSION_CODES.O;
+
class AppTokenList extends ArrayList<AppWindowToken> {
}
@@ -1291,6 +1293,15 @@
*/
@Override
int getOrientation(int candidate) {
+ // We do not allow non-fullscreen apps to influence orientation beyond O. While we do
+ // throw an exception in {@link Activity#onCreate} and
+ // {@link Activity#setRequestedOrientation}, we also ignore the orientation here so that
+ // other calculations aren't affected.
+ if (!fillsParent() && mTargetSdk > O) {
+ // Can't specify orientation if app doesn't fill parent.
+ return SCREEN_ORIENTATION_UNSET;
+ }
+
if (candidate == SCREEN_ORIENTATION_BEHIND) {
// Allow app to specify orientation regardless of its visibility state if the current
// candidate want us to use orientation behind. I.e. the visible app on-top of this one
diff --git a/services/tests/servicestests/src/com/android/server/wm/AppWindowTokenTests.java b/services/tests/servicestests/src/com/android/server/wm/AppWindowTokenTests.java
index 77a0436..b09601e 100644
--- a/services/tests/servicestests/src/com/android/server/wm/AppWindowTokenTests.java
+++ b/services/tests/servicestests/src/com/android/server/wm/AppWindowTokenTests.java
@@ -175,7 +175,7 @@
token.setOrientation(SCREEN_ORIENTATION_LANDSCAPE);
token.setFillsParent(false);
- // Can specify orientation if app doesn't fill parent.
+ // Can specify orientation if app doesn't fill parent. Allowed for SDK <= 25.
assertEquals(SCREEN_ORIENTATION_LANDSCAPE, token.getOrientation());
token.setFillsParent(true);