Merge "Let NoMan know when something is no longer a bubble" into qt-dev
diff --git a/Android.mk b/Android.mk
index c58f7af..9bda2dc 100644
--- a/Android.mk
+++ b/Android.mk
@@ -32,27 +32,6 @@
# ============================================================
include $(CLEAR_VARS)
-aidl_parcelables :=
-define stubs-to-aidl-parcelables
- gen := $(TARGET_OUT_COMMON_INTERMEDIATES)/$1.aidl
- aidl_parcelables += $$(gen)
- $$(gen): $(call java-lib-header-files,$1) $(HOST_OUT_EXECUTABLES)/sdkparcelables
- @echo Extract SDK parcelables: $$@
- rm -f $$@
- $(HOST_OUT_EXECUTABLES)/sdkparcelables $$< $$@
-endef
-
-$(foreach stubs,android_stubs_current android_test_stubs_current android_system_stubs_current,\
- $(eval $(call stubs-to-aidl-parcelables,$(stubs))))
-
-gen := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
-.KATI_RESTAT: $(gen)
-$(gen): $(aidl_parcelables)
- @echo Combining SDK parcelables: $@
- rm -f $@.tmp
- cat $^ | sort -u > $@.tmp
- $(call commit-change-for-toc,$@)
-
# This is used by ide.mk as the list of source files that are
# always included.
INTERNAL_SDK_SOURCE_DIRS := $(addprefix $(LOCAL_PATH)/,$(dirs_to_document))
diff --git a/api/system-current.txt b/api/system-current.txt
index d08039d..acbd28f 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -3079,16 +3079,15 @@
}
public final class GnssCapabilities {
- method public boolean hasCapability(int);
- field public static final int GEOFENCING = 2; // 0x2
- field public static final int LOW_POWER_MODE = 0; // 0x0
- field public static final int MEASUREMENTS = 3; // 0x3
- field public static final int MEASUREMENT_CORRECTIONS = 5; // 0x5
- field public static final int MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH = 7; // 0x7
- field public static final int MEASUREMENT_CORRECTIONS_LOS_SATS = 6; // 0x6
- field public static final int MEASUREMENT_CORRECTIONS_REFLECTING_PLANE = 8; // 0x8
- field public static final int NAV_MESSAGES = 4; // 0x4
- field public static final int SATELLITE_BLACKLIST = 1; // 0x1
+ method public boolean hasGeofencing();
+ method public boolean hasLowPowerMode();
+ method public boolean hasMeasurementCorrections();
+ method public boolean hasMeasurementCorrectionsExcessPathLength();
+ method public boolean hasMeasurementCorrectionsLosSats();
+ method public boolean hasMeasurementCorrectionsReflectingPane();
+ method public boolean hasMeasurements();
+ method public boolean hasNavMessages();
+ method public boolean hasSatelliteBlacklist();
}
public final class GnssMeasurementCorrections implements android.os.Parcelable {
@@ -3399,7 +3398,7 @@
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void flushGnssBatch();
method @Nullable public String getExtraLocationControllerPackage();
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public int getGnssBatchSize();
- method @Nullable public android.location.GnssCapabilities getGnssCapabilities();
+ method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public android.location.GnssCapabilities getGnssCapabilities();
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void injectGnssMeasurementCorrections(@NonNull android.location.GnssMeasurementCorrections);
method public boolean isExtraLocationControllerPackageEnabled();
method public boolean isLocationEnabledForUser(@NonNull android.os.UserHandle);
@@ -9479,7 +9478,7 @@
package android.view.accessibility {
public final class AccessibilityManager {
- method public int getAccessibilityWindowId(android.os.IBinder);
+ method public int getAccessibilityWindowId(@Nullable android.os.IBinder);
method @RequiresPermission(android.Manifest.permission.MANAGE_ACCESSIBILITY) public void performAccessibilityShortcut();
}
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 0d22f3a..c8bd275 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -127,6 +127,7 @@
import android.view.autofill.IAutofillWindowPresenter;
import android.view.contentcapture.ContentCaptureContext;
import android.view.contentcapture.ContentCaptureManager;
+import android.view.contentcapture.ContentCaptureManager.ContentCaptureClient;
import android.widget.AdapterView;
import android.widget.Toast;
import android.widget.Toolbar;
@@ -723,7 +724,7 @@
Window.Callback, KeyEvent.Callback,
OnCreateContextMenuListener, ComponentCallbacks2,
Window.OnWindowDismissedCallback, WindowControllerCallback,
- AutofillManager.AutofillClient {
+ AutofillManager.AutofillClient, ContentCaptureManager.ContentCaptureClient {
private static final String TAG = "Activity";
private static final boolean DEBUG_LIFECYCLE = false;
@@ -1125,6 +1126,12 @@
return this;
}
+ /** @hide */
+ @Override
+ public final ContentCaptureClient getContentCaptureClient() {
+ return this;
+ }
+
/**
* Register an {@link Application.ActivityLifecycleCallbacks} instance that receives
* lifecycle callbacks for only this Activity.
@@ -6511,6 +6518,12 @@
return getComponentName();
}
+ /** @hide */
+ @Override
+ public final ComponentName contentCaptureClientGetComponentName() {
+ return getComponentName();
+ }
+
/**
* Retrieve a {@link SharedPreferences} object for accessing preferences
* that are private to this activity. This simply calls the underlying
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index 98b658d..c48c878 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -1143,7 +1143,7 @@
Context outerContext = ctx.getOuterContext();
ContentCaptureOptions options = outerContext.getContentCaptureOptions();
// Options is null when the service didn't whitelist the activity or package
- if (options != null) {
+ if (options != null && (options.lite || options.isWhitelisted(outerContext))) {
IBinder b = ServiceManager
.getService(Context.CONTENT_CAPTURE_MANAGER_SERVICE);
IContentCaptureManager service = IContentCaptureManager.Stub.asInterface(b);
diff --git a/core/java/android/content/ContentCaptureOptions.java b/core/java/android/content/ContentCaptureOptions.java
index 76c4fb8..cb2142c 100644
--- a/core/java/android/content/ContentCaptureOptions.java
+++ b/core/java/android/content/ContentCaptureOptions.java
@@ -24,6 +24,9 @@
import android.util.ArraySet;
import android.util.Log;
import android.view.contentcapture.ContentCaptureManager;
+import android.view.contentcapture.ContentCaptureManager.ContentCaptureClient;
+
+import com.android.internal.annotations.VisibleForTesting;
import java.io.PrintWriter;
@@ -78,12 +81,19 @@
*/
public final boolean lite;
+ /**
+ * Constructor for "lite" objects that are just used to enable a {@link ContentCaptureManager}
+ * for contexts belonging to the content capture service app.
+ */
public ContentCaptureOptions(int loggingLevel) {
this(/* lite= */ true, loggingLevel, /* maxBufferSize= */ 0,
/* idleFlushingFrequencyMs= */ 0, /* textChangeFlushingFrequencyMs= */ 0,
/* logHistorySize= */ 0, /* whitelistedComponents= */ null);
}
+ /**
+ * Default constructor.
+ */
public ContentCaptureOptions(int loggingLevel, int maxBufferSize, int idleFlushingFrequencyMs,
int textChangeFlushingFrequencyMs, int logHistorySize,
@Nullable ArraySet<ComponentName> whitelistedComponents) {
@@ -91,6 +101,16 @@
textChangeFlushingFrequencyMs, logHistorySize, whitelistedComponents);
}
+ /** @hide */
+ @VisibleForTesting
+ public ContentCaptureOptions(@Nullable ArraySet<ComponentName> whitelistedComponents) {
+ this(ContentCaptureManager.LOGGING_LEVEL_VERBOSE,
+ ContentCaptureManager.DEFAULT_MAX_BUFFER_SIZE,
+ ContentCaptureManager.DEFAULT_IDLE_FLUSHING_FREQUENCY_MS,
+ ContentCaptureManager.DEFAULT_TEXT_CHANGE_FLUSHING_FREQUENCY_MS,
+ ContentCaptureManager.DEFAULT_LOG_HISTORY_SIZE, whitelistedComponents);
+ }
+
private ContentCaptureOptions(boolean lite, int loggingLevel, int maxBufferSize,
int idleFlushingFrequencyMs, int textChangeFlushingFrequencyMs, int logHistorySize,
@Nullable ArraySet<ComponentName> whitelistedComponents) {
@@ -103,10 +123,6 @@
this.whitelistedComponents = whitelistedComponents;
}
- /**
- * @hide
- */
- @TestApi
public static ContentCaptureOptions forWhitelistingItself() {
final ActivityThread at = ActivityThread.currentActivityThread();
if (at == null) {
@@ -120,19 +136,27 @@
throw new SecurityException("Thou shall not pass!");
}
- final ContentCaptureOptions options = new ContentCaptureOptions(
- ContentCaptureManager.LOGGING_LEVEL_VERBOSE,
- ContentCaptureManager.DEFAULT_MAX_BUFFER_SIZE,
- ContentCaptureManager.DEFAULT_IDLE_FLUSHING_FREQUENCY_MS,
- ContentCaptureManager.DEFAULT_TEXT_CHANGE_FLUSHING_FREQUENCY_MS,
- ContentCaptureManager.DEFAULT_LOG_HISTORY_SIZE,
- /* whitelistedComponents= */ null);
+ final ContentCaptureOptions options =
+ new ContentCaptureOptions(/* whitelistedComponents= */ null);
// Always log, as it's used by test only
Log.i(TAG, "forWhitelistingItself(" + packageName + "): " + options);
return options;
}
+ /** @hide */
+ @VisibleForTesting
+ public boolean isWhitelisted(@NonNull Context context) {
+ if (whitelistedComponents == null) return true; // whole package is whitelisted
+ final ContentCaptureClient client = context.getContentCaptureClient();
+ if (client == null) {
+ // Shouldn't happen, but it doesn't hurt to check...
+ Log.w(TAG, "isWhitelisted(): no ContentCaptureClient on " + context);
+ return false;
+ }
+ return whitelistedComponents.contains(client.contentCaptureClientGetComponentName());
+ }
+
@Override
public String toString() {
if (lite) {
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index de04829..00238bf 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -70,6 +70,7 @@
import android.view.ViewDebug;
import android.view.WindowManager;
import android.view.autofill.AutofillManager.AutofillClient;
+import android.view.contentcapture.ContentCaptureManager.ContentCaptureClient;
import android.view.textclassifier.TextClassificationManager;
import java.io.File;
@@ -5414,6 +5415,14 @@
/**
* @hide
*/
+ @Nullable
+ public ContentCaptureClient getContentCaptureClient() {
+ return null;
+ }
+
+ /**
+ * @hide
+ */
public final boolean isAutofillCompatibilityEnabled() {
final AutofillOptions options = getAutofillOptions();
return options != null && options.compatModeEnabled;
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 83e15e8..abb68e7 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -2030,9 +2030,10 @@
/**
* Feature for {@link #getSystemAvailableFeatures} and
- * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API
- * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate
- * what level of optional hardware features limits it supports.
+ * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan
+ * implementation on this device is hardware accelerated, and the Vulkan native API will
+ * enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate what
+ * level of optional hardware features limits it supports.
* <p>
* Level 0 includes the base Vulkan requirements as well as:
* <ul><li>{@code VkPhysicalDeviceFeatures::textureCompressionETC2}</li></ul>
@@ -2057,10 +2058,10 @@
/**
* Feature for {@link #getSystemAvailableFeatures} and
- * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API
- * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate
- * what level of optional compute features that device supports beyond the Vulkan 1.0
- * requirements.
+ * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan
+ * implementation on this device is hardware accelerated, and the Vulkan native API will
+ * enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate what
+ * level of optional compute features that device supports beyond the Vulkan 1.0 requirements.
* <p>
* Compute level 0 indicates:
* <ul>
@@ -2075,10 +2076,11 @@
/**
* Feature for {@link #getSystemAvailableFeatures} and
- * {@link #hasSystemFeature(String, int)}: The version of this feature indicates the highest
- * {@code VkPhysicalDeviceProperties::apiVersion} supported by the physical devices that support
- * the hardware level indicated by {@link #FEATURE_VULKAN_HARDWARE_LEVEL}. The feature version
- * uses the same encoding as Vulkan version numbers:
+ * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan
+ * implementation on this device is hardware accelerated, and the feature version will indicate
+ * the highest {@code VkPhysicalDeviceProperties::apiVersion} supported by the physical devices
+ * that support the hardware level indicated by {@link #FEATURE_VULKAN_HARDWARE_LEVEL}. The
+ * feature version uses the same encoding as Vulkan version numbers:
* <ul>
* <li>Major version number in bits 31-22</li>
* <li>Minor version number in bits 21-12</li>
diff --git a/core/java/android/net/UrlQuerySanitizer.java b/core/java/android/net/UrlQuerySanitizer.java
index 5b67406..cf08b65 100644
--- a/core/java/android/net/UrlQuerySanitizer.java
+++ b/core/java/android/net/UrlQuerySanitizer.java
@@ -22,6 +22,8 @@
import java.util.Locale;
import java.util.Set;
import java.util.StringTokenizer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
*
@@ -837,15 +839,11 @@
* @param string the escaped string
* @return the unescaped string.
*/
+ private static final Pattern plusOrPercent = Pattern.compile("[+%]");
public String unescape(String string) {
- // Early exit if no escaped characters.
- int firstEscape = string.indexOf('%');
- if ( firstEscape < 0) {
- firstEscape = string.indexOf('+');
- if (firstEscape < 0) {
- return string;
- }
- }
+ final Matcher matcher = plusOrPercent.matcher(string);
+ if (!matcher.find()) return string;
+ final int firstEscape = matcher.start();
int length = string.length();
@@ -855,8 +853,7 @@
char c = string.charAt(i);
if (c == '+') {
c = ' ';
- }
- else if ( c == '%' && i + 2 < length) {
+ } else if (c == '%' && i + 2 < length) {
char c1 = string.charAt(i + 1);
char c2 = string.charAt(i + 2);
if (isHexDigit(c1) && isHexDigit(c2)) {
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 7d61bf6..2fff595 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -555,6 +555,18 @@
}
/**
+ * @hide
+ */
+ public static class WakeData {
+ public WakeData(long wakeTime, @WakeReason int wakeReason) {
+ this.wakeTime = wakeTime;
+ this.wakeReason = wakeReason;
+ }
+ public long wakeTime;
+ public @WakeReason int wakeReason;
+ }
+
+ /**
* The value to pass as the 'reason' argument to reboot() to reboot into
* recovery mode for tasks other than applying system updates, such as
* doing factory resets.
diff --git a/core/java/android/os/PowerManagerInternal.java b/core/java/android/os/PowerManagerInternal.java
index d55489a..9661a08 100644
--- a/core/java/android/os/PowerManagerInternal.java
+++ b/core/java/android/os/PowerManagerInternal.java
@@ -203,4 +203,7 @@
/** Returns whether there hasn't been a user activity event for the given number of ms. */
public abstract boolean wasDeviceIdleFor(long ms);
+
+ /** Returns information about the last wakeup event. */
+ public abstract PowerManager.WakeData getLastWakeup();
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index ac59101..58b70a7 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -14712,6 +14712,18 @@
public static final String TEXT_CLASSIFIER_ACTION_MODEL_PARAMS =
"text_classifier_action_model_params";
+ /**
+ * The amount of time to suppress "power-off" from the power button after the device has
+ * woken due to a gesture (lifting the phone). Since users have learned to hit the power
+ * button immediately when lifting their device, it can cause the device to turn off if a
+ * gesture has just woken the device. This value tells us the milliseconds to wait after
+ * a gesture before "power-off" via power-button is functional again. A value of 0 is no
+ * delay, and reverts to the old behavior.
+ *
+ * @hide
+ */
+ public static final String POWER_BUTTON_SUPPRESSION_DELAY_AFTER_GESTURE_WAKE =
+ "power_button_suppression_delay_after_gesture_wake";
}
/**
diff --git a/core/java/android/view/accessibility/AccessibilityManager.java b/core/java/android/view/accessibility/AccessibilityManager.java
index d12777f..882e6fd 100644
--- a/core/java/android/view/accessibility/AccessibilityManager.java
+++ b/core/java/android/view/accessibility/AccessibilityManager.java
@@ -1015,7 +1015,7 @@
* @hide
*/
@SystemApi
- public int getAccessibilityWindowId(IBinder windowToken) {
+ public int getAccessibilityWindowId(@Nullable IBinder windowToken) {
if (windowToken == null) {
return AccessibilityWindowInfo.UNDEFINED_WINDOW_ID;
}
diff --git a/core/java/android/view/contentcapture/ContentCaptureManager.java b/core/java/android/view/contentcapture/ContentCaptureManager.java
index a977073..c2ad82f 100644
--- a/core/java/android/view/contentcapture/ContentCaptureManager.java
+++ b/core/java/android/view/contentcapture/ContentCaptureManager.java
@@ -294,6 +294,15 @@
private MainContentCaptureSession mMainSession;
/** @hide */
+ public interface ContentCaptureClient {
+ /**
+ * Gets the component name of the client.
+ */
+ @NonNull
+ ComponentName contentCaptureClientGetComponentName();
+ }
+
+ /** @hide */
public ContentCaptureManager(@NonNull Context context,
@NonNull IContentCaptureManager service, @NonNull ContentCaptureOptions options) {
mContext = Preconditions.checkNotNull(context, "context cannot be null");
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index be66de2..e6cff80 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -1802,7 +1802,8 @@
if (info == null) return null;
// Now fetch app icon and raster with no badging even in work profile
- Bitmap appIcon = makePresentationGetter(info).getIconBitmap();
+ Bitmap appIcon = makePresentationGetter(info).getIconBitmap(
+ UserHandle.getUserHandleForUid(UserHandle.myUserId()));
// Raster target drawable with appIcon as a badge
SimpleIconFactory sif = SimpleIconFactory.obtain(ChooserActivity.this);
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 2849f57..5e4918d 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -551,11 +551,11 @@
mAi.packageName);
}
- public Drawable getIcon() {
- return new BitmapDrawable(mCtx.getResources(), getIconBitmap());
+ public Drawable getIcon(UserHandle userHandle) {
+ return new BitmapDrawable(mCtx.getResources(), getIconBitmap(userHandle));
}
- public Bitmap getIconBitmap() {
+ public Bitmap getIconBitmap(UserHandle userHandle) {
Drawable dr = null;
if (mHasSubstitutePermission) {
dr = getIconSubstituteInternal();
@@ -576,7 +576,7 @@
}
SimpleIconFactory sif = SimpleIconFactory.obtain(mCtx);
- Bitmap icon = sif.createUserBadgedIconBitmap(dr, Process.myUserHandle());
+ Bitmap icon = sif.createUserBadgedIconBitmap(dr, userHandle);
sif.recycle();
return icon;
@@ -699,7 +699,8 @@
}
Drawable loadIconForResolveInfo(ResolveInfo ri) {
- return makePresentationGetter(ri).getIcon();
+ // Load icons based on the current process. If in work profile icons should be badged.
+ return makePresentationGetter(ri).getIcon(Process.myUserHandle());
}
@Override
diff --git a/core/java/com/android/internal/app/SimpleIconFactory.java b/core/java/com/android/internal/app/SimpleIconFactory.java
index 2484109..7a4e76f 100644
--- a/core/java/com/android/internal/app/SimpleIconFactory.java
+++ b/core/java/com/android/internal/app/SimpleIconFactory.java
@@ -43,7 +43,6 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.DrawableWrapper;
-import android.os.Process;
import android.os.UserHandle;
import android.util.AttributeSet;
import android.util.Pools.SynchronizedPool;
@@ -161,6 +160,7 @@
/**
* Creates bitmap using the source drawable and various parameters.
* The bitmap is visually normalized with other icons and has enough spacing to add shadow.
+ * Note: this method has been modified from iconloaderlib to remove a profile diff check.
*
* @param icon source of the icon associated with a user that has no badge,
* likely user 0
@@ -186,7 +186,7 @@
}
final Bitmap result;
- if (user != null && !Process.myUserHandle().equals(user)) {
+ if (user != null /* if modification from iconloaderlib */) {
BitmapDrawable drawable = new FixedSizeBitmapDrawable(bitmap);
Drawable badged = mPm.getUserBadgedIcon(drawable, user);
if (badged instanceof BitmapDrawable) {
diff --git a/core/java/com/android/internal/infra/GlobalWhitelistState.java b/core/java/com/android/internal/infra/GlobalWhitelistState.java
index dfa59b7..a0b2f94 100644
--- a/core/java/com/android/internal/infra/GlobalWhitelistState.java
+++ b/core/java/com/android/internal/infra/GlobalWhitelistState.java
@@ -35,11 +35,13 @@
*
* <p>This class is thread safe.
*/
+// TODO: add unit tests
public class GlobalWhitelistState {
// Uses full-name to avoid collision with service-provided mLock
protected final Object mGlobalWhitelistStateLock = new Object();
+ // TODO: should not be exposed directly
@Nullable
@GuardedBy("mGlobalWhitelistStateLock")
protected SparseArray<WhitelistHelper> mWhitelisterHelpers;
diff --git a/core/java/com/android/internal/infra/WhitelistHelper.java b/core/java/com/android/internal/infra/WhitelistHelper.java
index d7753db..9d653ba 100644
--- a/core/java/com/android/internal/infra/WhitelistHelper.java
+++ b/core/java/com/android/internal/infra/WhitelistHelper.java
@@ -98,9 +98,9 @@
@Nullable List<ComponentName> components) {
final ArraySet<String> packageNamesSet = packageNames == null ? null
: new ArraySet<>(packageNames);
- final ArraySet<ComponentName> componentssSet = components == null ? null
+ final ArraySet<ComponentName> componentsSet = components == null ? null
: new ArraySet<>(components);
- setWhitelist(packageNamesSet, componentssSet);
+ setWhitelist(packageNamesSet, componentsSet);
}
/**
@@ -170,7 +170,7 @@
pw.print("["); pw.print(components.valueAt(0));
for (int j = 1; j < components.size(); j++) {
- pw.print(", "); pw.print(components.valueAt(i));
+ pw.print(", "); pw.print(components.valueAt(j));
}
pw.println("]");
}
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 1fc7635..72f6c12 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -609,9 +609,7 @@
int UPDATE_RADIO = 0x04;
int UPDATE_BT = 0x08;
int UPDATE_RPM = 0x10; // 16
- int UPDATE_RAIL = 0x20; // 32
- int UPDATE_ALL = UPDATE_CPU | UPDATE_WIFI | UPDATE_RADIO | UPDATE_BT | UPDATE_RPM
- | UPDATE_RAIL;
+ int UPDATE_ALL = UPDATE_CPU | UPDATE_WIFI | UPDATE_RADIO | UPDATE_BT | UPDATE_RPM;
Future<?> scheduleSync(String reason, int flags);
Future<?> scheduleCpuSyncDueToRemovedUid(int uid);
diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp
index 61d5031..b499981 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -256,6 +256,10 @@
ssize_t offset;
size_t size;
sp<IMemoryHeap> heap = dataPtr->getMemory(&offset, &size);
+ if (heap == NULL) {
+ ALOGV("copyAndPost: skipping null memory callback!");
+ return;
+ }
ALOGV("copyAndPost: off=%zd, size=%zu", offset, size);
uint8_t *heapBase = (uint8_t*)heap->base();
diff --git a/core/proto/android/app/settings_enums.proto b/core/proto/android/app/settings_enums.proto
index ace88f5..1ff7418 100644
--- a/core/proto/android/app/settings_enums.proto
+++ b/core/proto/android/app/settings_enums.proto
@@ -665,6 +665,15 @@
//ACTION: Log result for each card's eligibility check
ACTION_CONTEXTUAL_CARD_ELIGIBILITY = 1686;
+
+ // ACTION: Share a Wi-Fi network by generating a QR code
+ ACTION_SETTINGS_SHARE_WIFI_QR_CODE = 1710;
+
+ // ACTION: Connect to a Wi-Fi network by scanning a QR code
+ ACTION_SETTINGS_ENROLL_WIFI_QR_CODE = 1711;
+
+ // ACTION: Share Wi-Fi hotspot by generating a QR code
+ ACTION_SETTINGS_SHARE_WIFI_HOTSPOT_QR_CODE = 1712;
}
/**
@@ -2336,4 +2345,13 @@
// CATEGORY: SETTINGS
// OS: Q
ACTION_DISPLAY_WHITE_BALANCE_SETTING_CHANGED = 1703;
+
+ // OPEN: Settings > Pick SIM dialog
+ DIALOG_SIM_LIST = 1707;
+
+ // OPEN: Settings > Pick SIM (that supports calling) dialog
+ DIALOG_CALL_SIM_LIST = 1708;
+
+ // OPEN: Settings > Pick preferred SIM dialog
+ DIALOG_PREFERRED_SIM_PICKER = 1709;
}
diff --git a/core/res/res/drawable/ic_content_copy_gm2.xml b/core/res/res/drawable/ic_content_copy_gm2.xml
index 940da94..ee58738 100644
--- a/core/res/res/drawable/ic_content_copy_gm2.xml
+++ b/core/res/res/drawable/ic_content_copy_gm2.xml
@@ -20,6 +20,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
- android:fillColor="#F999"
+ android:fillColor="?android:attr/textColorSecondary"
android:pathData="M18,21L4,21L4,7L2,7v14c0,1.1 0.9,2 2,2h14v-2zM21,17L21,3c0,-1.1 -0.9,-2 -2,-2L8,1c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h11c1.1,0 2,-0.9 2,-2zM19,17L8,17L8,3h11v14z"/>
</vector>
diff --git a/core/res/res/layout/chooser_grid.xml b/core/res/res/layout/chooser_grid.xml
index 138e24e3..4d5e262 100644
--- a/core/res/res/layout/chooser_grid.xml
+++ b/core/res/res/layout/chooser_grid.xml
@@ -28,6 +28,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alwaysShow="true"
+ android:elevation="1dp"
android:background="@drawable/bottomsheet_background">
<ImageView
@@ -66,6 +67,7 @@
android:listSelector="@color/transparent"
android:divider="@null"
android:scrollIndicators="top"
+ android:elevation="1dp"
android:nestedScrollingEnabled="true"/>
<TextView android:id="@+id/empty"
@@ -76,6 +78,7 @@
android:text="@string/noApplications"
android:padding="@dimen/chooser_edge_margin_normal"
android:gravity="center"
+ android:elevation="1dp"
android:visibility="gone"/>
</com.android.internal.widget.ResolverDrawerLayout>
diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml
index 03fb1fc..0ed9860 100644
--- a/core/res/res/values/themes_device_defaults.xml
+++ b/core/res/res/values/themes_device_defaults.xml
@@ -802,6 +802,8 @@
<item name="textAppearanceListItemSmall">@style/TextAppearance.DeviceDefault.ListItem</item>
<item name="textAppearanceListItemSecondary">@style/TextAppearance.DeviceDefault.ListItemSecondary</item>
+ <item name="backgroundDimAmount">0.7</item>
+
<!-- Button styles -->
<item name="buttonCornerRadius">@dimen/config_buttonCornerRadius</item>
<item name="buttonStyle">@style/Widget.DeviceDefault.Light.Button</item>
diff --git a/core/tests/coretests/src/android/content/ContentCaptureOptionsTest.java b/core/tests/coretests/src/android/content/ContentCaptureOptionsTest.java
new file mode 100644
index 0000000..c6f4fa2
--- /dev/null
+++ b/core/tests/coretests/src/android/content/ContentCaptureOptionsTest.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.content;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.util.ArraySet;
+import android.view.contentcapture.ContentCaptureManager.ContentCaptureClient;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+/**
+ * Unit test for {@link ContentCaptureOptions}.
+ *
+ * <p>To run it:
+ * {@code atest FrameworksCoreTests:android.content.ContentCaptureOptionsTest}
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ContentCaptureOptionsTest {
+
+ private final ComponentName mContextComponent = new ComponentName("marco", "polo");
+ private final ComponentName mComp1 = new ComponentName("comp", "one");
+ private final ComponentName mComp2 = new ComponentName("two", "comp");
+
+ @Mock private Context mContext;
+ @Mock private ContentCaptureClient mClient;
+
+ @Before
+ public void setExpectation() {
+ when(mClient.contentCaptureClientGetComponentName()).thenReturn(mContextComponent);
+ when(mContext.getContentCaptureClient()).thenReturn(mClient);
+ }
+
+ @Test
+ public void testIsWhitelisted_nullWhitelistedComponents() {
+ ContentCaptureOptions options = new ContentCaptureOptions(null);
+ assertThat(options.isWhitelisted(mContext)).isTrue();
+ }
+
+ @Test
+ public void testIsWhitelisted_emptyWhitelistedComponents() {
+ ContentCaptureOptions options = new ContentCaptureOptions(toSet((ComponentName) null));
+ assertThat(options.isWhitelisted(mContext)).isFalse();
+ }
+
+ @Test
+ public void testIsWhitelisted_notWhitelisted() {
+ ContentCaptureOptions options = new ContentCaptureOptions(toSet(mComp1, mComp2));
+ assertThat(options.isWhitelisted(mContext)).isFalse();
+ }
+
+ @Test
+ public void testIsWhitelisted_whitelisted() {
+ ContentCaptureOptions options = new ContentCaptureOptions(toSet(mComp1, mContextComponent));
+ assertThat(options.isWhitelisted(mContext)).isTrue();
+ }
+
+ @Test
+ public void testIsWhitelisted_invalidContext() {
+ ContentCaptureOptions options = new ContentCaptureOptions(toSet(mContextComponent));
+ Context invalidContext = mock(Context.class); // has no client
+ assertThat(options.isWhitelisted(invalidContext)).isFalse();
+ }
+
+ @Test
+ public void testIsWhitelisted_clientWithNullComponentName() {
+ ContentCaptureOptions options = new ContentCaptureOptions(toSet(mContextComponent));
+ ContentCaptureClient client = mock(ContentCaptureClient.class);
+ Context context = mock(Context.class);
+ when(context.getContentCaptureClient()).thenReturn(client);
+
+ assertThat(options.isWhitelisted(context)).isFalse();
+ }
+
+ @NonNull
+ private ArraySet<ComponentName> toSet(@Nullable ComponentName... comps) {
+ ArraySet<ComponentName> set = new ArraySet<>();
+ if (comps != null) {
+ for (int i = 0; i < comps.length; i++) {
+ set.add(comps[i]);
+ }
+ }
+ return set;
+ }
+}
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index a853121..f4d3c81 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -392,6 +392,7 @@
Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS,
Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT,
Settings.Global.POLICY_CONTROL,
+ Settings.Global.POWER_BUTTON_SUPPRESSION_DELAY_AFTER_GESTURE_WAKE,
Settings.Global.POWER_MANAGER_CONSTANTS,
Settings.Global.PREFERRED_NETWORK_MODE,
Settings.Global.PRIVATE_DNS_DEFAULT_MODE,
diff --git a/libs/hwui/DeviceInfo.cpp b/libs/hwui/DeviceInfo.cpp
index cf5d7ce..0a9d965 100644
--- a/libs/hwui/DeviceInfo.cpp
+++ b/libs/hwui/DeviceInfo.cpp
@@ -45,12 +45,12 @@
1920, // viewportH
};
-const DeviceInfo* DeviceInfo::get() {
+DeviceInfo* DeviceInfo::get() {
static DeviceInfo sDeviceInfo;
return &sDeviceInfo;
}
-DisplayInfo QueryDisplayInfo() {
+static DisplayInfo QueryDisplayInfo() {
if (Properties::isolatedProcess) {
return sDummyDisplay;
}
@@ -65,6 +65,27 @@
return displayInfo;
}
+static float QueryMaxRefreshRate() {
+ if (Properties::isolatedProcess) {
+ return sDummyDisplay.fps;
+ }
+
+ const sp<IBinder> token = SurfaceComposerClient::getInternalDisplayToken();
+ LOG_ALWAYS_FATAL_IF(token == nullptr,
+ "Failed to get display info because internal display is disconnected");
+
+ Vector<DisplayInfo> configs;
+ configs.reserve(10);
+ status_t status = SurfaceComposerClient::getDisplayConfigs(token, &configs);
+ LOG_ALWAYS_FATAL_IF(status, "Failed to getDisplayConfigs, error %d", status);
+ LOG_ALWAYS_FATAL_IF(configs.size() == 0, "getDisplayConfigs returned 0 configs?");
+ float max = 0.0f;
+ for (auto& info : configs) {
+ max = std::max(max, info.fps);
+ }
+ return max;
+}
+
static void queryWideColorGamutPreference(sk_sp<SkColorSpace>* colorSpace, SkColorType* colorType) {
if (Properties::isolatedProcess) {
*colorSpace = SkColorSpace::MakeSRGB();
@@ -103,7 +124,7 @@
}
}
-DeviceInfo::DeviceInfo() {
+DeviceInfo::DeviceInfo() : mMaxRefreshRate(QueryMaxRefreshRate()) {
#if HWUI_NULL_GPU
mMaxTextureSize = NULL_GPU_MAX_TEXTURE_SIZE;
#else
@@ -119,7 +140,11 @@
}
void DeviceInfo::setMaxTextureSize(int maxTextureSize) {
- const_cast<DeviceInfo*>(DeviceInfo::get())->mMaxTextureSize = maxTextureSize;
+ DeviceInfo::get()->mMaxTextureSize = maxTextureSize;
+}
+
+void DeviceInfo::onDisplayConfigChanged() {
+ mDisplayInfo = QueryDisplayInfo();
}
} /* namespace uirenderer */
diff --git a/libs/hwui/DeviceInfo.h b/libs/hwui/DeviceInfo.h
index 2bab5d3..0e3f119 100644
--- a/libs/hwui/DeviceInfo.h
+++ b/libs/hwui/DeviceInfo.h
@@ -32,7 +32,7 @@
PREVENT_COPY_AND_ASSIGN(DeviceInfo);
public:
- static const DeviceInfo* get();
+ static DeviceInfo* get();
// this value is only valid after the GPU has been initialized and there is a valid graphics
// context or if you are using the HWUI_NULL_GPU
@@ -40,6 +40,9 @@
const DisplayInfo& displayInfo() const { return mDisplayInfo; }
sk_sp<SkColorSpace> getWideColorSpace() const { return mWideColorSpace; }
SkColorType getWideColorType() const { return mWideColorType; }
+ float getMaxRefreshRate() const { return mMaxRefreshRate; }
+
+ void onDisplayConfigChanged();
private:
friend class renderthread::RenderThread;
@@ -51,6 +54,7 @@
DisplayInfo mDisplayInfo;
sk_sp<SkColorSpace> mWideColorSpace;
SkColorType mWideColorType;
+ const float mMaxRefreshRate;
};
} /* namespace uirenderer */
diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp
index 9998854..19f509c 100644
--- a/libs/hwui/Properties.cpp
+++ b/libs/hwui/Properties.cpp
@@ -67,7 +67,7 @@
bool Properties::isolatedProcess = false;
int Properties::contextPriority = 0;
-uint32_t Properties::defaultRenderAhead = 0;
+int Properties::defaultRenderAhead = -1;
static int property_get_int(const char* key, int defaultValue) {
char buf[PROPERTY_VALUE_MAX] = {
@@ -130,9 +130,8 @@
enableForceDarkSupport = property_get_bool(PROPERTY_ENABLE_FORCE_DARK, true);
- defaultRenderAhead =
- std::max(0u, std::min(2u, static_cast<uint32_t>(property_get_int(
- PROPERTY_RENDERAHEAD, render_ahead().value_or(0)))));
+ defaultRenderAhead = std::max(-1, std::min(2, property_get_int(PROPERTY_RENDERAHEAD,
+ render_ahead().value_or(0))));
return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw);
}
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index 3105e58..3e91c63 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -253,7 +253,7 @@
ANDROID_API static int contextPriority;
- static uint32_t defaultRenderAhead;
+ static int defaultRenderAhead;
private:
static ProfileType sProfileType;
diff --git a/libs/hwui/renderthread/CacheManager.cpp b/libs/hwui/renderthread/CacheManager.cpp
index 7cb241d..1b638c1 100644
--- a/libs/hwui/renderthread/CacheManager.cpp
+++ b/libs/hwui/renderthread/CacheManager.cpp
@@ -126,6 +126,10 @@
SkGraphics::SetFontCacheLimit(mMaxCpuFontCacheBytes);
break;
}
+
+ // We must sync the cpu to make sure deletions of resources still queued up on the GPU actually
+ // happen.
+ mGrContext->flush(kSyncCpu_GrFlushFlag, 0, nullptr);
}
void CacheManager::trimStaleResources() {
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 2957b14..f326ce8 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -105,13 +105,13 @@
, mGenerationID(0)
, mOpaque(!translucent)
, mAnimationContext(contextFactory->createAnimationContext(mRenderThread.timeLord()))
- , mJankTracker(&thread.globalProfileData(), thread.mainDisplayInfo())
+ , mJankTracker(&thread.globalProfileData(), DeviceInfo::get()->displayInfo())
, mProfiler(mJankTracker.frames(), thread.timeLord().frameIntervalNanos())
, mContentDrawBounds(0, 0, 0, 0)
, mRenderPipeline(std::move(renderPipeline)) {
rootRenderNode->makeRoot();
mRenderNodes.emplace_back(rootRenderNode);
- mProfiler.setDensity(mRenderThread.mainDisplayInfo().density);
+ mProfiler.setDensity(DeviceInfo::get()->displayInfo().density);
setRenderAheadDepth(Properties::defaultRenderAhead);
}
@@ -153,16 +153,23 @@
mNativeSurface = nullptr;
}
+ if (mRenderAheadDepth == 0 && DeviceInfo::get()->getMaxRefreshRate() > 66.6f) {
+ mFixedRenderAhead = false;
+ mRenderAheadCapacity = 1;
+ } else {
+ mFixedRenderAhead = true;
+ mRenderAheadCapacity = mRenderAheadDepth;
+ }
+
ColorMode colorMode = mWideColorGamut ? ColorMode::WideColorGamut : ColorMode::SRGB;
bool hasSurface = mRenderPipeline->setSurface(mNativeSurface.get(), mSwapBehavior, colorMode,
- mRenderAheadDepth);
+ mRenderAheadCapacity);
mFrameNumber = -1;
if (hasSurface) {
mHaveNewSurface = true;
mSwapHistory.clear();
- applyRenderAheadSettings();
} else {
mRenderThread.removeFrameCallback(this);
mGenerationID++;
@@ -403,6 +410,23 @@
mRenderThread.pushBackFrameCallback(this);
}
+void CanvasContext::setPresentTime() {
+ int64_t presentTime = NATIVE_WINDOW_TIMESTAMP_AUTO;
+ int renderAhead = 0;
+ const auto frameIntervalNanos = mRenderThread.timeLord().frameIntervalNanos();
+ if (mFixedRenderAhead) {
+ renderAhead = std::min(mRenderAheadDepth, mRenderAheadCapacity);
+ } else if (frameIntervalNanos < 15_ms) {
+ renderAhead = std::min(1, static_cast<int>(mRenderAheadCapacity));
+ }
+
+ if (renderAhead) {
+ presentTime = mCurrentFrameInfo->get(FrameInfoIndex::Vsync) +
+ (frameIntervalNanos * (renderAhead + 1));
+ }
+ native_window_set_buffers_timestamp(mNativeSurface.get(), presentTime);
+}
+
void CanvasContext::draw() {
SkRect dirty;
mDamageAccumulator.finish(&dirty);
@@ -415,14 +439,9 @@
mCurrentFrameInfo->markIssueDrawCommandsStart();
Frame frame = mRenderPipeline->getFrame();
+ setPresentTime();
SkRect windowDirty = computeDirtyRect(frame, &dirty);
- if (mRenderAheadDepth) {
- auto presentTime =
- mCurrentFrameInfo->get(FrameInfoIndex::Vsync) +
- (mRenderThread.timeLord().frameIntervalNanos() * (mRenderAheadDepth + 1));
- native_window_set_buffers_timestamp(mNativeSurface.get(), presentTime);
- }
bool drew = mRenderPipeline->draw(frame, windowDirty, dirty, mLightGeometry, &mLayerUpdateQueue,
mContentDrawBounds, mOpaque, mLightInfo, mRenderNodes,
@@ -656,18 +675,12 @@
return width == mLastFrameWidth && height == mLastFrameHeight;
}
-void CanvasContext::applyRenderAheadSettings() {
- if (mNativeSurface && !mRenderAheadDepth) {
- native_window_set_buffers_timestamp(mNativeSurface.get(), NATIVE_WINDOW_TIMESTAMP_AUTO);
- }
-}
-
-void CanvasContext::setRenderAheadDepth(uint32_t renderAhead) {
- if (renderAhead > 2 || renderAhead == mRenderAheadDepth || mNativeSurface) {
+void CanvasContext::setRenderAheadDepth(int renderAhead) {
+ if (renderAhead > 2 || renderAhead < 0 || mNativeSurface) {
return;
}
- mRenderAheadDepth = renderAhead;
- applyRenderAheadSettings();
+ mFixedRenderAhead = true;
+ mRenderAheadDepth = static_cast<uint32_t>(renderAhead);
}
SkRect CanvasContext::computeDirtyRect(const Frame& frame, SkRect* dirty) {
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index 912b125..f9de002 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -204,7 +204,7 @@
}
// Must be called before setSurface
- void setRenderAheadDepth(uint32_t renderAhead);
+ void setRenderAheadDepth(int renderAhead);
SkISize getNextFrameSize() const;
@@ -221,7 +221,7 @@
bool isSwapChainStuffed();
bool surfaceRequiresRedraw();
- void applyRenderAheadSettings();
+ void setPresentTime();
SkRect computeDirtyRect(const Frame& frame, SkRect* dirty);
@@ -240,7 +240,9 @@
// painted onto its surface.
bool mIsDirty = false;
SwapBehavior mSwapBehavior = SwapBehavior::kSwap_default;
+ bool mFixedRenderAhead = false;
uint32_t mRenderAheadDepth = 0;
+ uint32_t mRenderAheadCapacity = 0;
struct SwapHistory {
SkRect damage;
nsecs_t vsyncTime;
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index eca7d88..41cb8fd 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -60,8 +60,10 @@
class DisplayEventReceiverWrapper : public VsyncSource {
public:
- DisplayEventReceiverWrapper(std::unique_ptr<DisplayEventReceiver>&& receiver)
- : mDisplayEventReceiver(std::move(receiver)) {}
+ DisplayEventReceiverWrapper(std::unique_ptr<DisplayEventReceiver>&& receiver,
+ const std::function<void()>& onDisplayConfigChanged)
+ : mDisplayEventReceiver(std::move(receiver))
+ , mOnDisplayConfigChanged(onDisplayConfigChanged) {}
virtual void requestNextVsync() override {
status_t status = mDisplayEventReceiver->requestNextVsync();
@@ -79,6 +81,9 @@
case DisplayEventReceiver::DISPLAY_EVENT_VSYNC:
latest = ev.header.timestamp;
break;
+ case DisplayEventReceiver::DISPLAY_EVENT_CONFIG_CHANGED:
+ mOnDisplayConfigChanged();
+ break;
}
}
}
@@ -90,6 +95,7 @@
private:
std::unique_ptr<DisplayEventReceiver> mDisplayEventReceiver;
+ std::function<void()> mOnDisplayConfigChanged;
};
class DummyVsyncSource : public VsyncSource {
@@ -160,22 +166,29 @@
// Register the FD
mLooper->addFd(receiver->getFd(), 0, Looper::EVENT_INPUT,
RenderThread::displayEventReceiverCallback, this);
- mVsyncSource = new DisplayEventReceiverWrapper(std::move(receiver));
+ mVsyncSource = new DisplayEventReceiverWrapper(std::move(receiver), [this] {
+ DeviceInfo::get()->onDisplayConfigChanged();
+ setupFrameInterval();
+ });
} else {
mVsyncSource = new DummyVsyncSource(this);
}
}
void RenderThread::initThreadLocals() {
- mDisplayInfo = DeviceInfo::get()->displayInfo();
- nsecs_t frameIntervalNanos = static_cast<nsecs_t>(1000000000 / mDisplayInfo.fps);
- mTimeLord.setFrameInterval(frameIntervalNanos);
- mDispatchFrameDelay = static_cast<nsecs_t>(frameIntervalNanos * .25f);
+ setupFrameInterval();
initializeDisplayEventReceiver();
mEglManager = new EglManager();
mRenderState = new RenderState(*this);
mVkManager = new VulkanManager();
- mCacheManager = new CacheManager(mDisplayInfo);
+ mCacheManager = new CacheManager(DeviceInfo::get()->displayInfo());
+}
+
+void RenderThread::setupFrameInterval() {
+ auto& displayInfo = DeviceInfo::get()->displayInfo();
+ nsecs_t frameIntervalNanos = static_cast<nsecs_t>(1000000000 / displayInfo.fps);
+ mTimeLord.setFrameInterval(frameIntervalNanos);
+ mDispatchFrameDelay = static_cast<nsecs_t>(frameIntervalNanos * .25f);
}
void RenderThread::requireGlContext() {
diff --git a/libs/hwui/renderthread/RenderThread.h b/libs/hwui/renderthread/RenderThread.h
index 6bb26fd..c96e284 100644
--- a/libs/hwui/renderthread/RenderThread.h
+++ b/libs/hwui/renderthread/RenderThread.h
@@ -102,8 +102,6 @@
ProfileDataContainer& globalProfileData() { return mGlobalProfileData; }
Readback& readback();
- const DisplayInfo& mainDisplayInfo() { return mDisplayInfo; }
-
GrContext* getGrContext() const { return mGrContext.get(); }
void setGrContext(sk_sp<GrContext> cxt);
@@ -149,13 +147,12 @@
void initThreadLocals();
void initializeDisplayEventReceiver();
+ void setupFrameInterval();
static int displayEventReceiverCallback(int fd, int events, void* data);
void drainDisplayEventQueue();
void dispatchFrameCallbacks();
void requestVsync();
- DisplayInfo mDisplayInfo;
-
VsyncSource* mVsyncSource;
bool mVsyncRequested;
std::set<IFrameCallback*> mFrameCallbacks;
diff --git a/libs/hwui/tests/unit/CacheManagerTests.cpp b/libs/hwui/tests/unit/CacheManagerTests.cpp
index 210fced..3f1ef93 100644
--- a/libs/hwui/tests/unit/CacheManagerTests.cpp
+++ b/libs/hwui/tests/unit/CacheManagerTests.cpp
@@ -33,7 +33,7 @@
}
RENDERTHREAD_SKIA_PIPELINE_TEST(CacheManager, trimMemory) {
- DisplayInfo displayInfo = renderThread.mainDisplayInfo();
+ DisplayInfo displayInfo = DeviceInfo::get()->displayInfo();
GrContext* grContext = renderThread.getGrContext();
ASSERT_TRUE(grContext != nullptr);
diff --git a/location/java/android/location/GnssCapabilities.java b/location/java/android/location/GnssCapabilities.java
index badffd1..36fe8da 100644
--- a/location/java/android/location/GnssCapabilities.java
+++ b/location/java/android/location/GnssCapabilities.java
@@ -16,12 +16,8 @@
package android.location;
-import android.annotation.IntDef;
import android.annotation.SystemApi;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
/**
* A container of supported GNSS chipset capabilities.
*
@@ -29,53 +25,61 @@
*/
@SystemApi
public final class GnssCapabilities {
- /** The GNSS chipset supports low power mode. */
- public static final int LOW_POWER_MODE = 0;
-
- /** The GNSS chipset supports blacklisting satellites. */
- public static final int SATELLITE_BLACKLIST = 1;
-
- /** The GNSS chipset supports geofencing. */
- public static final int GEOFENCING = 2;
-
- /** The GNSS chipset supports measurements.*/
- public static final int MEASUREMENTS = 3;
-
- /** The GNSS chipset supports navigation messages. */
- public static final int NAV_MESSAGES = 4;
-
- /** The GNSS chipset supports measurement corrections. */
- public static final int MEASUREMENT_CORRECTIONS = 5;
-
- /** The GNSS chipset supports line-of-sight satellite identification measurement corrections. */
- public static final int MEASUREMENT_CORRECTIONS_LOS_SATS = 6;
-
- /** The GNSS chipset supports per satellite excess-path-length measurement corrections. */
- public static final int MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH = 7;
-
- /** The GNSS chipset supports reflecting planes measurement corrections. */
- public static final int MEASUREMENT_CORRECTIONS_REFLECTING_PLANE = 8;
-
- private static final int MIN_CAPABILITY = 0;
- private static final int MAX_CAPABILITY = MEASUREMENT_CORRECTIONS_REFLECTING_PLANE;
-
/**
- * GNSS capability.
+ * Bit mask indicating GNSS chipset supports low power mode.
* @hide
*/
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({
- LOW_POWER_MODE,
- SATELLITE_BLACKLIST,
- GEOFENCING,
- MEASUREMENTS,
- NAV_MESSAGES,
- MEASUREMENT_CORRECTIONS,
- MEASUREMENT_CORRECTIONS_LOS_SATS,
- MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH,
- MEASUREMENT_CORRECTIONS_REFLECTING_PLANE
- })
- public @interface Capability {}
+ public static final long LOW_POWER_MODE = 1L << 0;
+
+ /**
+ * Bit mask indicating GNSS chipset supports blacklisting satellites.
+ * @hide
+ */
+ public static final long SATELLITE_BLACKLIST = 1L << 1;
+
+ /**
+ * Bit mask indicating GNSS chipset supports geofencing.
+ * @hide
+ */
+ public static final long GEOFENCING = 1L << 2;
+
+ /**
+ * Bit mask indicating GNSS chipset supports measurements.
+ * @hide
+ */
+ public static final long MEASUREMENTS = 1L << 3;
+
+ /**
+ * Bit mask indicating GNSS chipset supports navigation messages.
+ * @hide
+ */
+ public static final long NAV_MESSAGES = 1L << 4;
+
+ /**
+ * Bit mask indicating GNSS chipset supports measurement corrections.
+ * @hide
+ */
+ public static final long MEASUREMENT_CORRECTIONS = 1L << 5;
+
+ /**
+ * Bit mask indicating GNSS chipset supports line-of-sight satellite identification
+ * measurement corrections.
+ * @hide
+ */
+ public static final long MEASUREMENT_CORRECTIONS_LOS_SATS = 1L << 6;
+
+ /**
+ * Bit mask indicating GNSS chipset supports per satellite excess-path-length
+ * measurement corrections.
+ * @hide
+ */
+ public static final long MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH = 1L << 7;
+
+ /**
+ * Bit mask indicating GNSS chipset supports reflecting planes measurement corrections.
+ * @hide
+ */
+ public static final long MEASUREMENT_CORRECTIONS_REFLECTING_PLANE = 1L << 8;
/** @hide */
public static final long INVALID_CAPABILITIES = -1;
@@ -93,60 +97,94 @@
}
/**
- * Returns {@code true} if the {@code capability} is supported by the GNSS implementation.
+ * Returns {@code true} if GNSS chipset supports low power mode, {@code false} otherwise.
*/
- public boolean hasCapability(@Capability int capability) {
- return isValidCapability(capability) && (mGnssCapabilities & (1 << capability)) != 0;
+ public boolean hasLowPowerMode() {
+ return hasCapability(LOW_POWER_MODE);
+ }
+
+ /**
+ * Returns {@code true} if GNSS chipset supports blacklisting satellites, {@code false}
+ * otherwise.
+ */
+ public boolean hasSatelliteBlacklist() {
+ return hasCapability(SATELLITE_BLACKLIST);
+ }
+
+ /**
+ * Returns {@code true} if GNSS chipset supports geofencing, {@code false} otherwise.
+ */
+ public boolean hasGeofencing() {
+ return hasCapability(GEOFENCING);
+ }
+
+ /**
+ * Returns {@code true} if GNSS chipset supports measurements, {@code false} otherwise.
+ */
+ public boolean hasMeasurements() {
+ return hasCapability(MEASUREMENTS);
+ }
+
+ /**
+ * Returns {@code true} if GNSS chipset supports navigation messages, {@code false} otherwise.
+ */
+ public boolean hasNavMessages() {
+ return hasCapability(NAV_MESSAGES);
+ }
+
+ /**
+ * Returns {@code true} if GNSS chipset supports measurement corrections, {@code false}
+ * otherwise.
+ */
+ public boolean hasMeasurementCorrections() {
+ return hasCapability(MEASUREMENT_CORRECTIONS);
+ }
+
+ /**
+ * Returns {@code true} if GNSS chipset supports line-of-sight satellite identification
+ * measurement corrections, {@code false} otherwise.
+ */
+ public boolean hasMeasurementCorrectionsLosSats() {
+ return hasCapability(MEASUREMENT_CORRECTIONS_LOS_SATS);
+ }
+
+ /**
+ * Returns {@code true} if GNSS chipset supports per satellite excess-path-length measurement
+ * corrections, {@code false} otherwise.
+ */
+ public boolean hasMeasurementCorrectionsExcessPathLength() {
+ return hasCapability(MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH);
+ }
+
+ /**
+ * Returns {@code true} if GNSS chipset supports reflecting planes measurement corrections,
+ * {@code false} otherwise.
+ */
+ public boolean hasMeasurementCorrectionsReflectingPane() {
+ return hasCapability(MEASUREMENT_CORRECTIONS_REFLECTING_PLANE);
}
@Override
public String toString() {
- StringBuilder sb = new StringBuilder("GnssCapabilities: (");
- int capability = 0;
- boolean addSeparator = false;
- long gnssCapabilities = mGnssCapabilities;
- while (gnssCapabilities != 0) {
- if ((gnssCapabilities & 1) != 0) {
- if (addSeparator) {
- sb.append(' ');
- } else {
- addSeparator = true;
- }
- sb.append(toStringCapability(capability));
- }
- gnssCapabilities >>= 1;
- ++capability;
+ StringBuilder sb = new StringBuilder("GnssCapabilities: ( ");
+ if (hasLowPowerMode()) sb.append("LOW_POWER_MODE ");
+ if (hasSatelliteBlacklist()) sb.append("SATELLITE_BLACKLIST ");
+ if (hasGeofencing()) sb.append("GEOFENCING ");
+ if (hasMeasurements()) sb.append("MEASUREMENTS ");
+ if (hasNavMessages()) sb.append("NAV_MESSAGES ");
+ if (hasMeasurementCorrections()) sb.append("MEASUREMENT_CORRECTIONS ");
+ if (hasMeasurementCorrectionsLosSats()) sb.append("MEASUREMENT_CORRECTIONS_LOS_SATS ");
+ if (hasMeasurementCorrectionsExcessPathLength()) {
+ sb.append("MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH ");
+ }
+ if (hasMeasurementCorrectionsReflectingPane()) {
+ sb.append("MEASUREMENT_CORRECTIONS_REFLECTING_PLANE ");
}
sb.append(")");
return sb.toString();
}
- private boolean isValidCapability(@Capability int capability) {
- return capability >= MIN_CAPABILITY && capability <= MAX_CAPABILITY;
- }
-
- private static String toStringCapability(@Capability int capability) {
- switch (capability) {
- case LOW_POWER_MODE:
- return "LOW_POWER_MODE";
- case SATELLITE_BLACKLIST:
- return "SATELLITE_BLACKLIST";
- case GEOFENCING:
- return "GEOFENCING";
- case MEASUREMENTS:
- return "MEASUREMENTS";
- case NAV_MESSAGES:
- return "NAV_MESSAGES";
- case MEASUREMENT_CORRECTIONS:
- return "MEASUREMENT_CORRECTIONS";
- case MEASUREMENT_CORRECTIONS_LOS_SATS:
- return "MEASUREMENT_CORRECTIONS_LOS_SATS";
- case MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH:
- return "MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH";
- case MEASUREMENT_CORRECTIONS_REFLECTING_PLANE:
- return "MEASUREMENT_CORRECTIONS_REFLECTING_PLANE";
- default:
- return "Unknown(" + capability + ")";
- }
+ private boolean hasCapability(long capability) {
+ return (mGnssCapabilities & capability) == capability;
}
}
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index af60e3c..7a17505 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -1986,17 +1986,19 @@
}
/**
- * Returns the supported capabilities of the GNSS chipset or {@code null} if there is an error
- * in obtaining the capabilities.
+ * Returns the supported capabilities of the GNSS chipset.
+ *
+ * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present.
*
* @hide
*/
@SystemApi
- public @Nullable GnssCapabilities getGnssCapabilities() {
+ @RequiresPermission(ACCESS_FINE_LOCATION)
+ public @NonNull GnssCapabilities getGnssCapabilities() {
try {
long gnssCapabilities = mGnssMeasurementCallbackTransport.getGnssCapabilities();
if (gnssCapabilities == GnssCapabilities.INVALID_CAPABILITIES) {
- return null;
+ gnssCapabilities = 0L;
}
return GnssCapabilities.of(gnssCapabilities);
} catch (RemoteException e) {
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
index a7f8933..ae99126 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
@@ -472,7 +472,10 @@
}
boolean isTracking = mIsTracking;
Rect rect = mNotificationList.getClipBounds();
- float clippedHeight = rect.bottom;
+ float clippedHeight = 0;
+ if (rect != null) {
+ clippedHeight = rect.bottom;
+ }
if (!handled && event.getActionMasked() == MotionEvent.ACTION_UP
&& mIsSwipingVerticallyToClose) {
if (mSettleClosePercentage < mPercentageFromBottom && isTracking) {
diff --git a/packages/NetworkStack/res/values/config.xml b/packages/NetworkStack/res/values/config.xml
index 90f96e0..704788d 100644
--- a/packages/NetworkStack/res/values/config.xml
+++ b/packages/NetworkStack/res/values/config.xml
@@ -35,4 +35,8 @@
</string-array>
<string-array name="config_captive_portal_fallback_probe_specs" translatable="false">
</string-array>
-</resources>
\ No newline at end of file
+
+ <!-- Customized default DNS Servers address. -->
+ <string-array name="config_default_dns_servers" translatable="false">
+ </string-array>
+</resources>
diff --git a/packages/NetworkStack/src/android/net/dhcp/DhcpClient.java b/packages/NetworkStack/src/android/net/dhcp/DhcpClient.java
index af0e3bb..ca6c17a 100644
--- a/packages/NetworkStack/src/android/net/dhcp/DhcpClient.java
+++ b/packages/NetworkStack/src/android/net/dhcp/DhcpClient.java
@@ -45,6 +45,7 @@
import android.content.Context;
import android.net.DhcpResults;
+import android.net.InetAddresses;
import android.net.TrafficStats;
import android.net.ip.IpClient;
import android.net.metrics.DhcpClientEvent;
@@ -67,6 +68,7 @@
import com.android.internal.util.StateMachine;
import com.android.internal.util.TrafficStatsConstants;
import com.android.internal.util.WakeupMessage;
+import com.android.networkstack.R;
import java.io.FileDescriptor;
import java.io.IOException;
@@ -500,6 +502,18 @@
private void acceptDhcpResults(DhcpResults results, String msg) {
mDhcpLease = results;
+ if (mDhcpLease.dnsServers.isEmpty()) {
+ // supplement customized dns servers
+ String[] dnsServersList =
+ mContext.getResources().getStringArray(R.array.config_default_dns_servers);
+ for (final String dnsServer : dnsServersList) {
+ try {
+ mDhcpLease.dnsServers.add(InetAddresses.parseNumericAddress(dnsServer));
+ } catch (IllegalArgumentException e) {
+ Log.e(TAG, "Invalid default DNS server: " + dnsServer, e);
+ }
+ }
+ }
mOffer = null;
Log.d(TAG, msg + " lease: " + mDhcpLease);
notifySuccess();
diff --git a/packages/NetworkStack/src/android/net/dhcp/DhcpServer.java b/packages/NetworkStack/src/android/net/dhcp/DhcpServer.java
index d21b5f7..b8ab94c 100644
--- a/packages/NetworkStack/src/android/net/dhcp/DhcpServer.java
+++ b/packages/NetworkStack/src/android/net/dhcp/DhcpServer.java
@@ -647,4 +647,9 @@
}
}
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
}
diff --git a/packages/NetworkStack/src/android/net/ip/IpClient.java b/packages/NetworkStack/src/android/net/ip/IpClient.java
index 80d139c..96e09fa 100644
--- a/packages/NetworkStack/src/android/net/ip/IpClient.java
+++ b/packages/NetworkStack/src/android/net/ip/IpClient.java
@@ -557,6 +557,11 @@
checkNetworkStackCallingPermission();
IpClient.this.removeKeepalivePacketFilter(slot);
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
}
public String getInterfaceName() {
diff --git a/packages/NetworkStack/src/com/android/server/NetworkStackService.java b/packages/NetworkStack/src/com/android/server/NetworkStackService.java
index a0a90fd..a6d7484 100644
--- a/packages/NetworkStack/src/com/android/server/NetworkStackService.java
+++ b/packages/NetworkStack/src/com/android/server/NetworkStackService.java
@@ -251,6 +251,11 @@
}
}
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
}
private static class NetworkMonitorImpl extends INetworkMonitor.Stub {
@@ -325,5 +330,10 @@
checkNetworkStackCallingPermission();
mNm.notifyNetworkCapabilitiesChanged(nc);
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
}
}
diff --git a/packages/NetworkStack/src/com/android/server/connectivity/ipmemorystore/IpMemoryStoreService.java b/packages/NetworkStack/src/com/android/server/connectivity/ipmemorystore/IpMemoryStoreService.java
index bee4bbd9..6a6bf83 100644
--- a/packages/NetworkStack/src/com/android/server/connectivity/ipmemorystore/IpMemoryStoreService.java
+++ b/packages/NetworkStack/src/com/android/server/connectivity/ipmemorystore/IpMemoryStoreService.java
@@ -494,4 +494,9 @@
listener.onComplete(makeStatus(ERROR_INTERNAL_INTERRUPTED));
return true;
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
}
diff --git a/packages/NetworkStack/src/com/android/server/connectivity/ipmemorystore/RegularMaintenanceJobService.java b/packages/NetworkStack/src/com/android/server/connectivity/ipmemorystore/RegularMaintenanceJobService.java
index 2775fde..bea7052 100644
--- a/packages/NetworkStack/src/com/android/server/connectivity/ipmemorystore/RegularMaintenanceJobService.java
+++ b/packages/NetworkStack/src/com/android/server/connectivity/ipmemorystore/RegularMaintenanceJobService.java
@@ -91,6 +91,11 @@
}
@Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
+
+ @Override
public IBinder asBinder() {
return null;
}
diff --git a/packages/NetworkStack/tests/src/android/net/dhcp/DhcpServerTest.java b/packages/NetworkStack/tests/src/android/net/dhcp/DhcpServerTest.java
index 7d5e9e3..f0e2f1b 100644
--- a/packages/NetworkStack/tests/src/android/net/dhcp/DhcpServerTest.java
+++ b/packages/NetworkStack/tests/src/android/net/dhcp/DhcpServerTest.java
@@ -133,6 +133,11 @@
public void onStatusAvailable(int statusCode) {
assertEquals(STATUS_SUCCESS, statusCode);
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
};
@Before
diff --git a/packages/NetworkStack/tests/src/com/android/server/connectivity/ipmemorystore/IpMemoryStoreServiceTest.java b/packages/NetworkStack/tests/src/com/android/server/connectivity/ipmemorystore/IpMemoryStoreServiceTest.java
index a00eff7..87346e5 100644
--- a/packages/NetworkStack/tests/src/com/android/server/connectivity/ipmemorystore/IpMemoryStoreServiceTest.java
+++ b/packages/NetworkStack/tests/src/com/android/server/connectivity/ipmemorystore/IpMemoryStoreServiceTest.java
@@ -136,6 +136,11 @@
public IBinder asBinder() {
return null;
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
};
}
@@ -156,6 +161,11 @@
public IBinder asBinder() {
return null;
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
};
}
@@ -178,6 +188,11 @@
public IBinder asBinder() {
return null;
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
};
}
@@ -200,6 +215,11 @@
public IBinder asBinder() {
return null;
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
};
}
@@ -219,6 +239,11 @@
public IBinder asBinder() {
return null;
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
};
}
diff --git a/packages/SettingsLib/ProgressBar/res/anim/progress_indeterminate_horizontal_rect1_copy.xml b/packages/SettingsLib/ProgressBar/res/anim/progress_indeterminate_horizontal_rect1_copy.xml
new file mode 100644
index 0000000..28265ea
--- /dev/null
+++ b/packages/SettingsLib/ProgressBar/res/anim/progress_indeterminate_horizontal_rect1_copy.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Copy of progress_indeterminate_horizontal_rect1 in frameworks/base/core/res -->
+<set xmlns:android="http://schemas.android.com/apk/res/android" >
+ <objectAnimator
+ android:duration="2000"
+ android:propertyXName="translateX"
+ android:pathData="M -522.59998,0 c 48.89972,0 166.02656,0 301.21729,0 c 197.58128,0 420.9827,0 420.9827,0 "
+ android:interpolator="@interpolator/progress_indeterminate_horizontal_rect1_translatex_copy"
+ android:repeatCount="infinite" />
+ <objectAnimator
+ android:duration="2000"
+ android:propertyYName="scaleX"
+ android:pathData="M 0 0.1 L 1 0.826849212646 L 2 0.1"
+ android:interpolator="@interpolator/progress_indeterminate_horizontal_rect1_scalex_copy"
+ android:repeatCount="infinite" />
+</set>
diff --git a/packages/SettingsLib/ProgressBar/res/anim/progress_indeterminate_horizontal_rect2_copy.xml b/packages/SettingsLib/ProgressBar/res/anim/progress_indeterminate_horizontal_rect2_copy.xml
new file mode 100644
index 0000000..24cc452
--- /dev/null
+++ b/packages/SettingsLib/ProgressBar/res/anim/progress_indeterminate_horizontal_rect2_copy.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Copy of progress_indeterminate_horizontal_rect2 in frameworks/base/core/res -->
+<set xmlns:android="http://schemas.android.com/apk/res/android" >
+ <objectAnimator
+ android:duration="2000"
+ android:propertyXName="translateX"
+ android:pathData="M -197.60001,0 c 14.28182,0 85.07782,0 135.54689,0 c 54.26191,0 90.42461,0 168.24331,0 c 144.72154,0 316.40982,0 316.40982,0 "
+ android:interpolator="@interpolator/progress_indeterminate_horizontal_rect2_translatex_copy"
+ android:repeatCount="infinite" />
+ <objectAnimator
+ android:duration="2000"
+ android:propertyYName="scaleX"
+ android:pathData="M 0.0,0.1 L 1.0,0.571379510698 L 2.0,0.909950256348 L 3.0,0.1"
+ android:interpolator="@interpolator/progress_indeterminate_horizontal_rect2_scalex_copy"
+ android:repeatCount="infinite" />
+</set>
diff --git a/packages/SettingsLib/ProgressBar/res/drawable/progress_indeterminate_horizontal_material_trimmed.xml b/packages/SettingsLib/ProgressBar/res/drawable/progress_indeterminate_horizontal_material_trimmed.xml
index 2b7535a..4bf639d 100644
--- a/packages/SettingsLib/ProgressBar/res/drawable/progress_indeterminate_horizontal_material_trimmed.xml
+++ b/packages/SettingsLib/ProgressBar/res/drawable/progress_indeterminate_horizontal_material_trimmed.xml
@@ -14,15 +14,13 @@
limitations under the License.
-->
-<!-- Variant of progress_indeterminate_horizontal_material in frameworks/base/core/res, which
- draws the whole height of the progress bar instead having blank space above and below the
- bar. -->
+<!-- Copy of progress_indeterminate_horizontal_material_trimmed in frameworks/base/core/res -->
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/vector_drawable_progress_indeterminate_horizontal_trimmed" >
<target
android:name="rect2_grp"
- android:animation="@*android:anim/progress_indeterminate_horizontal_rect2" />
+ android:animation="@anim/progress_indeterminate_horizontal_rect2_copy" />
<target
android:name="rect1_grp"
- android:animation="@*android:anim/progress_indeterminate_horizontal_rect1" />
+ android:animation="@anim/progress_indeterminate_horizontal_rect1_copy" />
</animated-vector>
\ No newline at end of file
diff --git a/packages/SettingsLib/ProgressBar/res/interpolator/progress_indeterminate_horizontal_rect1_scalex_copy.xml b/packages/SettingsLib/ProgressBar/res/interpolator/progress_indeterminate_horizontal_rect1_scalex_copy.xml
new file mode 100644
index 0000000..d808f4f
--- /dev/null
+++ b/packages/SettingsLib/ProgressBar/res/interpolator/progress_indeterminate_horizontal_rect1_scalex_copy.xml
@@ -0,0 +1,18 @@
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Copy of progress_indeterminate_horizontal_rect1_scalex in frameworks/base/core/res -->
+<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
+ android:pathData="M 0 0 L 0.3665 0 C 0.47252618112021,0.062409910275 0.61541608570164,0.5 0.68325,0.5 C 0.75475061236836,0.5 0.75725829093844,0.814510098964 1.0,1.0" />
diff --git a/packages/SettingsLib/ProgressBar/res/interpolator/progress_indeterminate_horizontal_rect1_translatex_copy.xml b/packages/SettingsLib/ProgressBar/res/interpolator/progress_indeterminate_horizontal_rect1_translatex_copy.xml
new file mode 100644
index 0000000..e78d5e7
--- /dev/null
+++ b/packages/SettingsLib/ProgressBar/res/interpolator/progress_indeterminate_horizontal_rect1_translatex_copy.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Copy of progress_indeterminate_horizontal_rect1_translatex in frameworks/base/core/res -->
+<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
+ android:pathData="M 0.0,0.0 L 0.2 0 C 0.3958333333336,0.0 0.474845090492,0.206797621729 0.5916666666664,0.417082932942 C 0.7151610251224,0.639379624869 0.81625,0.974556908664 1.0,1.0 " />
diff --git a/packages/SettingsLib/ProgressBar/res/interpolator/progress_indeterminate_horizontal_rect2_scalex_copy.xml b/packages/SettingsLib/ProgressBar/res/interpolator/progress_indeterminate_horizontal_rect2_scalex_copy.xml
new file mode 100644
index 0000000..43c4124
--- /dev/null
+++ b/packages/SettingsLib/ProgressBar/res/interpolator/progress_indeterminate_horizontal_rect2_scalex_copy.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Copy of progress_indeterminate_horizontal_rect2_scalex in frameworks/base/core/res -->
+<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
+ android:pathData="M 0,0 C 0.06834272400867,0.01992566661414 0.19220331656133,0.15855429260523 0.33333333333333,0.34926160892842 C 0.38410433133433,0.41477913453861 0.54945792615267,0.68136029463551 0.66666666666667,0.68279962777002 C 0.752586273196,0.68179620963216 0.737253971954,0.878896194318 1,1" />
diff --git a/packages/SettingsLib/ProgressBar/res/interpolator/progress_indeterminate_horizontal_rect2_translatex_copy.xml b/packages/SettingsLib/ProgressBar/res/interpolator/progress_indeterminate_horizontal_rect2_translatex_copy.xml
new file mode 100644
index 0000000..615d6d6
--- /dev/null
+++ b/packages/SettingsLib/ProgressBar/res/interpolator/progress_indeterminate_horizontal_rect2_translatex_copy.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Copy of progress_indeterminate_horizontal_rect2_translatex in frameworks/base/core/res -->
+<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
+ android:pathData="M 0.0,0.0 C 0.0375,0.0 0.128764607715,0.0895380946618 0.25,0.218553507947 C 0.322410320025,0.295610602487 0.436666666667,0.417591408114 0.483333333333,0.489826169306 C 0.69,0.80972296795 0.793333333333,0.950016125212 1.0,1.0 " />
diff --git a/packages/SettingsLib/res/layout/preference_checkable_two_target.xml b/packages/SettingsLib/res/layout/preference_checkable_two_target.xml
index 1a47afc..f532caa 100644
--- a/packages/SettingsLib/res/layout/preference_checkable_two_target.xml
+++ b/packages/SettingsLib/res/layout/preference_checkable_two_target.xml
@@ -42,6 +42,7 @@
android:layout_height="wrap_content"
android:gravity="start|center_vertical"
android:minWidth="56dp"
+ android:minHeight="48dp"
android:orientation="horizontal"
android:clipToPadding="false"
android:paddingTop="4dp"
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index a5b7849..cd97ce8 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -4350,15 +4350,20 @@
}
if (navBarMode != -1) {
+ String overlayPackage = "";
try {
- overlayManager.setEnabled(NAV_BAR_MODE_3BUTTON_OVERLAY,
- navBarMode == NAV_BAR_MODE_3BUTTON,
- UserHandle.USER_CURRENT);
- overlayManager.setEnabled(NAV_BAR_MODE_2BUTTON_OVERLAY,
- navBarMode == NAV_BAR_MODE_2BUTTON,
- UserHandle.USER_CURRENT);
- overlayManager.setEnabled(NAV_BAR_MODE_GESTURAL_OVERLAY,
- navBarMode == NAV_BAR_MODE_GESTURAL,
+ switch (navBarMode) {
+ case NAV_BAR_MODE_3BUTTON:
+ overlayPackage = NAV_BAR_MODE_3BUTTON_OVERLAY;
+ break;
+ case NAV_BAR_MODE_2BUTTON:
+ overlayPackage = NAV_BAR_MODE_2BUTTON_OVERLAY;
+ break;
+ case NAV_BAR_MODE_GESTURAL:
+ overlayPackage = NAV_BAR_MODE_GESTURAL_OVERLAY;
+ break;
+ }
+ overlayManager.setEnabledExclusiveInCategory(overlayPackage,
UserHandle.USER_CURRENT);
} catch (RemoteException e) {
throw new IllegalStateException(
diff --git a/packages/SystemUI/docs/clock-plugins.md b/packages/SystemUI/docs/clock-plugins.md
new file mode 100644
index 0000000..5e4f6c7
--- /dev/null
+++ b/packages/SystemUI/docs/clock-plugins.md
@@ -0,0 +1,92 @@
+# Clock Plugins
+
+## Introduction
+
+The clock appearing on the lock screen and always on display (AOD) can be
+customized via the ClockPlugin plugin interface.
+
+## System Health
+
+Clocks are high risk for battery consumption and screen burn-in because they
+modify the UI of AOD.
+
+To reduce battery consumption, it is recommended to
+target a maximum on-pixel-ratio (OPR) of 5%. Clocks that are composed of
+large blocks of color that cause the OPR to exceed 5% should be avoided.
+
+To prevent screen burn-in, clocks should not be composed of large solid
+blocks of color, and the clock should be moved around the screen to
+distribute the on pixels across a large number of pixels. Software
+burn-in testing is a good starting point to assess the pixel shifting
+(clock movement) scheme and shape of the clock.
+
+### Software Burn-In Test
+
+The goal is to look for bright spots in the luminosity average over a period of
+time. It is difficult to define a threshold where burn-in will occur. It is,
+therefore, recommended to compare against an element on AOD that is known not
+to cause problems.
+
+For clock face that contain color, it is recommended to use an all white
+version of the face. Since white has the highest luminosity, this version of
+the clock face represents the worst case scenario.
+
+To start, generate a sequence of screenshots for each minute over a 12 hr interval.
+
+```
+serial = '84TY004MS' # serial number for the device
+count = 1
+t = datetime.datetime(2019, 1, 1)
+stop = t + datetime.timedelta(hours=12)
+if not os.path.exists(OUTPUT_FOLDER):
+ raise RuntimeError('output folder "%s" does not exist' % OUTPUT_FOLDER)
+while t <= stop:
+ os.system("adb -s %s shell 'date %s ; am broadcast -a android.intent.action.TIME_SET'" % (serial, t.strftime('%m%d%H%M%Y.%S')))
+ os.system('adb -s %s shell screencap -p > %s/screencap_%06d.png' % (serial, OUTPUT_FOLDER, count))
+ t += datetime.timedelta(minutes=1)
+ count += 1
+```
+
+Average the luminosity of the screenshots.
+
+```
+#!python
+import numpy
+import scipy.ndimage
+from imageio import imread, imwrite
+import matplotlib.pylab as plt
+import os
+import os.path
+
+def images(path):
+ return [os.path.join(path, name) for name in os.listdir(path) if name.endswith('.png')]
+
+def average(images):
+ AVG = None
+ for name in images:
+ IM = scipy.ndimage.imread(name, mode='L')
+ A = numpy.array(IM, dtype=numpy.double)
+ if AVG is None:
+ AVG = A
+ else:
+ AVG += A
+ AVG /= len(images)
+ return numpy.array(AVG, dtype=numpy.uint8)
+
+def main(path):
+ ims = images(path)
+ if len(ims) == 0:
+ raise ValueError("folder '%s' doesn't contain any png files" % path)
+ AVG = average(ims)
+ imwrite('average.png', AVG)
+ plt.imshow(AVG)
+ plt.show()
+
+if __name__=='__main__':
+ import sys
+ main(sys.argv[1])
+```
+
+Look for bright spots in the luminosity average. If bright spots are found,
+action should be taken to change the shape of the clock face or increase the
+amount of pixel shifting.
diff --git a/packages/SystemUI/res/layout/quick_settings_header_info.xml b/packages/SystemUI/res/layout/quick_settings_header_info.xml
index 37c6d9f..5a33f82 100644
--- a/packages/SystemUI/res/layout/quick_settings_header_info.xml
+++ b/packages/SystemUI/res/layout/quick_settings_header_info.xml
@@ -22,17 +22,6 @@
android:paddingStart="@dimen/status_bar_padding_start"
android:paddingEnd="@dimen/status_bar_padding_end">
- <TextView
- android:id="@+id/long_press_tooltip"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="start|center_vertical"
- android:alpha="0"
- android:text="@string/quick_settings_header_onboarding_text"
- android:textAppearance="@style/TextAppearance.QS.TileLabel"
- android:textColor="?android:attr/textColorSecondary"
- android:visibility="invisible" />
-
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
@@ -45,8 +34,7 @@
android:layout_height="match_parent"
android:layout_gravity="start|center_vertical"
android:layout_weight="1"
- android:gravity="center_vertical"
- android:alpha="0" >
+ android:gravity="center_vertical" >
<LinearLayout
android:id = "@+id/alarm_container"
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 0b0822c..96aa6ab 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -659,6 +659,9 @@
<!-- Accessibility text describing the presence of active location requests by one or more apps -->
<string name="accessibility_location_active">Location requests active</string>
+ <!-- Accessibility text describing sensors off active. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_sensors_off_active">Sensors off active</string>
+
<!-- Content description of the clear button in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_clear_all">Clear all notifications.</string>
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java
index 39da194..9dd5bb4 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java
@@ -19,6 +19,9 @@
import android.graphics.HardwareRenderer;
import android.graphics.Matrix;
import android.graphics.Rect;
+import android.os.Handler;
+import android.os.Handler.Callback;
+import android.os.Message;
import android.view.Surface;
import android.view.View;
import android.view.ViewRootImpl;
@@ -33,8 +36,15 @@
*/
public class SyncRtSurfaceTransactionApplierCompat {
+ private static final int MSG_UPDATE_SEQUENCE_NUMBER = 0;
+
private final Surface mTargetSurface;
private final ViewRootImpl mTargetViewRootImpl;
+ private final Handler mApplyHandler;
+
+ private int mSequenceNumber = 0;
+ private int mPendingSequenceNumber = 0;
+ private Runnable mAfterApplyCallback;
/**
* @param targetView The view in the surface that acts as synchronization anchor.
@@ -42,6 +52,26 @@
public SyncRtSurfaceTransactionApplierCompat(View targetView) {
mTargetViewRootImpl = targetView != null ? targetView.getViewRootImpl() : null;
mTargetSurface = mTargetViewRootImpl != null ? mTargetViewRootImpl.mSurface : null;
+
+ mApplyHandler = new Handler(new Callback() {
+ @Override
+ public boolean handleMessage(Message msg) {
+ if (msg.what == MSG_UPDATE_SEQUENCE_NUMBER) {
+ onApplyMessage(msg.arg1);
+ return true;
+ }
+ return false;
+ }
+ });
+ }
+
+ private void onApplyMessage(int seqNo) {
+ mSequenceNumber = seqNo;
+ if (mSequenceNumber == mPendingSequenceNumber && mAfterApplyCallback != null) {
+ Runnable r = mAfterApplyCallback;
+ mAfterApplyCallback = null;
+ r.run();
+ }
}
/**
@@ -54,10 +84,15 @@
if (mTargetViewRootImpl == null || mTargetViewRootImpl.getView() == null) {
return;
}
+
+ mPendingSequenceNumber++;
+ final int toApplySeqNo = mPendingSequenceNumber;
mTargetViewRootImpl.registerRtFrameCallback(new HardwareRenderer.FrameDrawingCallback() {
@Override
public void onFrameDraw(long frame) {
if (mTargetSurface == null || !mTargetSurface.isValid()) {
+ Message.obtain(mApplyHandler, MSG_UPDATE_SEQUENCE_NUMBER, toApplySeqNo, 0)
+ .sendToTarget();
return;
}
TransactionCompat t = new TransactionCompat();
@@ -70,6 +105,7 @@
}
t.setEarlyWakeup();
t.apply();
+ mApplyHandler.sendEmptyMessage(toApplySeqNo);
}
});
@@ -77,6 +113,28 @@
mTargetViewRootImpl.getView().invalidate();
}
+ /**
+ * Calls the runnable when any pending apply calls have completed
+ */
+ public void addAfterApplyCallback(final Runnable afterApplyCallback) {
+ if (mSequenceNumber == mPendingSequenceNumber) {
+ afterApplyCallback.run();
+ } else {
+ if (mAfterApplyCallback == null) {
+ mAfterApplyCallback = afterApplyCallback;
+ } else {
+ final Runnable oldCallback = mAfterApplyCallback;
+ mAfterApplyCallback = new Runnable() {
+ @Override
+ public void run() {
+ afterApplyCallback.run();
+ oldCallback.run();
+ }
+ };
+ }
+ }
+ }
+
public static void applyParams(TransactionCompat t,
SyncRtSurfaceTransactionApplierCompat.SurfaceParams params) {
t.setMatrix(params.surface, params.matrix);
diff --git a/packages/SystemUI/src/com/android/systemui/SliceBroadcastRelayHandler.java b/packages/SystemUI/src/com/android/systemui/SliceBroadcastRelayHandler.java
index 922c65e..b3fc69e 100644
--- a/packages/SystemUI/src/com/android/systemui/SliceBroadcastRelayHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/SliceBroadcastRelayHandler.java
@@ -59,7 +59,10 @@
} else if (SliceBroadcastRelay.ACTION_UNREGISTER.equals(intent.getAction())) {
Uri uri = intent.getParcelableExtra(SliceBroadcastRelay.EXTRA_URI);
if (DEBUG) Log.d(TAG, "Unregister " + uri);
- getAndRemoveRelay(uri).unregister(mContext);
+ BroadcastRelay relay = getAndRemoveRelay(uri);
+ if (relay != null) {
+ relay.unregister(mContext);
+ }
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSCarrier.java b/packages/SystemUI/src/com/android/systemui/qs/QSCarrier.java
index f19445c..a1a7566 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSCarrier.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSCarrier.java
@@ -132,15 +132,18 @@
}
@Override
+ protected void onFinishInflate() {
+ setSelected(true);
+ }
+
+ @Override
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
// Only show marquee when visible
if (visibility == VISIBLE) {
setEllipsize(TextUtils.TruncateAt.MARQUEE);
- setSelected(true);
} else {
setEllipsize(TextUtils.TruncateAt.END);
- setSelected(false);
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
index 995dc66..4b55137 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
@@ -181,6 +181,7 @@
private static class HeaderTileLayout extends TileLayout {
private boolean mListening;
+ private Rect mClippingBounds = new Rect();
public HeaderTileLayout(Context context) {
super(context);
@@ -219,8 +220,8 @@
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
// We only care about clipping on the right side
- Rect bounds = new Rect(0, 0, r - l, 10000);
- setClipBounds(bounds);
+ mClippingBounds.set(0, 0, r - l, 10000);
+ setClipBounds(mClippingBounds);
calculateColumns();
@@ -252,9 +253,9 @@
}
final int availableWidth = getMeasuredWidth() - getPaddingStart() - getPaddingEnd();
- final int leftoverWithespace = availableWidth - maxTiles * mCellWidth;
+ final int leftoverWhitespace = availableWidth - maxTiles * mCellWidth;
final int smallestHorizontalMarginNeeded;
- smallestHorizontalMarginNeeded = leftoverWithespace / Math.max(1, maxTiles - 1);
+ smallestHorizontalMarginNeeded = leftoverWhitespace / Math.max(1, maxTiles - 1);
if (smallestHorizontalMarginNeeded > 0){
mCellMarginHorizontal = smallestHorizontalMarginNeeded;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
index 2e3065a..346ffa2 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
@@ -18,8 +18,6 @@
import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
import android.annotation.ColorInt;
import android.app.ActivityManager;
import android.app.AlarmManager;
@@ -39,7 +37,6 @@
import android.service.notification.ZenModeConfig;
import android.text.format.DateUtils;
import android.util.AttributeSet;
-import android.util.Log;
import android.util.Pair;
import android.util.StatsLog;
import android.view.DisplayCutout;
@@ -56,7 +53,6 @@
import com.android.settingslib.Utils;
import com.android.systemui.BatteryMeterView;
-import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.DarkIconDispatcher;
@@ -123,10 +119,6 @@
private View mSystemIconsView;
private View mQuickQsStatusIcons;
private View mHeaderTextContainerView;
- /** View containing the next alarm and ringer mode info. */
- private View mStatusContainer;
- /** Tooltip for educating users that they can long press on icons to see more details. */
- private View mLongPressTooltipView;
private int mRingerMode = AudioManager.RINGER_MODE_NORMAL;
private AlarmManager.AlarmClockInfo mNextAlarm;
@@ -146,8 +138,6 @@
private BatteryMeterView mBatteryRemainingIcon;
private PrivacyItemController mPrivacyItemController;
- /** Counts how many times the long press tooltip has been shown to the user. */
- private int mShownCount;
private final BroadcastReceiver mRingerReceiver = new BroadcastReceiver() {
@Override
@@ -159,11 +149,6 @@
private boolean mHasTopCutout = false;
private boolean mPrivacyChipLogged = false;
- /**
- * Runnable for automatically fading out the long press tooltip (as if it were animating away).
- */
- private final Runnable mAutoFadeOutTooltipRunnable = () -> hideLongPressTooltip(false);
-
private PrivacyItemController.Callback mPICCallback = new PrivacyItemController.Callback() {
@Override
public void privacyChanged(List<PrivacyItem> privacyItems) {
@@ -183,7 +168,6 @@
mStatusBarIconController = statusBarIconController;
mActivityStarter = activityStarter;
mPrivacyItemController = privacyItemController;
- mShownCount = getStoredShownCount();
}
@Override
@@ -199,10 +183,8 @@
iconContainer.setShouldRestrictIcons(false);
mIconManager = new TintedIconManager(iconContainer);
- // Views corresponding to the header info section (e.g. tooltip and next alarm).
+ // Views corresponding to the header info section (e.g. ringer and next alarm).
mHeaderTextContainerView = findViewById(R.id.header_text_container);
- mLongPressTooltipView = findViewById(R.id.long_press_tooltip);
- mStatusContainer = findViewById(R.id.status_container);
mStatusSeparator = findViewById(R.id.status_separator);
mNextAlarmIcon = findViewById(R.id.next_alarm_icon);
mNextAlarmTextView = findViewById(R.id.next_alarm_text);
@@ -267,7 +249,6 @@
boolean ringerVisible = mRingerModeTextView.getVisibility() == View.VISIBLE;
mStatusSeparator.setVisibility(alarmVisible && ringerVisible ? View.VISIBLE
: View.GONE);
- updateTooltipShow();
}
}
@@ -351,8 +332,6 @@
mClockView.useWallpaperTextColor(shouldUseWallpaperTextColor);
}
-
-
@Override
public void onRtlPropertiesChanged(int layoutDirection) {
super.onRtlPropertiesChanged(layoutDirection);
@@ -457,21 +436,6 @@
mPrivacyChip.setExpanded(expansionFraction > 0.5);
mPrivacyChipAlphaAnimator.setPosition(keyguardExpansionFraction);
}
-
- // Check the original expansion fraction - we don't want to show the tooltip until the
- // panel is pulled all the way out.
- if (expansionFraction == 1f) {
- // QS is fully expanded, bring in the tooltip.
- showLongPressTooltip();
- }
- }
-
- /** Returns the latest stored tooltip shown count from SharedPreferences. */
- private int getStoredShownCount() {
- return Prefs.getInt(
- mContext,
- Prefs.Key.QS_LONG_PRESS_TOOLTIP_SHOWN_COUNT,
- TOOLTIP_NOT_YET_SHOWN_COUNT);
}
public void disable(int state1, int state2, boolean animate) {
@@ -592,109 +556,6 @@
updateStatusText();
}
- private void updateTooltipShow() {
- if (hasStatusText()) {
- hideLongPressTooltip(true /* shouldShowStatusText */);
- } else {
- hideStatusText();
- }
- updateHeaderTextContainerAlphaAnimator();
- }
-
- private boolean hasStatusText() {
- return mNextAlarmTextView.getVisibility() == View.VISIBLE
- || mRingerModeTextView.getVisibility() == View.VISIBLE;
- }
-
- /**
- * Animates in the long press tooltip (as long as the next alarm text isn't currently occupying
- * the space).
- */
- public void showLongPressTooltip() {
- // If we have status text to show, don't bother fading in the tooltip.
- if (hasStatusText()) {
- return;
- }
-
- if (mShownCount < MAX_TOOLTIP_SHOWN_COUNT) {
- mLongPressTooltipView.animate().cancel();
- mLongPressTooltipView.setVisibility(View.VISIBLE);
- mLongPressTooltipView.animate()
- .alpha(1f)
- .setDuration(FADE_ANIMATION_DURATION_MS)
- .setListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mHandler.postDelayed(
- mAutoFadeOutTooltipRunnable, AUTO_FADE_OUT_DELAY_MS);
- }
- })
- .start();
-
- // Increment and drop the shown count in prefs for the next time we're deciding to
- // fade in the tooltip. We first sanity check that the tooltip count hasn't changed yet
- // in prefs (say, from a long press).
- if (getStoredShownCount() <= mShownCount) {
- Prefs.putInt(mContext, Prefs.Key.QS_LONG_PRESS_TOOLTIP_SHOWN_COUNT, ++mShownCount);
- }
- }
- }
-
- /**
- * Fades out the long press tooltip if it's partially visible - short circuits any running
- * animation. Additionally has the ability to fade in the status info text.
- *
- * @param shouldShowStatusText whether we should fade in the status text
- */
- private void hideLongPressTooltip(boolean shouldShowStatusText) {
- mLongPressTooltipView.animate().cancel();
- if (mLongPressTooltipView.getVisibility() == View.VISIBLE
- && mLongPressTooltipView.getAlpha() != 0f) {
- mHandler.removeCallbacks(mAutoFadeOutTooltipRunnable);
- mLongPressTooltipView.animate()
- .alpha(0f)
- .setDuration(FADE_ANIMATION_DURATION_MS)
- .setListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- if (DEBUG) Log.d(TAG, "hideLongPressTooltip: Hid long press tip");
- mLongPressTooltipView.setVisibility(View.INVISIBLE);
-
- if (shouldShowStatusText) {
- showStatus();
- }
- }
- })
- .start();
- } else {
- mLongPressTooltipView.setVisibility(View.INVISIBLE);
- if (shouldShowStatusText) {
- showStatus();
- }
- }
- }
-
- /**
- * Fades in the updated status text. Note that if there's already a status showing, this will
- * immediately fade it out and fade in the updated status.
- */
- private void showStatus() {
- mStatusContainer.setAlpha(0f);
-
- mStatusContainer.animate()
- .alpha(1f)
- .setDuration(FADE_ANIMATION_DURATION_MS)
- .start();
- }
-
- /** Fades out the status text. */
- private void hideStatusText() {
- mStatusContainer.animate()
- .alpha(0f)
- .setDuration(FADE_ANIMATION_DURATION_MS)
- .start();
- }
-
public void updateEverything() {
post(() -> setClickable(!mExpanded));
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 6101593..ebafb81 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -693,6 +693,9 @@
@Override
public void onKeyguardBouncerChanged(boolean bouncer) {
+ if (mLockIcon == null) {
+ return;
+ }
mLockIcon.setBouncerVisible(bouncer);
}
};
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
index 2a933a7..742fdda 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
@@ -178,7 +178,7 @@
// Send the assistant availability upon connection
if (isConnected) {
- mNavigationBarView.setAssistantAvailable(mAssistantAvailable);
+ sendAssistantAvailability(mAssistantAvailable);
}
}
@@ -235,7 +235,7 @@
boolean available = mAssistManager
.getAssistInfoForUser(UserHandle.USER_CURRENT) != null;
if (mAssistantAvailable != available) {
- mNavigationBarView.setAssistantAvailable(available);
+ sendAssistantAvailability(available);
mAssistantAvailable = available;
}
}
@@ -903,6 +903,17 @@
mNavigationBarView.setAccessibilityButtonState(showAccessibilityButton, targetSelection);
}
+ private void sendAssistantAvailability(boolean available) {
+ if (mOverviewProxyService.getProxy() != null) {
+ try {
+ mOverviewProxyService.getProxy().onAssistantAvailable(available
+ && QuickStepContract.isGesturalMode(getContext()));
+ } catch (RemoteException e) {
+ Log.w(TAG, "Unable to send assistant availability data to launcher");
+ }
+ }
+ }
+
// ----- Methods that DisplayNavigationBarController talks to -----
/** Applies auto dimming animation on navigation bar when touched. */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index a45d86e..411378f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -145,7 +145,6 @@
private NotificationPanelView mPanelView;
private NavBarTintController mTintController;
- private boolean mAssistantAvailable;
/**
* Helper that is responsible for showing the right toast when a disallowed activity operation
@@ -759,23 +758,6 @@
mEdgeBackGestureHandler.onOverlaysChanged();
}
- public void setAssistantAvailable(boolean available) {
- mAssistantAvailable = available;
- updateAssistantAvailability();
- }
-
- // TODO(b/112934365): move this back to NavigationBarFragment when prototype is removed
- private void updateAssistantAvailability() {
- boolean available = mAssistantAvailable && QuickStepContract.isGesturalMode(getContext());
- if (mOverviewProxyService.getProxy() != null) {
- try {
- mOverviewProxyService.getProxy().onAssistantAvailable(available);
- } catch (RemoteException e) {
- Log.w(TAG, "Unable to send assistant availability data to launcher");
- }
- }
- }
-
public void setMenuVisibility(final boolean show) {
mContextualButtonGroup.setButtonVisiblity(R.id.menu, show);
}
@@ -898,10 +880,6 @@
public void showPinningEnterExitToast(boolean entering) {
if (entering) {
mScreenPinningNotify.showPinningStartToast();
-
- // TODO(b/112934365): remove after prototype finished, only needed to escape from pin
- getBackButton().setVisibility(VISIBLE);
- getHomeButton().setVisibility(VISIBLE);
} else {
mScreenPinningNotify.showPinningExitToast();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index 183fdb4..d5706e3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -238,7 +238,8 @@
mIconController.setIconVisibility(mSlotLocation, false);
// sensors off
- mIconController.setIcon(mSlotSensorsOff, R.drawable.stat_sys_sensors_off, null);
+ mIconController.setIcon(mSlotSensorsOff, R.drawable.stat_sys_sensors_off,
+ mContext.getString(R.string.accessibility_sensors_off_active));
mIconController.setIconVisibility(mSlotSensorsOff,
mSensorPrivacyController.isSensorPrivacyEnabled());
diff --git a/packages/SystemUI/tests/src/com/android/systemui/SliceBroadcastRelayHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/SliceBroadcastRelayHandlerTest.java
index c6e85c3..19e1a5c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/SliceBroadcastRelayHandlerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/SliceBroadcastRelayHandlerTest.java
@@ -95,6 +95,22 @@
}
@Test
+ public void testUnregisterWithoutRegister() {
+ Uri testUri = new Uri.Builder()
+ .scheme(ContentResolver.SCHEME_CONTENT)
+ .authority("something")
+ .path("test")
+ .build();
+ SliceBroadcastRelayHandler relayHandler = new SliceBroadcastRelayHandler();
+ relayHandler.mContext = spy(mContext);
+
+ Intent intent = new Intent(SliceBroadcastRelay.ACTION_UNREGISTER);
+ intent.putExtra(SliceBroadcastRelay.EXTRA_URI, ContentProvider.maybeAddUserId(testUri, 0));
+ relayHandler.handleIntent(intent);
+ // No crash
+ }
+
+ @Test
public void testRelay() {
Receiver.sReceiver = mock(BroadcastReceiver.class);
Uri testUri = new Uri.Builder()
diff --git a/packages/overlays/AccentColorCinnamonOverlay/res/values/colors_device_defaults.xml b/packages/overlays/AccentColorCinnamonOverlay/res/values/colors_device_defaults.xml
index c420ab6..a99f705 100644
--- a/packages/overlays/AccentColorCinnamonOverlay/res/values/colors_device_defaults.xml
+++ b/packages/overlays/AccentColorCinnamonOverlay/res/values/colors_device_defaults.xml
@@ -18,5 +18,5 @@
-->
<resources>
<color name="accent_device_default_light">#AF6050</color>
- <color name="accent_device_default_dark">#9D6962</color>
+ <color name="accent_device_default_dark">#C3A6A2</color>
</resources>
diff --git a/packages/overlays/AccentColorOceanOverlay/res/values/colors_device_defaults.xml b/packages/overlays/AccentColorOceanOverlay/res/values/colors_device_defaults.xml
index 6aec805..449639b 100644
--- a/packages/overlays/AccentColorOceanOverlay/res/values/colors_device_defaults.xml
+++ b/packages/overlays/AccentColorOceanOverlay/res/values/colors_device_defaults.xml
@@ -18,5 +18,5 @@
-->
<resources>
<color name="accent_device_default_light">#0C80A7</color>
- <color name="accent_device_default_dark">#347D98</color>
+ <color name="accent_device_default_dark">#28BDD7</color>
</resources>
diff --git a/packages/overlays/AccentColorOrchidOverlay/res/values/colors_device_defaults.xml b/packages/overlays/AccentColorOrchidOverlay/res/values/colors_device_defaults.xml
index 049f8b8..47079a8 100644
--- a/packages/overlays/AccentColorOrchidOverlay/res/values/colors_device_defaults.xml
+++ b/packages/overlays/AccentColorOrchidOverlay/res/values/colors_device_defaults.xml
@@ -18,5 +18,5 @@
-->
<resources>
<color name="accent_device_default_light">#C42CC9</color>
- <color name="accent_device_default_dark">#C42CC9</color>
+ <color name="accent_device_default_dark">#E68AED</color>
</resources>
diff --git a/packages/overlays/AccentColorSpaceOverlay/res/values/colors_device_defaults.xml b/packages/overlays/AccentColorSpaceOverlay/res/values/colors_device_defaults.xml
index b6f757c..f147aeb 100644
--- a/packages/overlays/AccentColorSpaceOverlay/res/values/colors_device_defaults.xml
+++ b/packages/overlays/AccentColorSpaceOverlay/res/values/colors_device_defaults.xml
@@ -18,5 +18,5 @@
-->
<resources>
<color name="accent_device_default_light">#47618A</color>
- <color name="accent_device_default_dark">#5D7A92</color>
+ <color name="accent_device_default_dark">#99ACCC</color>
</resources>
diff --git a/packages/overlays/IconShapeSquareOverlay/res/values/config.xml b/packages/overlays/IconShapeSquareOverlay/res/values/config.xml
index 7b65555..2016ece 100644
--- a/packages/overlays/IconShapeSquareOverlay/res/values/config.xml
+++ b/packages/overlays/IconShapeSquareOverlay/res/values/config.xml
@@ -23,6 +23,8 @@
<bool name="config_useRoundIcon">false</bool>
<!-- Corner radius of system dialogs -->
<dimen name="config_dialogCornerRadius">0dp</dimen>
-
+ <!-- Corner radius for bottom sheet system dialogs -->
+ <dimen name="config_bottomDialogCornerRadius">0dp</dimen>
+
</resources>
diff --git a/proto/src/metrics_constants/metrics_constants.proto b/proto/src/metrics_constants/metrics_constants.proto
index 3babb6d..21c6035 100644
--- a/proto/src/metrics_constants/metrics_constants.proto
+++ b/proto/src/metrics_constants/metrics_constants.proto
@@ -7182,6 +7182,30 @@
// OS: Q
QS_UI_MODE_NIGHT = 1706;
+ // OPEN: Settings > Pick SIM dialog
+ // CATEGORY: SETTINGS
+ // OS: Q
+ DIALOG_SIM_LIST = 1707;
+
+ // OPEN: Settings > Pick SIM (that supports calling) dialog
+ // CATEGORY: SETTINGS
+ // OS: Q
+ DIALOG_CALL_SIM_LIST = 1708;
+
+ // OPEN: Settings > Pick preferred SIM dialog
+ // CATEGORY: SETTINGS
+ // OS: Q
+ DIALOG_PREFERRED_SIM_PICKER = 1709;
+
+ // ACTION: Share a Wi-Fi network by generating a QR code
+ ACTION_SETTINGS_SHARE_WIFI_QR_CODE = 1710;
+
+ // ACTION: Connect to a Wi-Fi network by scanning a QR code
+ ACTION_SETTINGS_ENROLL_WIFI_QR_CODE = 1711;
+
+ // ACTION: Share Wi-Fi hotspot by generating a QR code
+ ACTION_SETTINGS_SHARE_WIFI_HOTSPOT_QR_CODE = 1712;
+
// ---- End Q Constants, all Q constants go above this line ----
// Add new aosp constants above this line.
// END OF AOSP CONSTANTS
diff --git a/proto/src/wifi.proto b/proto/src/wifi.proto
index 834987c..ea044cf 100644
--- a/proto/src/wifi.proto
+++ b/proto/src/wifi.proto
@@ -2098,6 +2098,9 @@
// Firmware alert code. Only valid when the stats was triggered by a firmware
// alert, otherwise -1.
optional int32 firmware_alert_code = 4 [default = -1];
+
+ // Absolute milliseconds from device boot when these stats were sampled
+ optional int64 time_stamp_ms = 5;
}
message DeviceMobilityStatePnoScanStats {
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 6e2c228..334262f 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -2504,7 +2504,7 @@
* registered.
*/
@Override
- public int getAccessibilityWindowId(IBinder windowToken) {
+ public int getAccessibilityWindowId(@Nullable IBinder windowToken) {
synchronized (mLock) {
if (UserHandle.getAppId(Binder.getCallingUid()) != Process.SYSTEM_UID) {
throw new SecurityException("Only SYSTEM can call getAccessibilityWindowId");
diff --git a/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java b/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java
index 7f411d8..a2d3d4c 100644
--- a/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java
+++ b/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java
@@ -781,36 +781,46 @@
@GuardedBy("mGlobalWhitelistStateLock")
public ContentCaptureOptions getOptions(@UserIdInt int userId,
@NonNull String packageName) {
+ boolean packageWhitelisted;
+ ArraySet<ComponentName> whitelistedComponents = null;
synchronized (mGlobalWhitelistStateLock) {
- if (!isWhitelisted(userId, packageName)) {
- if (packageName.equals(mServicePackages.get(userId))) {
+ packageWhitelisted = isWhitelisted(userId, packageName);
+ if (!packageWhitelisted) {
+ // Full package is not whitelisted: check individual components first
+ whitelistedComponents = getWhitelistedComponents(userId, packageName);
+ if (whitelistedComponents == null
+ && packageName.equals(mServicePackages.get(userId))) {
+ // No components whitelisted either, but let it go because it's the
+ // service's own package
if (verbose) Slog.v(mTag, "getOptionsForPackage() lite for " + packageName);
return new ContentCaptureOptions(mDevCfgLoggingLevel);
}
- if (verbose) {
- Slog.v(mTag, "getOptionsForPackage(" + packageName + "): not whitelisted");
- }
+ }
+ } // synchronized
+
+ // Restrict what temporary services can whitelist
+ if (Build.IS_USER && mServiceNameResolver.isTemporary(userId)) {
+ if (!packageName.equals(mServicePackages.get(userId))) {
+ Slog.w(mTag, "Ignoring package " + packageName + " while using temporary "
+ + "service " + mServicePackages.get(userId));
return null;
}
-
- final ArraySet<ComponentName> whitelistedComponents =
- getWhitelistedComponents(userId, packageName);
- if (Build.IS_USER && mServiceNameResolver.isTemporary(userId)) {
- if (!packageName.equals(mServicePackages.get(userId))) {
- Slog.w(mTag, "Ignoring package " + packageName
- + " while using temporary service " + mServicePackages.get(userId));
- return null;
- }
- }
- final ContentCaptureOptions options = new ContentCaptureOptions(mDevCfgLoggingLevel,
- mDevCfgMaxBufferSize, mDevCfgIdleFlushingFrequencyMs,
- mDevCfgTextChangeFlushingFrequencyMs, mDevCfgLogHistorySize,
- whitelistedComponents);
- if (verbose) {
- Slog.v(mTag, "getOptionsForPackage(" + packageName + "): " + options);
- }
- return options;
}
+
+ if (!packageWhitelisted && whitelistedComponents == null) {
+ // No can do!
+ if (verbose) {
+ Slog.v(mTag, "getOptionsForPackage(" + packageName + "): not whitelisted");
+ }
+ return null;
+ }
+
+ final ContentCaptureOptions options = new ContentCaptureOptions(mDevCfgLoggingLevel,
+ mDevCfgMaxBufferSize, mDevCfgIdleFlushingFrequencyMs,
+ mDevCfgTextChangeFlushingFrequencyMs, mDevCfgLogHistorySize,
+ whitelistedComponents);
+ if (verbose) Slog.v(mTag, "getOptionsForPackage(" + packageName + "): " + options);
+ return options;
}
@Override
diff --git a/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java b/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
index 5a42e78..a7921b5 100644
--- a/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
+++ b/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
@@ -35,13 +35,11 @@
import android.app.assist.AssistContent;
import android.app.assist.AssistStructure;
import android.content.ComponentName;
-import android.content.ContentCaptureOptions;
import android.content.pm.ActivityPresentationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ServiceInfo;
import android.os.Binder;
-import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.UserHandle;
@@ -60,7 +58,6 @@
import android.view.contentcapture.DataRemovalRequest;
import com.android.internal.annotations.GuardedBy;
-import com.android.internal.infra.WhitelistHelper;
import com.android.internal.os.IResultReceiver;
import com.android.server.LocalServices;
import com.android.server.contentcapture.RemoteContentCaptureService.ContentCaptureServiceCallbacks;
@@ -97,12 +94,6 @@
new ContentCaptureServiceRemoteCallback();
/**
- * List of packages that are whitelisted to be content captured.
- */
- @GuardedBy("mLock")
- private final WhitelistHelper mWhitelistHelper = new WhitelistHelper();
-
- /**
* List of conditions keyed by package.
*/
@GuardedBy("mLock")
@@ -131,6 +122,7 @@
* Updates the reference to the remote service.
*/
private void updateRemoteServiceLocked(boolean disabled) {
+ if (mMaster.verbose) Slog.v(TAG, "updateRemoteService(disabled=" + disabled + ")");
if (mRemoteService != null) {
if (mMaster.debug) Slog.d(TAG, "updateRemoteService(): destroying old remote service");
mRemoteService.destroy();
@@ -247,7 +239,8 @@
final int displayId = activityPresentationInfo.displayId;
final ComponentName componentName = activityPresentationInfo.componentName;
final boolean whiteListed = mMaster.mGlobalContentCaptureOptions.isWhitelisted(mUserId,
- componentName);
+ componentName) || mMaster.mGlobalContentCaptureOptions.isWhitelisted(mUserId,
+ componentName.getPackageName());
final ComponentName serviceComponentName = getServiceComponentName();
final boolean enabled = isEnabledLocked();
if (mMaster.mRequestsHistory != null) {
@@ -462,40 +455,6 @@
@GuardedBy("mLock")
@Nullable
- ContentCaptureOptions getOptionsForPackageLocked(@NonNull String packageName) {
- if (!mWhitelistHelper.isWhitelisted(packageName)) {
- if (packageName.equals(getServicePackageName())) {
- if (mMaster.verbose) Slog.v(mTag, "getOptionsForPackage() lite for " + packageName);
- return new ContentCaptureOptions(mMaster.mDevCfgLoggingLevel);
- }
- if (mMaster.verbose) {
- Slog.v(mTag, "getOptionsForPackage(" + packageName + "): not whitelisted");
- }
- return null;
- }
-
- final ArraySet<ComponentName> whitelistedComponents = mWhitelistHelper
- .getWhitelistedComponents(packageName);
- if (Build.IS_USER && isTemporaryServiceSetLocked()) {
- final String servicePackageName = getServicePackageName();
- if (!packageName.equals(servicePackageName)) {
- Slog.w(mTag, "Ignoring package " + packageName
- + " while using temporary service " + servicePackageName);
- return null;
- }
- }
- final ContentCaptureOptions options = new ContentCaptureOptions(mMaster.mDevCfgLoggingLevel,
- mMaster.mDevCfgMaxBufferSize, mMaster.mDevCfgIdleFlushingFrequencyMs,
- mMaster.mDevCfgTextChangeFlushingFrequencyMs, mMaster.mDevCfgLogHistorySize,
- whitelistedComponents);
- if (mMaster.verbose) {
- Slog.v(mTag, "getOptionsForPackage(" + packageName + "): " + options);
- }
- return options;
- }
-
- @GuardedBy("mLock")
- @Nullable
ArraySet<ContentCaptureCondition> getContentCaptureConditionsLocked(
@NonNull String packageName) {
return mConditionsByPkg.get(packageName);
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java
index 1bd367c..1fa62ce 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -3152,7 +3152,7 @@
void removeLocked(final int uid) {
if (uid == Process.SYSTEM_UID) {
- Slog.wtf(TAG, "removeLocked: Shouldn't for UID=" + uid);
+ // If a force-stop occurs for a system-uid package, ignore it.
return;
}
boolean didRemove = false;
@@ -3247,7 +3247,7 @@
// Only called for ephemeral apps
void removeForStoppedLocked(final int uid) {
if (uid == Process.SYSTEM_UID) {
- Slog.wtf(TAG, "removeForStoppedLocked: Shouldn't for UID=" + uid);
+ // If a force-stop occurs for a system-uid package, ignore it.
return;
}
boolean didRemove = false;
@@ -3291,7 +3291,7 @@
void removeUserLocked(int userHandle) {
if (userHandle == UserHandle.USER_SYSTEM) {
- Slog.wtf(TAG, "removeForStoppedLocked: Shouldn't for user=" + userHandle);
+ // If we're told we're removing the system user, ignore it.
return;
}
boolean didRemove = false;
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 6c3a169..ee8bb05 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -735,19 +735,18 @@
}
}
- final DetailedState state = DetailedState.DISCONNECTED;
-
if (wasFirstNetwork || wasDefault) {
- maybeLogBroadcast(nai, state, type, wasDefault);
- mService.sendLegacyNetworkBroadcast(nai, state, type);
+ maybeLogBroadcast(nai, DetailedState.DISCONNECTED, type, wasDefault);
+ mService.sendLegacyNetworkBroadcast(nai, DetailedState.DISCONNECTED, type);
}
if (!list.isEmpty() && wasFirstNetwork) {
if (DBG) log("Other network available for type " + type +
", sending connected broadcast");
final NetworkAgentInfo replacement = list.get(0);
- maybeLogBroadcast(replacement, state, type, mService.isDefaultNetwork(replacement));
- mService.sendLegacyNetworkBroadcast(replacement, state, type);
+ maybeLogBroadcast(replacement, DetailedState.CONNECTED, type,
+ mService.isDefaultNetwork(replacement));
+ mService.sendLegacyNetworkBroadcast(replacement, DetailedState.CONNECTED, type);
}
}
@@ -2812,6 +2811,11 @@
EVENT_PROVISIONING_NOTIFICATION, PROVISIONING_NOTIFICATION_HIDE,
mNai.network.netId));
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
}
private boolean networkRequiresValidation(NetworkAgentInfo nai) {
diff --git a/services/core/java/com/android/server/ExtconUEventObserver.java b/services/core/java/com/android/server/ExtconUEventObserver.java
index 6b42b3d..5bd27c4 100644
--- a/services/core/java/com/android/server/ExtconUEventObserver.java
+++ b/services/core/java/com/android/server/ExtconUEventObserver.java
@@ -159,7 +159,13 @@
}
}
- /** Does the {@link /sys/class/extcon} directory exist */
+ /** Does the {@code /sys/class/extcon/<name>} directory exist */
+ public static boolean namedExtconDirExists(String name) {
+ File extconDir = new File("/sys/class/extcon/" + name);
+ return extconDir.exists() && extconDir.isDirectory();
+ }
+
+ /** Does the {@code /sys/class/extcon} directory exist */
public static boolean extconExists() {
File extconDir = new File("/sys/class/extcon");
return extconDir.exists() && extconDir.isDirectory();
diff --git a/services/core/java/com/android/server/Watchdog.java b/services/core/java/com/android/server/Watchdog.java
index cc3b43a..c2b35c18 100644
--- a/services/core/java/com/android/server/Watchdog.java
+++ b/services/core/java/com/android/server/Watchdog.java
@@ -96,6 +96,7 @@
"media.extractor", // system/bin/mediaextractor
"media.metrics", // system/bin/mediametrics
"media.codec", // vendor/bin/hw/android.hardware.media.omx@1.0-service
+ "media.swcodec", // /apex/com.android.media.swcodec/bin/mediaswcodec
"com.android.bluetooth", // Bluetooth service
"/system/bin/statsd", // Stats daemon
};
@@ -108,6 +109,7 @@
"android.hardware.graphics.allocator@2.0::IAllocator",
"android.hardware.graphics.composer@2.1::IComposer",
"android.hardware.health@2.0::IHealth",
+ "android.hardware.media.c2@1.0::IComponentStore",
"android.hardware.media.omx@1.0::IOmx",
"android.hardware.media.omx@1.0::IOmxStore",
"android.hardware.sensors@1.0::ISensors",
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index 0271354..24f8fc2 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -3830,8 +3830,11 @@
void serviceTimeout(ProcessRecord proc) {
String anrMessage = null;
-
synchronized(mAm) {
+ if (proc.isDebugging()) {
+ // The app's being debugged, ignore timeout.
+ return;
+ }
if (proc.executingServices.size() == 0 || proc.thread == null) {
return;
}
diff --git a/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java b/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java
index 236797b..5255316 100644
--- a/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java
+++ b/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java
@@ -407,6 +407,7 @@
SynchronousResultReceiver wifiReceiver = null;
SynchronousResultReceiver bluetoothReceiver = null;
SynchronousResultReceiver modemReceiver = null;
+ boolean railUpdated = false;
if ((updateFlags & BatteryStatsImpl.ExternalStatsSync.UPDATE_WIFI) != 0) {
// We were asked to fetch WiFi data.
@@ -426,6 +427,10 @@
// Oh well.
}
}
+ synchronized (mStats) {
+ mStats.updateRailStatsLocked();
+ }
+ railUpdated = true;
}
if ((updateFlags & BatteryStatsImpl.ExternalStatsSync.UPDATE_BT) != 0) {
@@ -447,6 +452,11 @@
modemReceiver = new SynchronousResultReceiver("telephony");
mTelephony.requestModemActivityInfo(modemReceiver);
}
+ if (!railUpdated) {
+ synchronized (mStats) {
+ mStats.updateRailStatsLocked();
+ }
+ }
}
final WifiActivityEnergyInfo wifiInfo = awaitControllerInfo(wifiReceiver);
@@ -477,10 +487,6 @@
mStats.updateRpmStatsLocked();
}
- if ((updateFlags & UPDATE_RAIL) != 0) {
- mStats.updateRailStatsLocked();
- }
-
if (bluetoothInfo != null) {
if (bluetoothInfo.isValid()) {
mStats.updateBluetoothStateLocked(bluetoothInfo);
diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java
index 49930c1..e891e6e 100644
--- a/services/core/java/com/android/server/am/ProcessRecord.java
+++ b/services/core/java/com/android/server/am/ProcessRecord.java
@@ -1557,7 +1557,7 @@
mService.mBatteryStatsService.noteProcessAnr(processName, uid);
}
- if (isSilentAnr()) {
+ if (isSilentAnr() && !isDebugging()) {
kill("bg anr", true);
return;
}
diff --git a/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java b/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
index 99380c9..19c3a71 100644
--- a/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
+++ b/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
@@ -132,16 +132,20 @@
}
for (String deviceConfigScope : mDeviceConfigScopes) {
- DeviceConfig.addOnPropertyChangedListener(
+ DeviceConfig.addOnPropertiesChangedListener(
deviceConfigScope,
AsyncTask.THREAD_POOL_EXECUTOR,
- (String scope, String name, String value) -> {
- String propertyName = makePropertyName(scope, name);
- if (propertyName == null) {
- log("unable to construct system property for " + scope + "/" + name);
- return;
+ (DeviceConfig.Properties properties) -> {
+ String scope = properties.getNamespace();
+ for (String key : properties.getKeyset()) {
+ String propertyName = makePropertyName(scope, key);
+ if (propertyName == null) {
+ log("unable to construct system property for " + scope + "/"
+ + key);
+ return;
+ }
+ setProperty(propertyName, properties.getString(key, null));
}
- setProperty(propertyName, value);
});
}
}
diff --git a/services/core/java/com/android/server/am/TEST_MAPPING b/services/core/java/com/android/server/am/TEST_MAPPING
index f198464..d56cb79 100644
--- a/services/core/java/com/android/server/am/TEST_MAPPING
+++ b/services/core/java/com/android/server/am/TEST_MAPPING
@@ -46,26 +46,12 @@
],
"postsubmit": [
{
- "name": "CtsActivityManagerDeviceTestCases"
- },
- {
- "name": "CtsActivityManagerDeviceSdk25TestCases"
- },
- {
"name": "FrameworksServicesTests",
"options": [
{
"include-filter": "com.android.server.am."
}
]
- },
- {
- "name": "WmTests",
- "options": [
- {
- "include-filter": "com.android.server.am."
- }
- ]
}
]
}
diff --git a/services/core/java/com/android/server/audio/AudioDeviceBroker.java b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
index 4ce6d91..05be100 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceBroker.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
@@ -771,7 +771,7 @@
case MSG_L_SCOCLIENT_DIED:
synchronized (mSetModeLock) {
synchronized (mDeviceStateLock) {
- mBtHelper.scoClientDied(msg.arg1);
+ mBtHelper.scoClientDied(msg.obj);
}
}
break;
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index b6879a3..d3af8f07 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -519,6 +519,10 @@
AudioSystem.DEVICE_OUT_AUX_LINE;
// Devices for which the volume is always max, no volume panel
int mFullVolumeDevices = 0;
+ // Devices for the which use the "absolute volume" concept (framework sends audio signal
+ // full scale, and volume control separately) and can be used for multiple use cases reflected
+ // by the audio mode (e.g. media playback in MODE_NORMAL, and phone calls in MODE_IN_CALL).
+ int mAbsVolumeMultiModeCaseDevices = AudioSystem.DEVICE_OUT_HEARING_AID;
private final boolean mMonitorRotation;
@@ -2050,6 +2054,49 @@
}
}
+ /**
+ * Manage an audio mode change for audio devices that use an "absolute volume" model,
+ * i.e. the framework sends the full scale signal, and the actual volume for the use case
+ * is communicated separately.
+ */
+ void updateAbsVolumeMultiModeDevices(int oldMode, int newMode) {
+ if (oldMode == newMode) {
+ return;
+ }
+ int streamType = AudioSystem.STREAM_MUSIC;
+ switch (newMode) {
+ case AudioSystem.MODE_IN_COMMUNICATION:
+ case AudioSystem.MODE_IN_CALL:
+ streamType = AudioSystem.STREAM_VOICE_CALL;
+ break;
+ case AudioSystem.MODE_NORMAL:
+ streamType = AudioSystem.STREAM_MUSIC;
+ break;
+ case AudioSystem.MODE_RINGTONE:
+ // not changing anything for ringtone
+ return;
+ case AudioSystem.MODE_CURRENT:
+ case AudioSystem.MODE_INVALID:
+ default:
+ // don't know what to do in this case, better bail
+ return;
+ }
+ final int device = AudioSystem.getDevicesForStream(streamType);
+ if ((device & mAbsVolumeMultiModeCaseDevices) == 0) {
+ return;
+ }
+
+ // handling of specific interfaces goes here:
+ if ((device & mAbsVolumeMultiModeCaseDevices) == AudioSystem.DEVICE_OUT_HEARING_AID) {
+ final int index = getStreamVolume(streamType);
+ mModeLogger.log(new AudioEventLogger.StringEvent("setMode to "
+ + AudioSystem.modeToString(newMode)
+ + " causes setting HEARING_AID volume to idx:" + index
+ + " stream:" + AudioSystem.streamToString(streamType)));
+ mDeviceBroker.postSetHearingAidVolumeIndex(index * 10, streamType);
+ }
+ }
+
private void setStreamVolume(int streamType, int index, int flags, String callingPackage,
String caller, int uid) {
if (DEBUG_VOL) {
@@ -3039,9 +3086,9 @@
}
}
- // must be called synchronized on mSetModeLock
// setModeInt() returns a valid PID if the audio mode was successfully set to
// any mode other than NORMAL.
+ @GuardedBy("mDeviceBroker.mSetModeLock")
private int setModeInt(int mode, IBinder cb, int pid, String caller) {
if (DEBUG_MODE) { Log.v(TAG, "setModeInt(mode=" + mode + ", pid=" + pid + ", caller="
+ caller + ")"); }
@@ -3063,6 +3110,7 @@
break;
}
}
+ final int oldMode = mMode;
int status = AudioSystem.AUDIO_STATUS_OK;
int actualMode;
do {
@@ -3134,6 +3182,9 @@
setStreamVolumeInt(mStreamVolumeAlias[streamType], index, device, true, caller);
updateStreamVolumeAlias(true /*updateVolumes*/, caller);
+
+ // change of mode may require volume to be re-applied on some devices
+ updateAbsVolumeMultiModeDevices(oldMode, actualMode);
}
return newModeOwnerPid;
}
diff --git a/services/core/java/com/android/server/location/GnssCapabilitiesProvider.java b/services/core/java/com/android/server/location/GnssCapabilitiesProvider.java
index b4b6160..88ff6e7 100644
--- a/services/core/java/com/android/server/location/GnssCapabilitiesProvider.java
+++ b/services/core/java/com/android/server/location/GnssCapabilitiesProvider.java
@@ -28,33 +28,16 @@
private static final String TAG = "GnssCapabilitiesProvider";
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
- // Bit masks for capabilities in {@link android.location.GnssCapabilities}.
- private static final long GNSS_CAPABILITY_LOW_POWER_MODE =
- 1L << GnssCapabilities.LOW_POWER_MODE;
- private static final long GNSS_CAPABILITY_SATELLITE_BLACKLIST =
- 1L << GnssCapabilities.SATELLITE_BLACKLIST;
- private static final long GNSS_CAPABILITY_GEOFENCING = 1L << GnssCapabilities.GEOFENCING;
- private static final long GNSS_CAPABILITY_MEASUREMENTS = 1L << GnssCapabilities.MEASUREMENTS;
- private static final long GNSS_CAPABILITY_NAV_MESSAGES = 1L << GnssCapabilities.NAV_MESSAGES;
- private static final long GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS =
- 1L << GnssCapabilities.MEASUREMENT_CORRECTIONS;
- private static final long GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_LOS_SATS =
- 1L << GnssCapabilities.MEASUREMENT_CORRECTIONS_LOS_SATS;
- private static final long GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH =
- 1L << GnssCapabilities.MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH;
- private static final long GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_REFLECTING_PLANE =
- 1L << GnssCapabilities.MEASUREMENT_CORRECTIONS_REFLECTING_PLANE;
-
private static final long GNSS_CAPABILITIES_TOP_HAL =
- GNSS_CAPABILITY_LOW_POWER_MODE | GNSS_CAPABILITY_SATELLITE_BLACKLIST
- | GNSS_CAPABILITY_GEOFENCING | GNSS_CAPABILITY_MEASUREMENTS
- | GNSS_CAPABILITY_NAV_MESSAGES;
+ GnssCapabilities.LOW_POWER_MODE | GnssCapabilities.SATELLITE_BLACKLIST
+ | GnssCapabilities.GEOFENCING | GnssCapabilities.MEASUREMENTS
+ | GnssCapabilities.NAV_MESSAGES;
private static final long GNSS_CAPABILITIES_SUB_HAL_MEASUREMENT_CORRECTIONS =
- GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS
- | GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_LOS_SATS
- | GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH
- | GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_REFLECTING_PLANE;
+ GnssCapabilities.MEASUREMENT_CORRECTIONS
+ | GnssCapabilities.MEASUREMENT_CORRECTIONS_LOS_SATS
+ | GnssCapabilities.MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH
+ | GnssCapabilities.MEASUREMENT_CORRECTIONS_REFLECTING_PLANE;
// Capabilities in {@link android.location.GnssCapabilities} supported by GNSS chipset.
@GuardedBy("this")
@@ -79,20 +62,20 @@
long gnssCapabilities = 0;
if (hasCapability(topHalCapabilities,
GnssLocationProvider.GPS_CAPABILITY_LOW_POWER_MODE)) {
- gnssCapabilities |= GNSS_CAPABILITY_LOW_POWER_MODE;
+ gnssCapabilities |= GnssCapabilities.LOW_POWER_MODE;
}
if (hasCapability(topHalCapabilities,
GnssLocationProvider.GPS_CAPABILITY_SATELLITE_BLACKLIST)) {
- gnssCapabilities |= GNSS_CAPABILITY_SATELLITE_BLACKLIST;
+ gnssCapabilities |= GnssCapabilities.SATELLITE_BLACKLIST;
}
if (hasCapability(topHalCapabilities, GnssLocationProvider.GPS_CAPABILITY_GEOFENCING)) {
- gnssCapabilities |= GNSS_CAPABILITY_GEOFENCING;
+ gnssCapabilities |= GnssCapabilities.GEOFENCING;
}
if (hasCapability(topHalCapabilities, GnssLocationProvider.GPS_CAPABILITY_MEASUREMENTS)) {
- gnssCapabilities |= GNSS_CAPABILITY_MEASUREMENTS;
+ gnssCapabilities |= GnssCapabilities.MEASUREMENTS;
}
if (hasCapability(topHalCapabilities, GnssLocationProvider.GPS_CAPABILITY_NAV_MESSAGES)) {
- gnssCapabilities |= GNSS_CAPABILITY_NAV_MESSAGES;
+ gnssCapabilities |= GnssCapabilities.NAV_MESSAGES;
}
synchronized (this) {
@@ -110,18 +93,18 @@
* {@link android.location.GnssCapabilities}.
*/
void setSubHalMeasurementCorrectionsCapabilities(int measurementCorrectionsCapabilities) {
- long gnssCapabilities = GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS;
+ long gnssCapabilities = GnssCapabilities.MEASUREMENT_CORRECTIONS;
if (hasCapability(measurementCorrectionsCapabilities,
GnssMeasurementCorrectionsProvider.CAPABILITY_LOS_SATS)) {
- gnssCapabilities |= GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_LOS_SATS;
+ gnssCapabilities |= GnssCapabilities.MEASUREMENT_CORRECTIONS_LOS_SATS;
}
if (hasCapability(measurementCorrectionsCapabilities,
GnssMeasurementCorrectionsProvider.CAPABILITY_EXCESS_PATH_LENGTH)) {
- gnssCapabilities |= GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH;
+ gnssCapabilities |= GnssCapabilities.MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH;
}
if (hasCapability(measurementCorrectionsCapabilities,
GnssMeasurementCorrectionsProvider.CAPABILITY_REFLECTING_PLANE)) {
- gnssCapabilities |= GNSS_CAPABILITY_MEASUREMENT_CORRECTIONS_REFLECTING_PLANE;
+ gnssCapabilities |= GnssCapabilities.MEASUREMENT_CORRECTIONS_REFLECTING_PLANE;
}
synchronized (this) {
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index ec0f8b8..d93dddfc 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -2215,7 +2215,7 @@
s.append("MEASUREMENT_CORRECTIONS ");
}
s.append(")\n");
- if (mGnssMeasurementCorrectionsProvider.isAvailableInPlatform()) {
+ if (hasCapability(GPS_CAPABILITY_MEASUREMENT_CORRECTIONS)) {
s.append(" SubHal=MEASUREMENT_CORRECTIONS[");
s.append(mGnssMeasurementCorrectionsProvider.toStringCapabilities());
s.append("]\n");
diff --git a/services/core/java/com/android/server/net/NetworkStatsFactory.java b/services/core/java/com/android/server/net/NetworkStatsFactory.java
index af299cf..174f6009 100644
--- a/services/core/java/com/android/server/net/NetworkStatsFactory.java
+++ b/services/core/java/com/android/server/net/NetworkStatsFactory.java
@@ -28,6 +28,7 @@
import android.os.StrictMode;
import android.os.SystemClock;
+import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.ProcFileReader;
@@ -65,6 +66,7 @@
private boolean mUseBpfStats;
// A persistent Snapshot since device start for eBPF stats
+ @GuardedBy("mPersistSnapshot")
private final NetworkStats mPersistSnapshot;
// TODO: only do adjustments in NetworkStatsService and remove this.
@@ -284,15 +286,17 @@
stats = new NetworkStats(SystemClock.elapsedRealtime(), -1);
}
if (mUseBpfStats) {
- if (nativeReadNetworkStatsDetail(stats, mStatsXtUid.getAbsolutePath(), UID_ALL,
- null, TAG_ALL, mUseBpfStats) != 0) {
- throw new IOException("Failed to parse network stats");
+ synchronized (mPersistSnapshot) {
+ if (nativeReadNetworkStatsDetail(stats, mStatsXtUid.getAbsolutePath(), UID_ALL,
+ null, TAG_ALL, mUseBpfStats) != 0) {
+ throw new IOException("Failed to parse network stats");
+ }
+ mPersistSnapshot.setElapsedRealtime(stats.getElapsedRealtime());
+ mPersistSnapshot.combineAllValues(stats);
+ NetworkStats result = mPersistSnapshot.clone();
+ result.filter(limitUid, limitIfaces, limitTag);
+ return result;
}
- mPersistSnapshot.setElapsedRealtime(stats.getElapsedRealtime());
- mPersistSnapshot.combineAllValues(stats);
- NetworkStats result = mPersistSnapshot.clone();
- result.filter(limitUid, limitIfaces, limitTag);
- return result;
} else {
if (nativeReadNetworkStatsDetail(stats, mStatsXtUid.getAbsolutePath(), limitUid,
limitIfaces, limitTag, mUseBpfStats) != 0) {
diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
index 6b804df..33dd48a 100644
--- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
+++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
@@ -25,6 +25,8 @@
import android.accounts.IAccountManager;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
+import android.app.role.IRoleManager;
+import android.app.role.RoleManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.IIntentReceiver;
@@ -75,6 +77,7 @@
import android.os.ParcelFileDescriptor.AutoCloseInputStream;
import android.os.PersistableBundle;
import android.os.Process;
+import android.os.RemoteCallback;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ShellCommand;
@@ -115,6 +118,7 @@
import java.util.Map;
import java.util.Objects;
import java.util.WeakHashMap;
+import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
@@ -2460,19 +2464,37 @@
}
}
+ String pkgName;
String component = getNextArg();
- ComponentName componentName =
- component != null ? ComponentName.unflattenFromString(component) : null;
-
- if (componentName == null) {
- pw.println("Error: component name not specified or invalid");
- return 1;
+ if (component.indexOf('/') < 0) {
+ // No component specified, so assume it's just a package name.
+ pkgName = component;
+ } else {
+ ComponentName componentName =
+ component != null ? ComponentName.unflattenFromString(component) : null;
+ if (componentName == null) {
+ pw.println("Error: invalid component name");
+ return 1;
+ }
+ pkgName = componentName.getPackageName();
}
+
+ final CompletableFuture<Boolean> future = new CompletableFuture<>();
+ final RemoteCallback callback = new RemoteCallback(res -> future.complete(res != null));
try {
- mInterface.setHomeActivity(componentName, userId);
- pw.println("Success");
- return 0;
+ IRoleManager roleManager = android.app.role.IRoleManager.Stub.asInterface(
+ ServiceManager.getServiceOrThrow(Context.ROLE_SERVICE));
+ roleManager.addRoleHolderAsUser(RoleManager.ROLE_HOME, pkgName,
+ 0, userId, callback);
+ boolean success = future.get();
+ if (success) {
+ pw.println("Success");
+ return 0;
+ } else {
+ pw.println("Error: Failed to set default home.");
+ return 1;
+ }
} catch (Exception e) {
pw.println(e.toString());
return 1;
@@ -3161,6 +3183,10 @@
pw.println("");
pw.println(" set-home-activity [--user USER_ID] TARGET-COMPONENT");
pw.println(" Set the default home activity (aka launcher).");
+ pw.println(" TARGET-COMPONENT can be a package name (com.package.my) or a full");
+ pw.println(" component (com.package.my/component.name). However, only the package name");
+ pw.println(" matters: the actual component used will be determined automatically from");
+ pw.println(" the package.");
pw.println("");
pw.println(" set-installer PACKAGE INSTALLER");
pw.println(" Set installer package name");
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 9b4293d48..d624a85 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -310,6 +310,7 @@
static public final String SYSTEM_DIALOG_REASON_ASSIST = "assist";
static public final String SYSTEM_DIALOG_REASON_SCREENSHOT = "screenshot";
+ private static final int POWER_BUTTON_SUPPRESSION_DELAY_DEFAULT_MILLIS = 800;
private static final AudioAttributes VIBRATION_ATTRIBUTES = new AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
@@ -615,6 +616,8 @@
private boolean mPerDisplayFocusEnabled = false;
private volatile int mTopFocusedDisplayId = INVALID_DISPLAY;
+ private int mPowerButtonSuppressionDelayMillis = POWER_BUTTON_SUPPRESSION_DELAY_DEFAULT_MILLIS;
+
private static final int MSG_DISPATCH_MEDIA_KEY_WITH_WAKE_LOCK = 3;
private static final int MSG_DISPATCH_MEDIA_KEY_REPEAT_WITH_WAKE_LOCK = 4;
private static final int MSG_KEYGUARD_DRAWN_COMPLETE = 5;
@@ -782,6 +785,9 @@
resolver.registerContentObserver(Settings.Global.getUriFor(
Settings.Global.POWER_BUTTON_VERY_LONG_PRESS), false, this,
UserHandle.USER_ALL);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.POWER_BUTTON_SUPPRESSION_DELAY_AFTER_GESTURE_WAKE), false, this,
+ UserHandle.USER_ALL);
updateSettings();
}
@@ -1105,16 +1111,16 @@
case SHORT_PRESS_POWER_NOTHING:
break;
case SHORT_PRESS_POWER_GO_TO_SLEEP:
- goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, 0);
+ goToSleepFromPowerButton(eventTime, 0);
break;
case SHORT_PRESS_POWER_REALLY_GO_TO_SLEEP:
- goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON,
- PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE);
+ goToSleepFromPowerButton(eventTime, PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE);
break;
case SHORT_PRESS_POWER_REALLY_GO_TO_SLEEP_AND_GO_HOME:
- goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON,
- PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE);
- launchHomeFromHotKey(DEFAULT_DISPLAY);
+ if (goToSleepFromPowerButton(eventTime,
+ PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE)) {
+ launchHomeFromHotKey(DEFAULT_DISPLAY);
+ }
break;
case SHORT_PRESS_POWER_GO_HOME:
shortPressPowerGoHome();
@@ -1137,6 +1143,35 @@
}
}
+ /**
+ * Sends the device to sleep as a result of a power button press.
+ *
+ * @return True if the was device was sent to sleep, false if sleep was suppressed.
+ */
+ private boolean goToSleepFromPowerButton(long eventTime, int flags) {
+ // Before we actually go to sleep, we check the last wakeup reason.
+ // If the device very recently woke up from a gesture (like user lifting their device)
+ // then ignore the sleep instruction. This is because users have developed
+ // a tendency to hit the power button immediately when they pick up their device, and we
+ // don't want to put the device back to sleep in those cases.
+ final PowerManager.WakeData lastWakeUp = mPowerManagerInternal.getLastWakeup();
+ if (lastWakeUp != null && lastWakeUp.wakeReason == PowerManager.WAKE_REASON_GESTURE) {
+ final int gestureDelayMillis = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.POWER_BUTTON_SUPPRESSION_DELAY_AFTER_GESTURE_WAKE,
+ POWER_BUTTON_SUPPRESSION_DELAY_DEFAULT_MILLIS);
+ final long now = SystemClock.uptimeMillis();
+ if (mPowerButtonSuppressionDelayMillis > 0
+ && (now < lastWakeUp.wakeTime + mPowerButtonSuppressionDelayMillis)) {
+ Slog.i(TAG, "Sleep from power button suppressed. Time since gesture: "
+ + (now - lastWakeUp.wakeTime) + "ms");
+ return false;
+ }
+ }
+
+ goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, flags);
+ return true;
+ }
+
private void goToSleep(long eventTime, int reason, int flags) {
mRequestedOrGoingToSleep = true;
mPowerManager.goToSleep(eventTime, reason, flags);
@@ -1981,6 +2016,9 @@
mRingerToggleChord = Settings.Secure.getIntForUser(resolver,
Settings.Secure.VOLUME_HUSH_GESTURE, VOLUME_HUSH_OFF,
UserHandle.USER_CURRENT);
+ mPowerButtonSuppressionDelayMillis = Settings.Global.getInt(resolver,
+ Settings.Global.POWER_BUTTON_SUPPRESSION_DELAY_AFTER_GESTURE_WAKE,
+ POWER_BUTTON_SUPPRESSION_DELAY_DEFAULT_MILLIS);
if (!mContext.getResources()
.getBoolean(com.android.internal.R.bool.config_volumeHushGestureEnabled)) {
mRingerToggleChord = Settings.Secure.VOLUME_HUSH_OFF;
@@ -3594,11 +3632,15 @@
}
}
}
- } else if (ExtconUEventObserver.extconExists()) {
+ } else if (ExtconUEventObserver.extconExists()
+ && ExtconUEventObserver.namedExtconDirExists(HdmiVideoExtconUEventObserver.NAME)) {
HdmiVideoExtconUEventObserver observer = new HdmiVideoExtconUEventObserver();
plugged = observer.init();
mHDMIObserver = observer;
+ } else if (localLOGV) {
+ Slog.v(TAG, "Not observing HDMI plug state because HDMI was not found.");
}
+
// This dance forces the code in setHdmiPlugged to run.
// Always do this so the sticky intent is stuck (to false) if there is no hdmi.
mDefaultDisplayPolicy.setHdmiPlugged(plugged, true /* force */);
@@ -5658,7 +5700,8 @@
private class HdmiVideoExtconUEventObserver extends ExtconStateObserver<Boolean> {
private static final String HDMI_EXIST = "HDMI=1";
- private final ExtconInfo mHdmi = new ExtconInfo("hdmi");
+ private static final String NAME = "hdmi";
+ private final ExtconInfo mHdmi = new ExtconInfo(NAME);
private boolean init() {
boolean plugged = false;
diff --git a/services/core/java/com/android/server/power/AttentionDetector.java b/services/core/java/com/android/server/power/AttentionDetector.java
index 5e829b2..a65a812 100644
--- a/services/core/java/com/android/server/power/AttentionDetector.java
+++ b/services/core/java/com/android/server/power/AttentionDetector.java
@@ -76,6 +76,12 @@
private final AtomicBoolean mRequested;
/**
+ * Monotonously increasing ID for the requests sent.
+ */
+ @VisibleForTesting
+ protected int mRequestId;
+
+ /**
* {@link android.service.attention.AttentionService} API timeout.
*/
private long mMaxAttentionApiTimeoutMillis;
@@ -105,36 +111,13 @@
private AtomicLong mConsecutiveTimeoutExtendedCount = new AtomicLong(0);
@VisibleForTesting
- final AttentionCallbackInternal mCallback = new AttentionCallbackInternal() {
- @Override
- public void onSuccess(int result, long timestamp) {
- Slog.v(TAG, "onSuccess: " + result);
- if (mRequested.getAndSet(false)) {
- synchronized (mLock) {
- if (mWakefulness != PowerManagerInternal.WAKEFULNESS_AWAKE) {
- if (DEBUG) Slog.d(TAG, "Device slept before receiving callback.");
- return;
- }
- if (result == AttentionService.ATTENTION_SUCCESS_PRESENT) {
- mOnUserAttention.run();
- } else {
- resetConsecutiveExtensionCount();
- }
- }
- }
- }
-
- @Override
- public void onFailure(int error) {
- Slog.i(TAG, "Failed to check attention: " + error);
- mRequested.set(false);
- }
- };
+ AttentionCallbackInternalImpl mCallback;
public AttentionDetector(Runnable onUserAttention, Object lock) {
mOnUserAttention = onUserAttention;
mLock = lock;
mRequested = new AtomicBoolean(false);
+ mRequestId = 0;
// Device starts with an awake state upon boot.
mWakefulness = PowerManagerInternal.WAKEFULNESS_AWAKE;
@@ -196,9 +179,7 @@
return nextScreenDimming;
} else if (mRequested.get()) {
if (DEBUG) {
- // TODO(b/128134941): consider adding a member ID increasing counter in
- // AttentionCallbackInternal to track this better.
- Slog.d(TAG, "Pending attention callback, wait.");
+ Slog.d(TAG, "Pending attention callback with ID=" + mCallback.mId + ", wait.");
}
return whenToCheck;
}
@@ -208,6 +189,8 @@
// This means that we must assume that the request was successful, and then cancel it
// afterwards if AttentionManager couldn't deliver it.
mRequested.set(true);
+ mRequestId++;
+ mCallback = new AttentionCallbackInternalImpl(mRequestId);
final boolean sent = mAttentionManager.checkAttention(getAttentionTimeout(), mCallback);
if (!sent) {
mRequested.set(false);
@@ -301,4 +284,40 @@
pw.print(" mAttentionServiceSupported=" + isAttentionServiceSupported());
pw.print(" mRequested=" + mRequested);
}
+
+ @VisibleForTesting
+ final class AttentionCallbackInternalImpl extends AttentionCallbackInternal {
+ private final int mId;
+
+ AttentionCallbackInternalImpl(int id) {
+ this.mId = id;
+ }
+
+ @Override
+ public void onSuccess(int result, long timestamp) {
+ Slog.v(TAG, "onSuccess: " + result + ", ID: " + mId);
+ // If we don't check for request ID it's possible to get into a loop: success leads
+ // to the onUserAttention(), which in turn triggers updateUserActivity(), which will
+ // call back onSuccess() instantaneously if there is a cached value, and circle repeats.
+ if (mId == mRequestId && mRequested.getAndSet(false)) {
+ synchronized (mLock) {
+ if (mWakefulness != PowerManagerInternal.WAKEFULNESS_AWAKE) {
+ if (DEBUG) Slog.d(TAG, "Device slept before receiving callback.");
+ return;
+ }
+ if (result == AttentionService.ATTENTION_SUCCESS_PRESENT) {
+ mOnUserAttention.run();
+ } else {
+ resetConsecutiveExtensionCount();
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onFailure(int error) {
+ Slog.i(TAG, "Failed to check attention: " + error + ", ID: " + mId);
+ mRequested.set(false);
+ }
+ }
}
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index cfe11bf..e2bbb2d 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -52,6 +52,7 @@
import android.os.Message;
import android.os.PowerManager;
import android.os.PowerManager.ServiceType;
+import android.os.PowerManager.WakeData;
import android.os.PowerManager.WakeReason;
import android.os.PowerManagerInternal;
import android.os.PowerSaveState;
@@ -4850,6 +4851,12 @@
}
}
+ private PowerManager.WakeData getLastWakeupInternal() {
+ synchronized (mLock) {
+ return new WakeData(mLastWakeTime, mLastWakeReason);
+ }
+ }
+
private final class LocalService extends PowerManagerInternal {
@Override
public void setScreenBrightnessOverrideFromWindowManager(int screenBrightness) {
@@ -4971,5 +4978,10 @@
public boolean wasDeviceIdleFor(long ms) {
return wasDeviceIdleForInternal(ms);
}
+
+ @Override
+ public WakeData getLastWakeup() {
+ return getLastWakeupInternal();
+ }
}
}
diff --git a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
index 10afbef..0891ba4 100644
--- a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
+++ b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
@@ -99,7 +99,7 @@
* data for Tron, logcat, event logs and {@link android.app.WaitResult}.
*
* Tests:
- * atest CtsActivityManagerDeviceTestCases:ActivityMetricsLoggerTests
+ * atest CtsWindowManagerDeviceTestCases:ActivityMetricsLoggerTests
*/
class ActivityMetricsLogger {
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index ee6cf54..0820b0d 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -3372,6 +3372,11 @@
if (stack.inFreeformWindowingMode()) {
stack.setWindowingMode(WINDOWING_MODE_FULLSCREEN);
+ } else if (stack.getParent().inFreeformWindowingMode()) {
+ // If the window is on a freeform display, set it to undefined. It will be
+ // resolved to freeform and it can adjust windowing mode when the display mode
+ // changes in runtime.
+ stack.setWindowingMode(WINDOWING_MODE_UNDEFINED);
} else {
stack.setWindowingMode(WINDOWING_MODE_FREEFORM);
}
diff --git a/services/core/java/com/android/server/wm/Dimmer.java b/services/core/java/com/android/server/wm/Dimmer.java
index a7a793f..767327a 100644
--- a/services/core/java/com/android/server/wm/Dimmer.java
+++ b/services/core/java/com/android/server/wm/Dimmer.java
@@ -102,7 +102,9 @@
}
void removeSurface() {
- getPendingTransaction().remove(mDimLayer);
+ if (mDimLayer != null && mDimLayer.isValid()) {
+ getPendingTransaction().remove(mDimLayer);
+ }
mDimLayer = null;
}
}
@@ -305,7 +307,9 @@
if (!mDimState.mDimming) {
if (!mDimState.mAnimateExit) {
- t.remove(mDimState.mDimLayer);
+ if (mDimState.mDimLayer.isValid()) {
+ t.remove(mDimState.mDimLayer);
+ }
} else {
startDimExit(mLastRequestedDimContainer, mDimState.mSurfaceAnimator, t);
}
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index bd874ba..a57dd6d 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -822,6 +822,10 @@
(int) attrs.hideTimeoutMilliseconds,
AccessibilityManager.FLAG_CONTENT_TEXT);
attrs.windowAnimations = com.android.internal.R.style.Animation_Toast;
+ // Toast can show with below conditions when the screen is locked.
+ if (canToastShowWhenLocked(callingPid)) {
+ attrs.flags |= WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
+ }
break;
}
@@ -832,6 +836,16 @@
}
/**
+ * @return {@code true} if the calling activity initiate toast and is visible with
+ * {@link WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED} flag.
+ */
+ boolean canToastShowWhenLocked(int callingPid) {
+ return mDisplayContent.forAllWindows(w -> {
+ return callingPid == w.mSession.mPid && w.isVisible() && w.canShowWhenLocked();
+ }, true /* traverseTopToBottom */);
+ }
+
+ /**
* Preflight adding a window to the system.
*
* Currently enforces that three window types are singletons per display:
diff --git a/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java b/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
index 904c503..14585c5 100644
--- a/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
+++ b/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
@@ -274,7 +274,7 @@
}
// Even though we want to keep original bounds, we still don't want it to stomp on
// an existing task.
- adjustBoundsToAvoidConflict(display, outParams.mBounds);
+ adjustBoundsToAvoidConflictInDisplay(display, outParams.mBounds);
}
} else {
if (source != null && source.inFreeformWindowingMode()
@@ -534,7 +534,7 @@
}
// Lastly we adjust bounds to avoid conflicts with other tasks as much as possible.
- adjustBoundsToAvoidConflict(display, inOutBounds);
+ adjustBoundsToAvoidConflictInDisplay(display, inOutBounds);
}
private int convertOrientationToScreenOrientation(int orientation) {
@@ -678,16 +678,9 @@
* @param display the display which tasks are to check
* @param inOutBounds the bounds used to input initial bounds and output result bounds
*/
- private void adjustBoundsToAvoidConflict(@NonNull ActivityDisplay display,
+ private void adjustBoundsToAvoidConflictInDisplay(@NonNull ActivityDisplay display,
@NonNull Rect inOutBounds) {
- final Rect displayBounds = display.getBounds();
- if (!displayBounds.contains(inOutBounds)) {
- // The initial bounds are already out of display. The scanning algorithm below doesn't
- // work so well with them.
- return;
- }
-
- final List<TaskRecord> tasksToCheck = new ArrayList<>();
+ final List<Rect> taskBoundsToCheck = new ArrayList<>();
for (int i = 0; i < display.getChildCount(); ++i) {
final ActivityStack stack = display.getChildAt(i);
if (!stack.inFreeformWindowingMode()) {
@@ -695,11 +688,35 @@
}
for (int j = 0; j < stack.getChildCount(); ++j) {
- tasksToCheck.add(stack.getChildAt(j));
+ taskBoundsToCheck.add(stack.getChildAt(j).getBounds());
}
}
+ adjustBoundsToAvoidConflict(display.getBounds(), taskBoundsToCheck, inOutBounds);
+ }
- if (!boundsConflict(tasksToCheck, inOutBounds)) {
+ /**
+ * Adjusts input bounds to avoid conflict with provided display bounds and list of tasks bounds
+ * for the display.
+ *
+ * Scans the bounds in directions to find a candidate location that does not conflict with the
+ * provided list of task bounds. If starting bounds are outside the display bounds or if no
+ * suitable candidate bounds are found, the method returns the input bounds.
+ *
+ * @param displayBounds display bounds used to restrict the candidate bounds
+ * @param taskBoundsToCheck list of task bounds to check for conflict
+ * @param inOutBounds the bounds used to input initial bounds and output result bounds
+ */
+ @VisibleForTesting
+ void adjustBoundsToAvoidConflict(@NonNull Rect displayBounds,
+ @NonNull List<Rect> taskBoundsToCheck,
+ @NonNull Rect inOutBounds) {
+ if (!displayBounds.contains(inOutBounds)) {
+ // The initial bounds are already out of display. The scanning algorithm below doesn't
+ // work so well with them.
+ return;
+ }
+
+ if (!boundsConflict(taskBoundsToCheck, inOutBounds)) {
// Current proposal doesn't conflict with any task. Early return to avoid unnecessary
// calculation.
return;
@@ -713,11 +730,13 @@
}
mTmpBounds.set(inOutBounds);
- while (boundsConflict(tasksToCheck, mTmpBounds) && displayBounds.contains(mTmpBounds)) {
+ while (boundsConflict(taskBoundsToCheck, mTmpBounds)
+ && displayBounds.contains(mTmpBounds)) {
shiftBounds(direction, displayBounds, mTmpBounds);
}
- if (!boundsConflict(tasksToCheck, mTmpBounds) && displayBounds.contains(mTmpBounds)) {
+ if (!boundsConflict(taskBoundsToCheck, mTmpBounds)
+ && displayBounds.contains(mTmpBounds)) {
// Found a candidate. Just use this.
inOutBounds.set(mTmpBounds);
if (DEBUG) appendLog("avoid-bounds-conflict=" + inOutBounds);
@@ -772,16 +791,16 @@
mTmpDirections[1] = Gravity.TOP | Gravity.LEFT;
}
- private boolean boundsConflict(@NonNull List<TaskRecord> tasks, @NonNull Rect bounds) {
- for (TaskRecord task : tasks) {
- final Rect taskBounds = task.getBounds();
- final boolean leftClose = Math.abs(taskBounds.left - bounds.left)
+ private boolean boundsConflict(@NonNull List<Rect> taskBoundsToCheck,
+ @NonNull Rect candidateBounds) {
+ for (Rect taskBounds : taskBoundsToCheck) {
+ final boolean leftClose = Math.abs(taskBounds.left - candidateBounds.left)
< BOUNDS_CONFLICT_THRESHOLD;
- final boolean topClose = Math.abs(taskBounds.top - bounds.top)
+ final boolean topClose = Math.abs(taskBounds.top - candidateBounds.top)
< BOUNDS_CONFLICT_THRESHOLD;
- final boolean rightClose = Math.abs(taskBounds.right - bounds.right)
+ final boolean rightClose = Math.abs(taskBounds.right - candidateBounds.right)
< BOUNDS_CONFLICT_THRESHOLD;
- final boolean bottomClose = Math.abs(taskBounds.bottom - bounds.bottom)
+ final boolean bottomClose = Math.abs(taskBounds.bottom - candidateBounds.bottom)
< BOUNDS_CONFLICT_THRESHOLD;
if ((leftClose && topClose) || (leftClose && bottomClose) || (rightClose && topClose)
diff --git a/services/core/java/com/android/server/wm/WindowProcessController.java b/services/core/java/com/android/server/wm/WindowProcessController.java
index eb919eb..12b62b9 100644
--- a/services/core/java/com/android/server/wm/WindowProcessController.java
+++ b/services/core/java/com/android/server/wm/WindowProcessController.java
@@ -23,6 +23,7 @@
import static com.android.server.am.ActivityManagerService.MY_PID;
import static com.android.server.wm.ActivityStack.ActivityState.DESTROYED;
import static com.android.server.wm.ActivityStack.ActivityState.DESTROYING;
+import static com.android.server.wm.ActivityStack.ActivityState.INITIALIZING;
import static com.android.server.wm.ActivityStack.ActivityState.PAUSED;
import static com.android.server.wm.ActivityStack.ActivityState.PAUSING;
import static com.android.server.wm.ActivityStack.ActivityState.RESUMED;
@@ -98,7 +99,7 @@
private final ActivityTaskManagerService mAtm;
// The actual proc... may be null only if 'persistent' is true (in which case we are in the
// process of launching the app)
- private volatile IApplicationThread mThread;
+ private IApplicationThread mThread;
// Currently desired scheduling class
private volatile int mCurSchedGroup;
// Currently computed process state
@@ -192,8 +193,11 @@
return mPid;
}
+ @HotPath(caller = HotPath.PROCESS_CHANGE)
public void setThread(IApplicationThread thread) {
- mThread = thread;
+ synchronized (mAtm.mGlobalLockWithoutBoost) {
+ mThread = thread;
+ }
}
IApplicationThread getThread() {
@@ -507,7 +511,14 @@
continue;
}
ActivityRecord topActivity = task.getTopActivity();
- if (topActivity != null && topActivity.visible) {
+ if (topActivity == null) {
+ continue;
+ }
+ // If an activity has just been started it will not yet be visible, but
+ // is expected to be soon. We treat this as if it were already visible.
+ // This ensures a subsequent activity can be started even before this one
+ // becomes visible.
+ if (topActivity.visible || topActivity.isState(INITIALIZING)) {
return true;
}
}
diff --git a/services/net/Android.bp b/services/net/Android.bp
index f73a285..d72f1cf 100644
--- a/services/net/Android.bp
+++ b/services/net/Android.bp
@@ -3,8 +3,6 @@
name: "ipmemorystore-aidl-interfaces",
local_include_dir: "java",
srcs: [
- // TODO: Define and use a filegroup for these files, since they're also used in
- // networkstack-aidl-interfaces. This does not appear to work at the moment.
"java/android/net/IIpMemoryStore.aidl",
"java/android/net/IIpMemoryStoreCallbacks.aidl",
"java/android/net/ipmemorystore/**/*.aidl",
@@ -17,17 +15,16 @@
enabled: false,
},
},
- api_dir: "aidl/networkstack",
+ api_dir: "aidl/ipmemorystore",
+ versions: ["1"],
}
aidl_interface {
name: "networkstack-aidl-interfaces",
local_include_dir: "java",
- include_dirs: ["frameworks/base/core/java"], // For framework parcelables.
+ include_dirs: ["frameworks/base/core/java"], // For framework parcelables.
srcs: [
"java/android/net/DhcpResultsParcelable.aidl",
- "java/android/net/IIpMemoryStore.aidl",
- "java/android/net/IIpMemoryStoreCallbacks.aidl",
"java/android/net/INetworkMonitor.aidl",
"java/android/net/INetworkMonitorCallbacks.aidl",
"java/android/net/INetworkStackConnector.aidl",
@@ -41,7 +38,6 @@
"java/android/net/dhcp/IDhcpServerCallbacks.aidl",
"java/android/net/ip/IIpClient.aidl",
"java/android/net/ip/IIpClientCallbacks.aidl",
- "java/android/net/ipmemorystore/**/*.aidl",
],
backend: {
ndk: {
@@ -52,6 +48,8 @@
},
},
api_dir: "aidl/networkstack",
+ imports: ["ipmemorystore-aidl-interfaces"],
+ versions: ["1"],
}
java_library_static {
@@ -62,7 +60,7 @@
"ipmemorystore-client",
"netd_aidl_interface-java",
"networkstack-aidl-interfaces-java",
- ]
+ ],
}
java_library_static {
@@ -75,7 +73,7 @@
],
static_libs: [
"ipmemorystore-aidl-interfaces-java",
- ]
+ ],
}
filegroup {
diff --git a/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStore.aidl b/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStore.aidl
new file mode 100644
index 0000000..a8cbab2
--- /dev/null
+++ b/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStore.aidl
@@ -0,0 +1,9 @@
+package android.net;
+interface IIpMemoryStore {
+ oneway void storeNetworkAttributes(String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnStatusListener listener);
+ oneway void storeBlob(String l2Key, String clientId, String name, in android.net.ipmemorystore.Blob data, android.net.ipmemorystore.IOnStatusListener listener);
+ oneway void findL2Key(in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnL2KeyResponseListener listener);
+ oneway void isSameNetwork(String l2Key1, String l2Key2, android.net.ipmemorystore.IOnSameL3NetworkResponseListener listener);
+ oneway void retrieveNetworkAttributes(String l2Key, android.net.ipmemorystore.IOnNetworkAttributesRetrievedListener listener);
+ oneway void retrieveBlob(String l2Key, String clientId, String name, android.net.ipmemorystore.IOnBlobRetrievedListener listener);
+}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStoreCallbacks.aidl b/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStoreCallbacks.aidl
new file mode 100644
index 0000000..cf02c26
--- /dev/null
+++ b/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStoreCallbacks.aidl
@@ -0,0 +1,4 @@
+package android.net;
+interface IIpMemoryStoreCallbacks {
+ oneway void onIpMemoryStoreFetched(in android.net.IIpMemoryStore ipMemoryStore);
+}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/Blob.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/Blob.aidl
new file mode 100644
index 0000000..291dbef
--- /dev/null
+++ b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/Blob.aidl
@@ -0,0 +1,4 @@
+package android.net.ipmemorystore;
+parcelable Blob {
+ byte[] data;
+}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
new file mode 100644
index 0000000..52f40d4
--- /dev/null
+++ b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
@@ -0,0 +1,4 @@
+package android.net.ipmemorystore;
+interface IOnBlobRetrievedListener {
+ oneway void onBlobRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in String name, in android.net.ipmemorystore.Blob data);
+}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
new file mode 100644
index 0000000..7853514
--- /dev/null
+++ b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
@@ -0,0 +1,4 @@
+package android.net.ipmemorystore;
+interface IOnL2KeyResponseListener {
+ oneway void onL2KeyResponse(in android.net.ipmemorystore.StatusParcelable status, in String l2Key);
+}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
new file mode 100644
index 0000000..3dd2ae6
--- /dev/null
+++ b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
@@ -0,0 +1,4 @@
+package android.net.ipmemorystore;
+interface IOnNetworkAttributesRetrievedListener {
+ oneway void onNetworkAttributesRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes);
+}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
new file mode 100644
index 0000000..46d4ecb
--- /dev/null
+++ b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
@@ -0,0 +1,4 @@
+package android.net.ipmemorystore;
+interface IOnSameL3NetworkResponseListener {
+ oneway void onSameL3NetworkResponse(in android.net.ipmemorystore.StatusParcelable status, in android.net.ipmemorystore.SameL3NetworkResponseParcelable response);
+}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnStatusListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnStatusListener.aidl
new file mode 100644
index 0000000..54e654b
--- /dev/null
+++ b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnStatusListener.aidl
@@ -0,0 +1,4 @@
+package android.net.ipmemorystore;
+interface IOnStatusListener {
+ oneway void onComplete(in android.net.ipmemorystore.StatusParcelable status);
+}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/NetworkAttributesParcelable.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
new file mode 100644
index 0000000..9531ea3
--- /dev/null
+++ b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
@@ -0,0 +1,8 @@
+package android.net.ipmemorystore;
+parcelable NetworkAttributesParcelable {
+ byte[] assignedV4Address;
+ long assignedV4AddressExpiry;
+ String groupHint;
+ android.net.ipmemorystore.Blob[] dnsAddresses;
+ int mtu;
+}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
new file mode 100644
index 0000000..414272b
--- /dev/null
+++ b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
@@ -0,0 +1,6 @@
+package android.net.ipmemorystore;
+parcelable SameL3NetworkResponseParcelable {
+ String l2Key1;
+ String l2Key2;
+ float confidence;
+}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/StatusParcelable.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/StatusParcelable.aidl
new file mode 100644
index 0000000..92c6779
--- /dev/null
+++ b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/StatusParcelable.aidl
@@ -0,0 +1,4 @@
+package android.net.ipmemorystore;
+parcelable StatusParcelable {
+ int resultCode;
+}
diff --git a/services/net/aidl/networkstack/1/android/net/DhcpResultsParcelable.aidl b/services/net/aidl/networkstack/1/android/net/DhcpResultsParcelable.aidl
new file mode 100644
index 0000000..92b5345
--- /dev/null
+++ b/services/net/aidl/networkstack/1/android/net/DhcpResultsParcelable.aidl
@@ -0,0 +1,8 @@
+package android.net;
+parcelable DhcpResultsParcelable {
+ android.net.StaticIpConfiguration baseConfiguration;
+ int leaseDuration;
+ int mtu;
+ String serverAddress;
+ String vendorInfo;
+}
diff --git a/services/net/aidl/networkstack/1/android/net/INetworkMonitor.aidl b/services/net/aidl/networkstack/1/android/net/INetworkMonitor.aidl
new file mode 100644
index 0000000..b19f522
--- /dev/null
+++ b/services/net/aidl/networkstack/1/android/net/INetworkMonitor.aidl
@@ -0,0 +1,17 @@
+package android.net;
+interface INetworkMonitor {
+ oneway void start();
+ oneway void launchCaptivePortalApp();
+ oneway void notifyCaptivePortalAppFinished(int response);
+ oneway void setAcceptPartialConnectivity();
+ oneway void forceReevaluation(int uid);
+ oneway void notifyPrivateDnsChanged(in android.net.PrivateDnsConfigParcel config);
+ oneway void notifyDnsResponse(int returnCode);
+ oneway void notifyNetworkConnected(in android.net.LinkProperties lp, in android.net.NetworkCapabilities nc);
+ oneway void notifyNetworkDisconnected();
+ oneway void notifyLinkPropertiesChanged(in android.net.LinkProperties lp);
+ oneway void notifyNetworkCapabilitiesChanged(in android.net.NetworkCapabilities nc);
+ const int NETWORK_TEST_RESULT_VALID = 0;
+ const int NETWORK_TEST_RESULT_INVALID = 1;
+ const int NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY = 2;
+}
diff --git a/services/net/aidl/networkstack/1/android/net/INetworkMonitorCallbacks.aidl b/services/net/aidl/networkstack/1/android/net/INetworkMonitorCallbacks.aidl
new file mode 100644
index 0000000..ee9871d
--- /dev/null
+++ b/services/net/aidl/networkstack/1/android/net/INetworkMonitorCallbacks.aidl
@@ -0,0 +1,8 @@
+package android.net;
+interface INetworkMonitorCallbacks {
+ oneway void onNetworkMonitorCreated(in android.net.INetworkMonitor networkMonitor);
+ oneway void notifyNetworkTested(int testResult, @nullable String redirectUrl);
+ oneway void notifyPrivateDnsConfigResolved(in android.net.PrivateDnsConfigParcel config);
+ oneway void showProvisioningNotification(String action, String packageName);
+ oneway void hideProvisioningNotification();
+}
diff --git a/services/net/aidl/networkstack/1/android/net/INetworkStackConnector.aidl b/services/net/aidl/networkstack/1/android/net/INetworkStackConnector.aidl
new file mode 100644
index 0000000..7da11e4
--- /dev/null
+++ b/services/net/aidl/networkstack/1/android/net/INetworkStackConnector.aidl
@@ -0,0 +1,7 @@
+package android.net;
+interface INetworkStackConnector {
+ oneway void makeDhcpServer(in String ifName, in android.net.dhcp.DhcpServingParamsParcel params, in android.net.dhcp.IDhcpServerCallbacks cb);
+ oneway void makeNetworkMonitor(in android.net.Network network, String name, in android.net.INetworkMonitorCallbacks cb);
+ oneway void makeIpClient(in String ifName, in android.net.ip.IIpClientCallbacks callbacks);
+ oneway void fetchIpMemoryStore(in android.net.IIpMemoryStoreCallbacks cb);
+}
diff --git a/services/net/aidl/networkstack/1/android/net/INetworkStackStatusCallback.aidl b/services/net/aidl/networkstack/1/android/net/INetworkStackStatusCallback.aidl
new file mode 100644
index 0000000..f6ca6f7
--- /dev/null
+++ b/services/net/aidl/networkstack/1/android/net/INetworkStackStatusCallback.aidl
@@ -0,0 +1,4 @@
+package android.net;
+interface INetworkStackStatusCallback {
+ oneway void onStatusAvailable(int statusCode);
+}
diff --git a/services/net/aidl/networkstack/1/android/net/InitialConfigurationParcelable.aidl b/services/net/aidl/networkstack/1/android/net/InitialConfigurationParcelable.aidl
new file mode 100644
index 0000000..c80a787
--- /dev/null
+++ b/services/net/aidl/networkstack/1/android/net/InitialConfigurationParcelable.aidl
@@ -0,0 +1,7 @@
+package android.net;
+parcelable InitialConfigurationParcelable {
+ android.net.LinkAddress[] ipAddresses;
+ android.net.IpPrefix[] directlyConnectedRoutes;
+ String[] dnsServers;
+ String gateway;
+}
diff --git a/services/net/aidl/networkstack/1/android/net/PrivateDnsConfigParcel.aidl b/services/net/aidl/networkstack/1/android/net/PrivateDnsConfigParcel.aidl
new file mode 100644
index 0000000..2de790b
--- /dev/null
+++ b/services/net/aidl/networkstack/1/android/net/PrivateDnsConfigParcel.aidl
@@ -0,0 +1,5 @@
+package android.net;
+parcelable PrivateDnsConfigParcel {
+ String hostname;
+ String[] ips;
+}
diff --git a/services/net/aidl/networkstack/1/android/net/ProvisioningConfigurationParcelable.aidl b/services/net/aidl/networkstack/1/android/net/ProvisioningConfigurationParcelable.aidl
new file mode 100644
index 0000000..3a6c304
--- /dev/null
+++ b/services/net/aidl/networkstack/1/android/net/ProvisioningConfigurationParcelable.aidl
@@ -0,0 +1,15 @@
+package android.net;
+parcelable ProvisioningConfigurationParcelable {
+ boolean enableIPv4;
+ boolean enableIPv6;
+ boolean usingMultinetworkPolicyTracker;
+ boolean usingIpReachabilityMonitor;
+ int requestedPreDhcpActionMs;
+ android.net.InitialConfigurationParcelable initialConfig;
+ android.net.StaticIpConfiguration staticIpConfig;
+ android.net.apf.ApfCapabilities apfCapabilities;
+ int provisioningTimeoutMs;
+ int ipv6AddrGenMode;
+ android.net.Network network;
+ String displayName;
+}
diff --git a/services/net/aidl/networkstack/1/android/net/TcpKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/1/android/net/TcpKeepalivePacketDataParcelable.aidl
new file mode 100644
index 0000000..e121c06
--- /dev/null
+++ b/services/net/aidl/networkstack/1/android/net/TcpKeepalivePacketDataParcelable.aidl
@@ -0,0 +1,13 @@
+package android.net;
+parcelable TcpKeepalivePacketDataParcelable {
+ byte[] srcAddress;
+ int srcPort;
+ byte[] dstAddress;
+ int dstPort;
+ int seq;
+ int ack;
+ int rcvWnd;
+ int rcvWndScale;
+ int tos;
+ int ttl;
+}
diff --git a/services/net/aidl/networkstack/1/android/net/dhcp/DhcpServingParamsParcel.aidl b/services/net/aidl/networkstack/1/android/net/dhcp/DhcpServingParamsParcel.aidl
new file mode 100644
index 0000000..67193ae
--- /dev/null
+++ b/services/net/aidl/networkstack/1/android/net/dhcp/DhcpServingParamsParcel.aidl
@@ -0,0 +1,11 @@
+package android.net.dhcp;
+parcelable DhcpServingParamsParcel {
+ int serverAddr;
+ int serverAddrPrefixLength;
+ int[] defaultRouters;
+ int[] dnsServers;
+ int[] excludedAddrs;
+ long dhcpLeaseTimeSecs;
+ int linkMtu;
+ boolean metered;
+}
diff --git a/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServer.aidl b/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServer.aidl
new file mode 100644
index 0000000..9143158
--- /dev/null
+++ b/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServer.aidl
@@ -0,0 +1,10 @@
+package android.net.dhcp;
+interface IDhcpServer {
+ oneway void start(in android.net.INetworkStackStatusCallback cb);
+ oneway void updateParams(in android.net.dhcp.DhcpServingParamsParcel params, in android.net.INetworkStackStatusCallback cb);
+ oneway void stop(in android.net.INetworkStackStatusCallback cb);
+ const int STATUS_UNKNOWN = 0;
+ const int STATUS_SUCCESS = 1;
+ const int STATUS_INVALID_ARGUMENT = 2;
+ const int STATUS_UNKNOWN_ERROR = 3;
+}
diff --git a/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServerCallbacks.aidl b/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServerCallbacks.aidl
new file mode 100644
index 0000000..dcc4489
--- /dev/null
+++ b/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServerCallbacks.aidl
@@ -0,0 +1,4 @@
+package android.net.dhcp;
+interface IDhcpServerCallbacks {
+ oneway void onDhcpServerCreated(int statusCode, in android.net.dhcp.IDhcpServer server);
+}
diff --git a/services/net/aidl/networkstack/1/android/net/ip/IIpClient.aidl b/services/net/aidl/networkstack/1/android/net/ip/IIpClient.aidl
new file mode 100644
index 0000000..95a1574
--- /dev/null
+++ b/services/net/aidl/networkstack/1/android/net/ip/IIpClient.aidl
@@ -0,0 +1,14 @@
+package android.net.ip;
+interface IIpClient {
+ oneway void completedPreDhcpAction();
+ oneway void confirmConfiguration();
+ oneway void readPacketFilterComplete(in byte[] data);
+ oneway void shutdown();
+ oneway void startProvisioning(in android.net.ProvisioningConfigurationParcelable req);
+ oneway void stop();
+ oneway void setTcpBufferSizes(in String tcpBufferSizes);
+ oneway void setHttpProxy(in android.net.ProxyInfo proxyInfo);
+ oneway void setMulticastFilter(boolean enabled);
+ oneway void addKeepalivePacketFilter(int slot, in android.net.TcpKeepalivePacketDataParcelable pkt);
+ oneway void removeKeepalivePacketFilter(int slot);
+}
diff --git a/services/net/aidl/networkstack/1/android/net/ip/IIpClientCallbacks.aidl b/services/net/aidl/networkstack/1/android/net/ip/IIpClientCallbacks.aidl
new file mode 100644
index 0000000..d6bc808
--- /dev/null
+++ b/services/net/aidl/networkstack/1/android/net/ip/IIpClientCallbacks.aidl
@@ -0,0 +1,16 @@
+package android.net.ip;
+interface IIpClientCallbacks {
+ oneway void onIpClientCreated(in android.net.ip.IIpClient ipClient);
+ oneway void onPreDhcpAction();
+ oneway void onPostDhcpAction();
+ oneway void onNewDhcpResults(in android.net.DhcpResultsParcelable dhcpResults);
+ oneway void onProvisioningSuccess(in android.net.LinkProperties newLp);
+ oneway void onProvisioningFailure(in android.net.LinkProperties newLp);
+ oneway void onLinkPropertiesChange(in android.net.LinkProperties newLp);
+ oneway void onReachabilityLost(in String logMsg);
+ oneway void onQuit();
+ oneway void installPacketFilter(in byte[] filter);
+ oneway void startReadPacketFilter();
+ oneway void setFallbackMulticastFilter(boolean enabled);
+ oneway void setNeighborDiscoveryOffload(boolean enable);
+}
diff --git a/services/net/java/android/net/IpMemoryStore.java b/services/net/java/android/net/IpMemoryStore.java
index 9248299..4a115e6 100644
--- a/services/net/java/android/net/IpMemoryStore.java
+++ b/services/net/java/android/net/IpMemoryStore.java
@@ -41,6 +41,11 @@
public void onIpMemoryStoreFetched(final IIpMemoryStore memoryStore) {
mService.complete(memoryStore);
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
});
}
diff --git a/services/net/java/android/net/ip/IpClientUtil.java b/services/net/java/android/net/ip/IpClientUtil.java
index 90624e0..714ade1 100644
--- a/services/net/java/android/net/ip/IpClientUtil.java
+++ b/services/net/java/android/net/ip/IpClientUtil.java
@@ -175,6 +175,11 @@
public void setNeighborDiscoveryOffload(boolean enable) {
mCb.setNeighborDiscoveryOffload(enable);
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
}
/**
diff --git a/services/net/java/android/net/ip/IpServer.java b/services/net/java/android/net/ip/IpServer.java
index fc1128b..66884c6 100644
--- a/services/net/java/android/net/ip/IpServer.java
+++ b/services/net/java/android/net/ip/IpServer.java
@@ -277,6 +277,11 @@
}
public abstract void callback(int statusCode);
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
}
private class DhcpServerCallbacksImpl extends DhcpServerCallbacks {
diff --git a/services/net/java/android/net/ipmemorystore/OnBlobRetrievedListener.java b/services/net/java/android/net/ipmemorystore/OnBlobRetrievedListener.java
index 22978a2..a17483a 100644
--- a/services/net/java/android/net/ipmemorystore/OnBlobRetrievedListener.java
+++ b/services/net/java/android/net/ipmemorystore/OnBlobRetrievedListener.java
@@ -40,6 +40,11 @@
listener.onBlobRetrieved(new Status(statusParcelable), l2Key, name, blob);
}
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
};
}
}
diff --git a/services/net/java/android/net/ipmemorystore/OnL2KeyResponseListener.java b/services/net/java/android/net/ipmemorystore/OnL2KeyResponseListener.java
index 9e7c1c8..e608aec 100644
--- a/services/net/java/android/net/ipmemorystore/OnL2KeyResponseListener.java
+++ b/services/net/java/android/net/ipmemorystore/OnL2KeyResponseListener.java
@@ -40,6 +40,11 @@
listener.onL2KeyResponse(new Status(statusParcelable), l2Key);
}
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
};
}
}
diff --git a/services/net/java/android/net/ipmemorystore/OnNetworkAttributesRetrievedListener.java b/services/net/java/android/net/ipmemorystore/OnNetworkAttributesRetrievedListener.java
index 59da268..ca6f302 100644
--- a/services/net/java/android/net/ipmemorystore/OnNetworkAttributesRetrievedListener.java
+++ b/services/net/java/android/net/ipmemorystore/OnNetworkAttributesRetrievedListener.java
@@ -44,6 +44,11 @@
new NetworkAttributes(networkAttributesParcelable));
}
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
};
}
}
diff --git a/services/net/java/android/net/ipmemorystore/OnSameL3NetworkResponseListener.java b/services/net/java/android/net/ipmemorystore/OnSameL3NetworkResponseListener.java
index 0154fd2..67f8da8 100644
--- a/services/net/java/android/net/ipmemorystore/OnSameL3NetworkResponseListener.java
+++ b/services/net/java/android/net/ipmemorystore/OnSameL3NetworkResponseListener.java
@@ -43,6 +43,11 @@
new SameL3NetworkResponse(sameL3NetworkResponseParcelable));
}
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
};
}
}
diff --git a/services/net/java/android/net/ipmemorystore/OnStatusListener.java b/services/net/java/android/net/ipmemorystore/OnStatusListener.java
index 824b7b0..4262efd 100644
--- a/services/net/java/android/net/ipmemorystore/OnStatusListener.java
+++ b/services/net/java/android/net/ipmemorystore/OnStatusListener.java
@@ -39,6 +39,11 @@
listener.onComplete(new Status(statusParcelable));
}
}
+
+ @Override
+ public int getInterfaceVersion() {
+ return this.VERSION;
+ }
};
}
}
diff --git a/services/tests/servicestests/src/com/android/server/power/AttentionDetectorTest.java b/services/tests/servicestests/src/com/android/server/power/AttentionDetectorTest.java
index 4de00f7..c30a7dd 100644
--- a/services/tests/servicestests/src/com/android/server/power/AttentionDetectorTest.java
+++ b/services/tests/servicestests/src/com/android/server/power/AttentionDetectorTest.java
@@ -22,6 +22,8 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.Mockito.atMost;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
@@ -216,6 +218,53 @@
}
@Test
+ public void testCallbackOnSuccess_doesNotCallNonCurrentCallback() {
+ mAttentionDetector.mRequestId = 5;
+ registerAttention(); // mRequestId = 6;
+ mAttentionDetector.mRequestId = 55;
+
+ mAttentionDetector.mCallback.onSuccess(AttentionService.ATTENTION_SUCCESS_PRESENT,
+ SystemClock.uptimeMillis());
+ verify(mOnUserAttention, never()).run();
+ }
+
+ @Test
+ public void testCallbackOnSuccess_callsCallbackAfterOldCallbackCame() {
+ mAttentionDetector.mRequestId = 5;
+ registerAttention(); // mRequestId = 6;
+ mAttentionDetector.mRequestId = 55;
+
+ mAttentionDetector.mCallback.onSuccess(AttentionService.ATTENTION_SUCCESS_PRESENT,
+ SystemClock.uptimeMillis()); // old callback came
+ mAttentionDetector.mRequestId = 6; // now back to current
+ mAttentionDetector.mCallback.onSuccess(AttentionService.ATTENTION_SUCCESS_PRESENT,
+ SystemClock.uptimeMillis());
+ verify(mOnUserAttention).run();
+ }
+
+ @Test
+ public void testCallbackOnSuccess_DoesNotGoIntoInfiniteLoop() {
+ // Mimic real behavior
+ doAnswer((invocation) -> {
+ // Mimic a cache hit: calling onSuccess() immediately
+ registerAttention();
+ mAttentionDetector.mRequestId++;
+ mAttentionDetector.mCallback.onSuccess(AttentionService.ATTENTION_SUCCESS_PRESENT,
+ SystemClock.uptimeMillis());
+ return null;
+ }).when(mOnUserAttention).run();
+
+ registerAttention();
+ // This test fails with literal stack overflow:
+ // e.g. java.lang.StackOverflowError: stack size 1039KB
+ mAttentionDetector.mCallback.onSuccess(AttentionService.ATTENTION_SUCCESS_PRESENT,
+ SystemClock.uptimeMillis());
+
+ // We don't actually get here when the test fails
+ verify(mOnUserAttention, atMost(1)).run();
+ }
+
+ @Test
public void testCallbackOnFailure_unregistersCurrentRequestCode() {
registerAttention();
mAttentionDetector.mCallback.onFailure(AttentionService.ATTENTION_FAILURE_UNKNOWN);
@@ -232,7 +281,6 @@
}
private class TestableAttentionDetector extends AttentionDetector {
-
private boolean mAttentionServiceSupported;
TestableAttentionDetector() {
diff --git a/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java b/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java
index 5b32fe6..292a05b 100644
--- a/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java
@@ -27,6 +27,7 @@
import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.Mockito.when;
import android.graphics.Rect;
import android.platform.test.annotations.Presubmit;
@@ -78,7 +79,9 @@
@Override
public SurfaceControl build() {
- return mock(SurfaceControl.class);
+ SurfaceControl mSc = mock(SurfaceControl.class);
+ when(mSc.isValid()).thenReturn(true);
+ return mSc;
}
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java
index 07dd93c..1684f97 100644
--- a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java
@@ -22,13 +22,17 @@
import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
import static android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND;
import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
+import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR;
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
+import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
+import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
+import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock;
@@ -38,6 +42,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.spy;
@@ -232,4 +237,40 @@
displayRotation, Surface.ROTATION_0, Surface.ROTATION_90));
}
}
+
+ @Test
+ public void testShouldShowToastWhenScreenLocked() {
+ final DisplayPolicy policy = mDisplayContent.getDisplayPolicy();
+ final WindowState activity = createApplicationWindow();
+ final WindowState toast = createToastWindow();
+
+ synchronized (mWm.mGlobalLock) {
+ policy.adjustWindowParamsLw(
+ toast, toast.mAttrs, 0 /* callingPid */, 0 /* callingUid */);
+
+ assertTrue(policy.canToastShowWhenLocked(0 /* callingUid */));
+ assertNotEquals(0, toast.getAttrs().flags & FLAG_SHOW_WHEN_LOCKED);
+ }
+ }
+
+ private WindowState createToastWindow() {
+ final WindowState win = createWindow(null, TYPE_TOAST, "Toast");
+ final WindowManager.LayoutParams attrs = win.mAttrs;
+ attrs.width = WRAP_CONTENT;
+ attrs.height = WRAP_CONTENT;
+ attrs.flags = FLAG_KEEP_SCREEN_ON | FLAG_NOT_FOCUSABLE | FLAG_NOT_TOUCHABLE;
+ attrs.format = PixelFormat.TRANSLUCENT;
+ return win;
+ }
+
+ private WindowState createApplicationWindow() {
+ final WindowState win = createWindow(null, TYPE_APPLICATION, "Application");
+ final WindowManager.LayoutParams attrs = win.mAttrs;
+ attrs.width = MATCH_PARENT;
+ attrs.height = MATCH_PARENT;
+ attrs.flags = FLAG_SHOW_WHEN_LOCKED | FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR;
+ attrs.format = PixelFormat.OPAQUE;
+ win.mHasSurface = true;
+ return win;
+ }
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
index cdbb121..f918149 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
@@ -52,6 +52,8 @@
import org.junit.Before;
import org.junit.Test;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Locale;
/**
@@ -1206,6 +1208,23 @@
assertEquals(new Rect(120, 0, 320, 100), mResult.mBounds);
}
+ @Test
+ public void testAdjustBoundsToAvoidConflictAlwaysExits() {
+ Rect displayBounds = new Rect(0, 0, 40, 40);
+ List<Rect> existingTaskBounds = new ArrayList<>();
+ for (int i = 0; i < 9; i++) {
+ for (int j = 0; j < 9; j++) {
+ int left = i * 5;
+ int top = j * 5;
+ existingTaskBounds.add(new Rect(left, top, left + 20, top + 20));
+ }
+ }
+ Rect startingBounds = new Rect(0, 0, 20, 20);
+ Rect adjustedBounds = new Rect(startingBounds);
+ mTarget.adjustBoundsToAvoidConflict(displayBounds, existingTaskBounds, adjustedBounds);
+ assertEquals(startingBounds, adjustedBounds);
+ }
+
private TestActivityDisplay createNewActivityDisplay(int windowingMode) {
final TestActivityDisplay display = addNewActivityDisplayAt(ActivityDisplay.POSITION_TOP);
display.setWindowingMode(windowingMode);
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 33d5c04..26745a7 100755
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1199,6 +1199,80 @@
public static final String KEY_CARRIER_NAME_STRING = "carrier_name_string";
/**
+ * Override the SPN Display Condition 2 integer bits (lsb). B2, B1 is the last two bits of the
+ * spn display condition coding.
+ *
+ * The default value -1 mean this field is not config.
+ *
+ * B1 = 0: display of registered PLMN name not required when registered PLMN is either HPLMN
+ * or a PLMN in the service provider PLMN list (see EF_SPDI).
+ * B1 = 1: display of registered PLMN name required when registered PLMN is either HPLMN or a
+ * PLMN in the service provider PLMN list(see EF_SPDI).
+ * B2 = 0: display of the service provider name is required when registered PLMN is neither
+ * HPLMN nor a PLMN in the service provider PLMN list(see EF_SPDI).
+ * B2 = 1: display of the service provider name is not required when registered PLMN is neither
+ * HPLMN nor a PLMN in the service provider PLMN list(see EF_SPDI).
+ *
+ * Reference: 3GPP TS 31.102 v15.2.0 Section 4.2.12 EF_SPN.
+ * @hide
+ */
+ public static final String KEY_SPN_DISPLAY_CONDITION_OVERRIDE_INT =
+ "spn_display_condition_override_int";
+
+ /**
+ * Override the SPDI - an array of PLMN(MCC + MNC) strings.
+ *
+ * Reference: 3GPP TS 31.102 v15.2.0 Section 4.2.66 EF_SPDI.
+ * @hide
+ */
+ public static final String KEY_SPDI_OVERRIDE_STRING_ARRAY = "spdi_override_string_array";
+
+ /**
+ * Override the EHPLMNs - an array of PLMN(MCC + MNC) strings.
+ *
+ * To allow provision for multiple HPLMN codes, PLMN codes that are present within this list
+ * shall replace the HPLMN code derived from the IMSI for PLMN selection purposes.
+ *
+ * Reference: 3GPP TS 31.102 v15.2.0 Section 4.2.84 EF_EHPLMN
+ * Reference: 3GPP TS 23.122 v15.6.0 Section 1.2 Equivalent HPLMN list
+ * @hide
+ */
+ public static final String KEY_EHPLMN_OVERRIDE_STRING_ARRAY = "ehplmn_override_string_array";
+
+ /**
+ * Override the PNN - a string array of comma-separated alpha long and short names:
+ * "alpha_long1, alpha_short1".
+ *
+ * Reference: 3GPP TS 31.102 v15.2.0 Section 4.2.58 EF_PNN.
+ * @hide
+ */
+ public static final String KEY_PNN_OVERRIDE_STRING_ARRAY = "pnn_override_string_array";
+
+ /**
+ * A string array of OPL records, each with comma-delimited data fields as follows:
+ * "plmn1,lactac_start,lactac_end,index".
+ *
+ * Reference: 3GPP TS 31.102 v15.2.0 Section 4.2.59 EF_OPL.
+ * @hide
+ */
+ public static final String KEY_OPL_OVERRIDE_STRING_ARRAY = "opl_override_opl_string_array";
+
+ /**
+ * Allow ERI rules to select a carrier name display string when using 3gpp2 access technologies.
+ *
+ * @hide
+ */
+ public static final String KEY_ALLOW_ERI_BOOL = "allow_cdma_eri_bool";
+
+ /**
+ * If true, use the carrier display name(SPN and PLMN) from the carrier display name resolver.
+ *
+ * @hide
+ */
+ public static final String KEY_ENABLE_CARRIER_DISPLAY_NAME_RESOLVER_BOOL =
+ "enable_carrier_display_name_resolver_bool";
+
+ /**
* String to override sim country iso.
* Sim country iso is based on sim MCC which is coarse and doesn't work with dual IMSI SIM where
* a SIM can have multiple MCC from different countries.
@@ -3023,6 +3097,13 @@
sDefaults.putBoolean(KEY_CONFIG_WIFI_DISABLE_IN_ECBM, false);
sDefaults.putBoolean(KEY_CARRIER_NAME_OVERRIDE_BOOL, false);
sDefaults.putString(KEY_CARRIER_NAME_STRING, "");
+ sDefaults.putInt(KEY_SPN_DISPLAY_CONDITION_OVERRIDE_INT, -1);
+ sDefaults.putStringArray(KEY_SPDI_OVERRIDE_STRING_ARRAY, null);
+ sDefaults.putStringArray(KEY_PNN_OVERRIDE_STRING_ARRAY, null);
+ sDefaults.putStringArray(KEY_OPL_OVERRIDE_STRING_ARRAY, null);
+ sDefaults.putStringArray(KEY_EHPLMN_OVERRIDE_STRING_ARRAY, null);
+ sDefaults.putBoolean(KEY_ALLOW_ERI_BOOL, false);
+ sDefaults.putBoolean(KEY_ENABLE_CARRIER_DISPLAY_NAME_RESOLVER_BOOL, false);
sDefaults.putString(KEY_SIM_COUNTRY_ISO_OVERRIDE_STRING, "");
sDefaults.putString(KEY_CARRIER_CALL_SCREENING_APP_STRING, "");
sDefaults.putString(KEY_CALL_REDIRECTION_SERVICE_COMPONENT_NAME_STRING, null);
diff --git a/telephony/java/android/telephony/CellSignalStrengthLte.java b/telephony/java/android/telephony/CellSignalStrengthLte.java
index 2272dc9..8336d1b 100644
--- a/telephony/java/android/telephony/CellSignalStrengthLte.java
+++ b/telephony/java/android/telephony/CellSignalStrengthLte.java
@@ -58,15 +58,15 @@
@UnsupportedAppUsage(maxTargetSdk = android.os.Build.VERSION_CODES.P)
private int mSignalStrength; // To be removed
private int mRssi;
- @UnsupportedAppUsage(maxTargetSdk = android.os.Build.VERSION_CODES.O)
+ @UnsupportedAppUsage(maxTargetSdk = android.os.Build.VERSION_CODES.P)
private int mRsrp;
- @UnsupportedAppUsage(maxTargetSdk = android.os.Build.VERSION_CODES.O)
+ @UnsupportedAppUsage(maxTargetSdk = android.os.Build.VERSION_CODES.P)
private int mRsrq;
- @UnsupportedAppUsage(maxTargetSdk = android.os.Build.VERSION_CODES.O)
+ @UnsupportedAppUsage(maxTargetSdk = android.os.Build.VERSION_CODES.P)
private int mRssnr;
- @UnsupportedAppUsage(maxTargetSdk = android.os.Build.VERSION_CODES.O)
+ @UnsupportedAppUsage(maxTargetSdk = android.os.Build.VERSION_CODES.P)
private int mCqi;
- @UnsupportedAppUsage(maxTargetSdk = android.os.Build.VERSION_CODES.O)
+ @UnsupportedAppUsage(maxTargetSdk = android.os.Build.VERSION_CODES.P)
private int mTimingAdvance;
private int mLevel;
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index d4f9874..32105ad 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -2064,7 +2064,6 @@
} else {
logd("putPhoneIdAndSubIdExtra: no valid subs");
intent.putExtra(PhoneConstants.PHONE_KEY, phoneId);
- intent.putExtra(PhoneConstants.SLOT_KEY, phoneId);
}
}
@@ -2075,9 +2074,6 @@
intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
intent.putExtra(EXTRA_SUBSCRIPTION_INDEX, subId);
intent.putExtra(PhoneConstants.PHONE_KEY, phoneId);
- //FIXME this is using phoneId and slotIndex interchangeably
- //Eventually, this should be removed as it is not the slot id
- intent.putExtra(PhoneConstants.SLOT_KEY, phoneId);
}
/**
diff --git a/telephony/java/android/telephony/emergency/EmergencyNumber.java b/telephony/java/android/telephony/emergency/EmergencyNumber.java
index fa6cfcb..22f078f 100644
--- a/telephony/java/android/telephony/emergency/EmergencyNumber.java
+++ b/telephony/java/android/telephony/emergency/EmergencyNumber.java
@@ -635,7 +635,7 @@
!= second.getEmergencyServiceCategoryBitmask()) {
return false;
}
- if (first.getEmergencyUrns().equals(second.getEmergencyUrns())) {
+ if (!first.getEmergencyUrns().equals(second.getEmergencyUrns())) {
return false;
}
if (first.getEmergencyCallRouting() != second.getEmergencyCallRouting()) {
diff --git a/tests/net/Android.bp b/tests/net/Android.bp
index 3ff862c..689abed 100644
--- a/tests/net/Android.bp
+++ b/tests/net/Android.bp
@@ -49,7 +49,6 @@
"libselinux",
"libui",
"libutils",
- "libvintf",
"libvndksupport",
"libtinyxml2",
"libunwindstack",
diff --git a/tests/net/java/com/android/server/LegacyTypeTrackerTest.kt b/tests/net/java/com/android/server/LegacyTypeTrackerTest.kt
index d983b65..f045369 100644
--- a/tests/net/java/com/android/server/LegacyTypeTrackerTest.kt
+++ b/tests/net/java/com/android/server/LegacyTypeTrackerTest.kt
@@ -20,6 +20,8 @@
import android.net.ConnectivityManager.TYPE_MOBILE
import android.net.ConnectivityManager.TYPE_WIFI
import android.net.ConnectivityManager.TYPE_WIMAX
+import android.net.NetworkInfo.DetailedState.CONNECTED
+import android.net.NetworkInfo.DetailedState.DISCONNECTED
import androidx.test.filters.SmallTest
import androidx.test.runner.AndroidJUnit4
import com.android.server.ConnectivityService.LegacyTypeTracker
@@ -32,8 +34,12 @@
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers.any
+import org.mockito.ArgumentMatchers.anyInt
import org.mockito.Mockito.doReturn
import org.mockito.Mockito.mock
+import org.mockito.Mockito.never
+import org.mockito.Mockito.reset
+import org.mockito.Mockito.verify
const val UNSUPPORTED_TYPE = TYPE_WIMAX
@@ -89,4 +95,20 @@
mTracker.add(UNSUPPORTED_TYPE, mobileNai)
assertNull(mTracker.getNetworkForType(UNSUPPORTED_TYPE))
}
+
+ @Test
+ fun testBroadcastOnDisconnect() {
+ val mobileNai1 = mock(NetworkAgentInfo::class.java)
+ val mobileNai2 = mock(NetworkAgentInfo::class.java)
+ doReturn(false).`when`(mMockService).isDefaultNetwork(mobileNai1)
+ mTracker.add(TYPE_MOBILE, mobileNai1)
+ verify(mMockService).sendLegacyNetworkBroadcast(mobileNai1, CONNECTED, TYPE_MOBILE)
+ reset(mMockService)
+ doReturn(false).`when`(mMockService).isDefaultNetwork(mobileNai2)
+ mTracker.add(TYPE_MOBILE, mobileNai2)
+ verify(mMockService, never()).sendLegacyNetworkBroadcast(any(), any(), anyInt())
+ mTracker.remove(TYPE_MOBILE, mobileNai1, false /* wasDefault */)
+ verify(mMockService).sendLegacyNetworkBroadcast(mobileNai1, DISCONNECTED, TYPE_MOBILE)
+ verify(mMockService).sendLegacyNetworkBroadcast(mobileNai2, CONNECTED, TYPE_MOBILE)
+ }
}
diff --git a/tests/net/smoketest/Android.bp b/tests/net/smoketest/Android.bp
new file mode 100644
index 0000000..ef1ad2c
--- /dev/null
+++ b/tests/net/smoketest/Android.bp
@@ -0,0 +1,17 @@
+// This test exists only because the jni_libs list for these tests is difficult to
+// maintain: the test itself only depends on libnetworkstatsfactorytestjni, but the test
+// fails to load that library unless *all* the dependencies of that library are explicitly
+// listed in jni_libs. This means that whenever any of the dependencies changes the test
+// starts failing and breaking presubmits in frameworks/base. We cannot easily put
+// FrameworksNetTests into global presubmit because they are at times flaky, but this
+// test is effectively empty beyond validating that the libraries load correctly, and
+// thus should be stable enough to put in global presubmit.
+//
+// TODO: remove this hack when there is a better solution for jni_libs that includes
+// dependent libraries.
+android_test {
+ name: "FrameworksNetSmokeTests",
+ defaults: ["FrameworksNetTests-jni-defaults"],
+ srcs: ["java/SmokeTest.java"],
+ test_suites: ["device-tests"],
+}
diff --git a/tests/net/smoketest/AndroidManifest.xml b/tests/net/smoketest/AndroidManifest.xml
new file mode 100644
index 0000000..f1b9feb
--- /dev/null
+++ b/tests/net/smoketest/AndroidManifest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.frameworks.tests.net.smoketest">
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="com.android.frameworks.tests.net.smoketest"
+ android:label="Frameworks Networking Smoke Tests" />
+</manifest>
diff --git a/tests/net/smoketest/AndroidTest.xml b/tests/net/smoketest/AndroidTest.xml
new file mode 100644
index 0000000..ac366e4
--- /dev/null
+++ b/tests/net/smoketest/AndroidTest.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Runs Frameworks Networking Smoke Tests.">
+ <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
+ <option name="test-file-name" value="FrameworksNetSmokeTests.apk" />
+ </target_preparer>
+
+ <option name="test-suite-tag" value="apct" />
+ <option name="test-tag" value="FrameworksNetSmokeTests" />
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="com.android.frameworks.tests.net.smoketest" />
+ <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
+ <option name="hidden-api-checks" value="false"/>
+ </test>
+</configuration>
diff --git a/tests/net/smoketest/java/SmokeTest.java b/tests/net/smoketest/java/SmokeTest.java
new file mode 100644
index 0000000..7d6655f
--- /dev/null
+++ b/tests/net/smoketest/java/SmokeTest.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.net;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class SmokeTest {
+
+ @Test
+ public void testLoadJni() {
+ System.loadLibrary("networkstatsfactorytestjni");
+ assertEquals(0, 0x00);
+ }
+}