summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp8
-rw-r--r--core/api/current.txt2
-rw-r--r--core/java/android/accounts/ChooseAccountActivity.java4
-rw-r--r--core/java/android/accounts/ChooseAccountTypeActivity.java4
-rw-r--r--core/java/android/accounts/ChooseTypeAndAccountActivity.java7
-rw-r--r--core/java/android/app/AppOpsManager.java25
-rw-r--r--core/java/android/app/OWNERS20
-rw-r--r--core/java/android/app/admin/OWNERS9
-rw-r--r--core/java/android/app/time/OWNERS3
-rw-r--r--core/java/android/app/timedetector/GnssTimeSuggestion.aidl19
-rw-r--r--core/java/android/app/timedetector/GnssTimeSuggestion.java135
-rw-r--r--core/java/android/app/timedetector/ITimeDetectorService.aidl2
-rw-r--r--core/java/android/app/timedetector/OWNERS2
-rw-r--r--core/java/android/app/timedetector/TimeDetector.java8
-rw-r--r--core/java/android/app/timedetector/TimeDetectorImpl.java12
-rw-r--r--core/java/android/app/timezone/OWNERS5
-rw-r--r--core/java/android/app/timezonedetector/OWNERS3
-rw-r--r--core/java/android/content/pm/PackageManager.java17
-rwxr-xr-xcore/java/android/os/Build.java14
-rw-r--r--core/java/android/os/FileUtils.java4
-rw-r--r--core/java/android/service/voice/VoiceInteractionSession.java7
-rw-r--r--core/java/android/timezone/OWNERS4
-rw-r--r--core/java/com/android/internal/policy/PhoneWindow.java1
-rw-r--r--core/java/com/android/internal/view/OWNERS17
-rw-r--r--core/res/res/values/config.xml7
-rw-r--r--core/res/res/values/symbols.xml2
-rw-r--r--core/tests/coretests/src/android/app/OWNERS1
-rw-r--r--core/tests/coretests/src/android/app/activity/OWNERS1
-rw-r--r--core/tests/coretests/src/android/app/servertransaction/OWNERS1
-rw-r--r--core/tests/coretests/src/android/app/time/OWNERS3
-rw-r--r--core/tests/coretests/src/android/app/timedetector/GnssTimeSuggestionTest.java66
-rw-r--r--core/tests/coretests/src/android/app/timedetector/OWNERS3
-rw-r--r--core/tests/coretests/src/android/app/timezone/OWNERS3
-rw-r--r--core/tests/coretests/src/android/app/timezonedetector/OWNERS3
-rw-r--r--core/tests/coretests/src/android/content/OWNERS1
-rw-r--r--core/tests/mockingcoretests/src/android/app/activity/OWNERS1
-rw-r--r--packages/Connectivity/OWNERS3
-rw-r--r--packages/SettingsProvider/res/values/defaults.xml2
-rw-r--r--packages/SystemUI/AndroidManifest.xml1
-rw-r--r--packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java2
-rw-r--r--services/core/java/com/android/server/DropBoxManagerService.java2
-rw-r--r--services/core/java/com/android/server/StorageManagerService.java27
-rw-r--r--services/core/java/com/android/server/pm/AppsFilter.java2
-rw-r--r--services/core/java/com/android/server/pm/OtaDexoptService.java6
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java22
-rw-r--r--services/core/java/com/android/server/pm/Settings.java1
-rw-r--r--services/core/java/com/android/server/pm/ShortcutService.java4
-rw-r--r--services/core/java/com/android/server/policy/DisplayFoldController.java69
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java73
-rw-r--r--services/core/java/com/android/server/power/batterysaver/BatterySaverPolicy.java3
-rw-r--r--services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java2
-rw-r--r--services/core/java/com/android/server/stats/pull/StatsPullAtomService.java4
-rw-r--r--services/core/java/com/android/server/timedetector/OWNERS4
-rw-r--r--services/core/java/com/android/server/timedetector/TimeDetectorService.java15
-rw-r--r--services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java14
-rw-r--r--services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java71
-rw-r--r--services/core/java/com/android/server/timezone/OWNERS4
-rw-r--r--services/core/java/com/android/server/timezonedetector/OWNERS4
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskManagerService.java4
-rw-r--r--services/core/xsd/device-state-config/OWNERS1
-rw-r--r--services/java/com/android/server/SystemServer.java8
-rw-r--r--services/tests/servicestests/src/com/android/server/timedetector/OWNERS4
-rw-r--r--services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorServiceTest.java47
-rw-r--r--services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorStrategyImplTest.java248
-rw-r--r--services/tests/servicestests/src/com/android/server/timezone/OWNERS4
-rw-r--r--services/tests/servicestests/src/com/android/server/timezonedetector/OWNERS4
-rw-r--r--services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java1
-rw-r--r--test-mock/src/android/test/mock/OWNERS1
-rw-r--r--wifi/Android.bp4
-rw-r--r--wifi/jarjar-rules.txt2
-rw-r--r--wifi/java/android/net/wifi/IWifiManager.aidl4
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java2
74 files changed, 924 insertions, 174 deletions
diff --git a/Android.bp b/Android.bp
index b1eb4a5ff247..598f4fcaf620 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1335,8 +1335,6 @@ java_library {
sdk_version: "module_current",
min_sdk_version: "30",
srcs: [
- "core/java/android/content/pm/BaseParceledListSlice.java",
- "core/java/android/content/pm/ParceledListSlice.java",
"core/java/android/os/HandlerExecutor.java",
"core/java/com/android/internal/util/AsyncChannel.java",
"core/java/com/android/internal/util/AsyncService.java",
@@ -1355,12 +1353,6 @@ java_library {
],
}
-filegroup {
- name: "framework-wifi-util-lib-aidls",
- srcs: ["core/java/android/content/pm/ParceledListSlice.aidl"],
- path: "core/java",
-}
-
// utility classes statically linked into wifi-service
filegroup {
name: "framework-wifi-service-shared-srcs",
diff --git a/core/api/current.txt b/core/api/current.txt
index e88811569049..92d5298bb6b9 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -12263,6 +12263,7 @@ package android.content.pm {
field public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";
field public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE = "android.hardware.nfc.ese";
field public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_UICC = "android.hardware.nfc.uicc";
+ field public static final String FEATURE_OPENGLES_DEQP_LEVEL = "android.software.opengles.deqp.level";
field public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep";
field public static final String FEATURE_PC = "android.hardware.type.pc";
field public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture";
@@ -29926,6 +29927,7 @@ package android.os {
field public static final String ID;
field public static final String MANUFACTURER;
field public static final String MODEL;
+ field @NonNull public static final String ODM_SKU;
field public static final String PRODUCT;
field @Deprecated public static final String RADIO;
field @Deprecated public static final String SERIAL;
diff --git a/core/java/android/accounts/ChooseAccountActivity.java b/core/java/android/accounts/ChooseAccountActivity.java
index b27d9cda9f97..bc7f4d681e27 100644
--- a/core/java/android/accounts/ChooseAccountActivity.java
+++ b/core/java/android/accounts/ChooseAccountActivity.java
@@ -33,6 +33,7 @@ import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
+
import com.android.internal.R;
import java.util.HashMap;
@@ -56,6 +57,9 @@ public class ChooseAccountActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ getWindow().addSystemFlags(
+ android.view.WindowManager.LayoutParams
+ .SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
mAccounts = getIntent().getParcelableArrayExtra(AccountManager.KEY_ACCOUNTS);
mAccountManagerResponse =
getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_MANAGER_RESPONSE);
diff --git a/core/java/android/accounts/ChooseAccountTypeActivity.java b/core/java/android/accounts/ChooseAccountTypeActivity.java
index e3352bc85668..63e005fbcfe7 100644
--- a/core/java/android/accounts/ChooseAccountTypeActivity.java
+++ b/core/java/android/accounts/ChooseAccountTypeActivity.java
@@ -31,6 +31,7 @@ import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
+
import com.android.internal.R;
import java.util.ArrayList;
@@ -51,6 +52,9 @@ public class ChooseAccountTypeActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ getWindow().addSystemFlags(
+ android.view.WindowManager.LayoutParams
+ .SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "ChooseAccountTypeActivity.onCreate(savedInstanceState="
diff --git a/core/java/android/accounts/ChooseTypeAndAccountActivity.java b/core/java/android/accounts/ChooseTypeAndAccountActivity.java
index a2464d54f780..2be88ab60a1e 100644
--- a/core/java/android/accounts/ChooseTypeAndAccountActivity.java
+++ b/core/java/android/accounts/ChooseTypeAndAccountActivity.java
@@ -15,8 +15,6 @@
*/
package android.accounts;
-import com.google.android.collect.Sets;
-
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
@@ -35,6 +33,8 @@ import android.widget.TextView;
import com.android.internal.R;
+import com.google.android.collect.Sets;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
@@ -139,6 +139,9 @@ public class ChooseTypeAndAccountActivity extends Activity
Log.v(TAG, "ChooseTypeAndAccountActivity.onCreate(savedInstanceState="
+ savedInstanceState + ")");
}
+ getWindow().addSystemFlags(
+ android.view.WindowManager.LayoutParams
+ .SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
mCallingUid = getLaunchedFromUid();
mCallingPackage = getLaunchedFromPackage();
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index 1009f6625bcc..20953c6f6637 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -1169,9 +1169,18 @@ public class AppOpsManager {
public static final int OP_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER =
AppProtoEnums.APP_OP_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER;
+ /**
+ * App output audio is being recorded
+ *
+ * @hide
+ */
+ // TODO: Add as AppProtoEnums
+ public static final int OP_RECORD_AUDIO_OUTPUT = 106;
+
+
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- public static final int _NUM_OP = 106;
+ public static final int _NUM_OP = 107;
/** Access to coarse location information. */
public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -1537,6 +1546,12 @@ public class AppOpsManager {
@TestApi
public static final String OPSTR_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER =
"android:use_icc_auth_with_device_identifier";
+ /**
+ * App output audio is being recorded
+ *
+ * @hide
+ */
+ public static final String OPSTR_RECORD_AUDIO_OUTPUT = "android:record_audio_output";
/** {@link #sAppOpsToNote} not initialized yet for this op */
private static final byte SHOULD_COLLECT_NOTE_OP_NOT_INITIALIZED = 0;
@@ -1735,6 +1750,7 @@ public class AppOpsManager {
OP_MANAGE_ONGOING_CALLS, // MANAGE_ONGOING_CALLS
OP_MANAGE_CREDENTIALS, // MANAGE_CREDENTIALS
OP_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER, // USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER
+ OP_RECORD_AUDIO_OUTPUT, // RECORD_AUDIO_OUTPUT
};
/**
@@ -1847,6 +1863,7 @@ public class AppOpsManager {
OPSTR_MANAGE_ONGOING_CALLS,
OPSTR_MANAGE_CREDENTIALS,
OPSTR_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER,
+ OPSTR_RECORD_AUDIO_OUTPUT,
};
/**
@@ -1960,6 +1977,7 @@ public class AppOpsManager {
"MANAGE_ONGOING_CALLS",
"MANAGE_CREDENTIALS",
"USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER",
+ "RECORD_AUDIO_OUTPUT",
};
/**
@@ -2074,6 +2092,7 @@ public class AppOpsManager {
Manifest.permission.MANAGE_ONGOING_CALLS,
null, // no permission for OP_MANAGE_CREDENTIALS
Manifest.permission.USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER,
+ null, // no permission for OP_RECORD_AUDIO_OUTPUT
};
/**
@@ -2188,6 +2207,7 @@ public class AppOpsManager {
null, // MANAGE_ONGOING_CALLS
null, // MANAGE_CREDENTIALS
null, // USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER
+ null, // RECORD_AUDIO_OUTPUT
};
/**
@@ -2301,6 +2321,7 @@ public class AppOpsManager {
null, // MANAGE_ONGOING_CALLS
null, // MANAGE_CREDENTIALS
null, // USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER
+ null, // RECORD_AUDIO_OUTPUT
};
/**
@@ -2413,6 +2434,7 @@ public class AppOpsManager {
AppOpsManager.MODE_DEFAULT, // MANAGE_ONGOING_CALLS
AppOpsManager.MODE_DEFAULT, // MANAGE_CREDENTIALS
AppOpsManager.MODE_DEFAULT, // USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER
+ AppOpsManager.MODE_ALLOWED, // RECORD_AUDIO_OUTPUT
};
/**
@@ -2529,6 +2551,7 @@ public class AppOpsManager {
true, // MANAGE_ONGOING_CALLS
false, // MANAGE_CREDENTIALS
true, // USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER
+ false, // RECORD_AUDIO_OUTPUT
};
/**
diff --git a/core/java/android/app/OWNERS b/core/java/android/app/OWNERS
index abdd537a9a26..06ad9c99c301 100644
--- a/core/java/android/app/OWNERS
+++ b/core/java/android/app/OWNERS
@@ -15,22 +15,18 @@ per-file *AppOp* = file:/core/java/android/permission/OWNERS
# Notification
per-file *Notification* = file:/packages/SystemUI/OWNERS
-#Wallpaper
-per-file Wallpaper*.java = file:/core/java/android/service/wallpaper/OWNERS
-per-file IWallpaper*.aidl = file:/core/java/android/service/wallpaper/OWNERS
+# ResourcesManager
+per-file ResourcesManager = rtmitchell@google.com, toddke@google.com
+
+# Wallpaper
+per-file *Wallpaper* = file:/core/java/android/service/wallpaper/OWNERS
# WindowManager
-per-file Activity*.aidl = file:/services/core/java/com/android/server/wm/OWNERS
-per-file Activity*.java = file:/services/core/java/com/android/server/wm/OWNERS
+per-file *Activity* = file:/services/core/java/com/android/server/wm/OWNERS
per-file ClientTransactionHandler.java = file:/services/core/java/com/android/server/wm/OWNERS
per-file Fragment.java = file:/services/core/java/com/android/server/wm/OWNERS
-per-file IActivity*.aidl = file:/services/core/java/com/android/server/wm/OWNERS
-per-file IAppTask.aidl = file:/services/core/java/com/android/server/wm/OWNERS
-per-file ITaskStackListener.aidl = file:/services/core/java/com/android/server/wm/OWNERS
-per-file LocalActivityManager.java = file:/services/core/java/com/android/server/wm/OWNERS
-per-file Task*.java = file:/services/core/java/com/android/server/wm/OWNERS
-per-file Window*.aidl = file:/services/core/java/com/android/server/wm/OWNERS
-per-file Window*.java = file:/services/core/java/com/android/server/wm/OWNERS
+per-file *Task* = file:/services/core/java/com/android/server/wm/OWNERS
+per-file Window* = file:/services/core/java/com/android/server/wm/OWNERS
# TODO(b/174932174): determine the ownership of KeyguardManager.java
diff --git a/core/java/android/app/admin/OWNERS b/core/java/android/app/admin/OWNERS
index 64a1d27d4cf7..8462cbe7497b 100644
--- a/core/java/android/app/admin/OWNERS
+++ b/core/java/android/app/admin/OWNERS
@@ -1,4 +1,11 @@
# Bug component: 142675
-yamasani@google.com
+# Android Enterprise team
rubinxu@google.com
+sandness@google.com
+eranm@google.com
+alexkershaw@google.com
+pgrafov@google.com
+
+# Emeritus
+yamasani@google.com
diff --git a/core/java/android/app/time/OWNERS b/core/java/android/app/time/OWNERS
new file mode 100644
index 000000000000..8f8089717e3b
--- /dev/null
+++ b/core/java/android/app/time/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 847766
+mingaleev@google.com
+include /core/java/android/app/timedetector/OWNERS
diff --git a/core/java/android/app/timedetector/GnssTimeSuggestion.aidl b/core/java/android/app/timedetector/GnssTimeSuggestion.aidl
new file mode 100644
index 000000000000..81475ec8156d
--- /dev/null
+++ b/core/java/android/app/timedetector/GnssTimeSuggestion.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2020 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.app.timedetector;
+
+parcelable GnssTimeSuggestion;
diff --git a/core/java/android/app/timedetector/GnssTimeSuggestion.java b/core/java/android/app/timedetector/GnssTimeSuggestion.java
new file mode 100644
index 000000000000..6478a2dd2aa9
--- /dev/null
+++ b/core/java/android/app/timedetector/GnssTimeSuggestion.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2020 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.app.timedetector;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.os.TimestampedValue;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * A time signal from a GNSS source.
+ *
+ * <p>{@code utcTime} is the suggested time. The {@code utcTime.value} is the number of milliseconds
+ * elapsed since 1/1/1970 00:00:00 UTC. The {@code utcTime.referenceTimeMillis} is the value of the
+ * elapsed realtime clock when the {@code utcTime.value} was established.
+ * Note that the elapsed realtime clock is considered accurate but it is volatile, so time
+ * suggestions cannot be persisted across device resets.
+ *
+ * <p>{@code debugInfo} contains debugging metadata associated with the suggestion. This is used to
+ * record why the suggestion exists and how it was entered. This information exists only to aid in
+ * debugging and therefore is used by {@link #toString()}, but it is not for use in detection
+ * logic and is not considered in {@link #hashCode()} or {@link #equals(Object)}.
+ *
+ * @hide
+ */
+public final class GnssTimeSuggestion implements Parcelable {
+
+ public static final @NonNull Creator<GnssTimeSuggestion> CREATOR =
+ new Creator<GnssTimeSuggestion>() {
+ public GnssTimeSuggestion createFromParcel(Parcel in) {
+ return GnssTimeSuggestion.createFromParcel(in);
+ }
+
+ public GnssTimeSuggestion[] newArray(int size) {
+ return new GnssTimeSuggestion[size];
+ }
+ };
+
+ @NonNull private final TimestampedValue<Long> mUtcTime;
+ @Nullable private ArrayList<String> mDebugInfo;
+
+ public GnssTimeSuggestion(@NonNull TimestampedValue<Long> utcTime) {
+ mUtcTime = Objects.requireNonNull(utcTime);
+ Objects.requireNonNull(utcTime.getValue());
+ }
+
+ private static GnssTimeSuggestion createFromParcel(Parcel in) {
+ TimestampedValue<Long> utcTime = in.readParcelable(null /* classLoader */);
+ GnssTimeSuggestion suggestion = new GnssTimeSuggestion(utcTime);
+ @SuppressWarnings("unchecked")
+ ArrayList<String> debugInfo = (ArrayList<String>) in.readArrayList(null /* classLoader */);
+ suggestion.mDebugInfo = debugInfo;
+ return suggestion;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ dest.writeParcelable(mUtcTime, 0);
+ dest.writeList(mDebugInfo);
+ }
+
+ @NonNull
+ public TimestampedValue<Long> getUtcTime() {
+ return mUtcTime;
+ }
+
+ @NonNull
+ public List<String> getDebugInfo() {
+ return mDebugInfo == null
+ ? Collections.emptyList() : Collections.unmodifiableList(mDebugInfo);
+ }
+
+ /**
+ * Associates information with the instance that can be useful for debugging / logging. The
+ * information is present in {@link #toString()} but is not considered for
+ * {@link #equals(Object)} and {@link #hashCode()}.
+ */
+ public void addDebugInfo(String... debugInfos) {
+ if (mDebugInfo == null) {
+ mDebugInfo = new ArrayList<>();
+ }
+ mDebugInfo.addAll(Arrays.asList(debugInfos));
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GnssTimeSuggestion that = (GnssTimeSuggestion) o;
+ return Objects.equals(mUtcTime, that.mUtcTime);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mUtcTime);
+ }
+
+ @Override
+ public String toString() {
+ return "GnssTimeSuggestion{"
+ + "mUtcTime=" + mUtcTime
+ + ", mDebugInfo=" + mDebugInfo
+ + '}';
+ }
+}
diff --git a/core/java/android/app/timedetector/ITimeDetectorService.aidl b/core/java/android/app/timedetector/ITimeDetectorService.aidl
index 7bea5d7d60b1..87e72332274e 100644
--- a/core/java/android/app/timedetector/ITimeDetectorService.aidl
+++ b/core/java/android/app/timedetector/ITimeDetectorService.aidl
@@ -16,6 +16,7 @@
package android.app.timedetector;
+import android.app.timedetector.GnssTimeSuggestion;
import android.app.timedetector.ManualTimeSuggestion;
import android.app.timedetector.NetworkTimeSuggestion;
import android.app.timedetector.TelephonyTimeSuggestion;
@@ -34,6 +35,7 @@ import android.app.timedetector.TelephonyTimeSuggestion;
* {@hide}
*/
interface ITimeDetectorService {
+ void suggestGnssTime(in GnssTimeSuggestion timeSuggestion);
boolean suggestManualTime(in ManualTimeSuggestion timeSuggestion);
void suggestNetworkTime(in NetworkTimeSuggestion timeSuggestion);
void suggestTelephonyTime(in TelephonyTimeSuggestion timeSuggestion);
diff --git a/core/java/android/app/timedetector/OWNERS b/core/java/android/app/timedetector/OWNERS
index 8c113246b5d4..941eed8de631 100644
--- a/core/java/android/app/timedetector/OWNERS
+++ b/core/java/android/app/timedetector/OWNERS
@@ -1,4 +1,4 @@
# Bug component: 847766
-
+mingaleev@google.com
narayan@google.com
nfuller@google.com
diff --git a/core/java/android/app/timedetector/TimeDetector.java b/core/java/android/app/timedetector/TimeDetector.java
index 162e18215cae..52016b65688b 100644
--- a/core/java/android/app/timedetector/TimeDetector.java
+++ b/core/java/android/app/timedetector/TimeDetector.java
@@ -71,4 +71,12 @@ public interface TimeDetector {
*/
@RequiresPermission(android.Manifest.permission.SET_TIME)
void suggestNetworkTime(NetworkTimeSuggestion timeSuggestion);
+
+ /**
+ * Suggests the time according to a gnss time source.
+ *
+ * @hide
+ */
+ @RequiresPermission(android.Manifest.permission.SET_TIME)
+ void suggestGnssTime(GnssTimeSuggestion timeSuggestion);
}
diff --git a/core/java/android/app/timedetector/TimeDetectorImpl.java b/core/java/android/app/timedetector/TimeDetectorImpl.java
index ac02c8930982..b0aa3c8d4575 100644
--- a/core/java/android/app/timedetector/TimeDetectorImpl.java
+++ b/core/java/android/app/timedetector/TimeDetectorImpl.java
@@ -74,4 +74,16 @@ public final class TimeDetectorImpl implements TimeDetector {
throw e.rethrowFromSystemServer();
}
}
+
+ @Override
+ public void suggestGnssTime(GnssTimeSuggestion timeSuggestion) {
+ if (DEBUG) {
+ Log.d(TAG, "suggestGnssTime called: " + timeSuggestion);
+ }
+ try {
+ mITimeDetectorService.suggestGnssTime(timeSuggestion);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
}
diff --git a/core/java/android/app/timezone/OWNERS b/core/java/android/app/timezone/OWNERS
index 8c113246b5d4..8f8089717e3b 100644
--- a/core/java/android/app/timezone/OWNERS
+++ b/core/java/android/app/timezone/OWNERS
@@ -1,4 +1,3 @@
# Bug component: 847766
-
-narayan@google.com
-nfuller@google.com
+mingaleev@google.com
+include /core/java/android/app/timedetector/OWNERS
diff --git a/core/java/android/app/timezonedetector/OWNERS b/core/java/android/app/timezonedetector/OWNERS
new file mode 100644
index 000000000000..8f8089717e3b
--- /dev/null
+++ b/core/java/android/app/timezonedetector/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 847766
+mingaleev@google.com
+include /core/java/android/app/timedetector/OWNERS
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 67a1ad676348..bd270997ead0 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -2682,6 +2682,23 @@ public abstract class PackageManager {
/**
* Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature(String, int)}: If this feature is supported, the feature version
+ * specifies a date such that the device is known to pass the OpenGLES dEQP test suite
+ * associated with that date. The date is encoded as follows:
+ * <ul>
+ * <li>Year in bits 31-16</li>
+ * <li>Month in bits 15-8</li>
+ * <li>Day in bits 7-0</li>
+ * </ul>
+ * <p>
+ * Example: 2021-03-01 is encoded as 0x07E50301, and would indicate that the device passes the
+ * OpenGL ES dEQP test suite version that was current on 2021-03-01.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_OPENGLES_DEQP_LEVEL = "android.software.opengles.deqp.level";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device includes broadcast radio tuner.
* @hide
*/
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index bd18150da201..8148c457ec99 100755
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -107,12 +107,24 @@ public class Build {
public static final String HARDWARE = getString("ro.hardware");
/**
- * The hardware variant (SKU), if available.
+ * The SKU of the hardware (from the kernel command line). The SKU is reported by the bootloader
+ * to configure system software features.
*/
@NonNull
public static final String SKU = getString("ro.boot.hardware.sku");
/**
+ * The SKU of the device as set by the original design manufacturer (ODM). This is a
+ * runtime-initialized property set during startup to configure device services.
+ *
+ * <p>The ODM SKU may have multiple variants for the same system SKU in case a manufacturer
+ * produces variants of the same design. For example, the same build may be released with
+ * variations in physical keyboard and/or display hardware, each with a different ODM SKU.
+ */
+ @NonNull
+ public static final String ODM_SKU = getString("ro.boot.product.hardware.sku");
+
+ /**
* Whether this build was for an emulator device.
* @hide
*/
diff --git a/core/java/android/os/FileUtils.java b/core/java/android/os/FileUtils.java
index 379d6e6f5dfe..92fe98ca1044 100644
--- a/core/java/android/os/FileUtils.java
+++ b/core/java/android/os/FileUtils.java
@@ -1436,9 +1436,7 @@ public final class FileUtils {
public static FileDescriptor convertToModernFd(FileDescriptor fd) {
try {
Context context = AppGlobals.getInitialApplication();
- // TODO(b/169327180): Consider device config.
- if (!SystemProperties.getBoolean("persist.sys.fuse.transcode_enabled", false)
- || !SystemProperties.getBoolean("persist.sys.fuse.transcode_optimize", true)
+ if (!SystemProperties.getBoolean("sys.fuse.transcode_enabled", false)
|| UserHandle.getAppId(Process.myUid()) == getMediaProviderAppId(context)) {
// If transcode is enabled we optimize by default, unless explicitly disabled.
// Never convert modern fd for MediaProvider, because this requires
diff --git a/core/java/android/service/voice/VoiceInteractionSession.java b/core/java/android/service/voice/VoiceInteractionSession.java
index 0b6d371d8235..c1b66c7b446e 100644
--- a/core/java/android/service/voice/VoiceInteractionSession.java
+++ b/core/java/android/service/voice/VoiceInteractionSession.java
@@ -1220,7 +1220,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
* your UI, which will eventually culminate in {@link #onShow}. This is similar to calling
* {@link VoiceInteractionService#showSession VoiceInteractionService.showSession}.
* @param args Arbitrary arguments that will be propagated {@link #onShow}.
- * @param flags Indicates additional optional behavior that should be performed. May
+ * @param flags Indicates additional optional behavior that should be performed. May
* be any combination of
* {@link VoiceInteractionSession#SHOW_WITH_ASSIST VoiceInteractionSession.SHOW_WITH_ASSIST} and
* {@link VoiceInteractionSession#SHOW_WITH_SCREENSHOT
@@ -1583,6 +1583,11 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
*
* @param args The arguments that were supplied to
* {@link VoiceInteractionService#showSession VoiceInteractionService.showSession}.
+ * Some example keys include : "invocation_type", "invocation_phone_state",
+ * "invocation_time_ms", Intent.EXTRA_TIME ("android.intent.extra.TIME") indicating timing
+ * in milliseconds of the KeyEvent that triggered Assistant and
+ * Intent.EXTRA_ASSIST_INPUT_DEVICE_ID (android.intent.extra.ASSIST_INPUT_DEVICE_ID)
+ * referring to the device that sent the request.
* @param showFlags The show flags originally provided to
* {@link VoiceInteractionService#showSession VoiceInteractionService.showSession}.
*/
diff --git a/core/java/android/timezone/OWNERS b/core/java/android/timezone/OWNERS
index 09447a971bdd..8f8089717e3b 100644
--- a/core/java/android/timezone/OWNERS
+++ b/core/java/android/timezone/OWNERS
@@ -1 +1,3 @@
-include /core/java/android/app/timezone/OWNERS
+# Bug component: 847766
+mingaleev@google.com
+include /core/java/android/app/timedetector/OWNERS
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index f89e52d4f91d..141dc79f4c93 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -3140,6 +3140,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
// On TVs, if the app doesn't implement search, we want to launch assist.
Bundle args = new Bundle();
args.putInt(Intent.EXTRA_ASSIST_INPUT_DEVICE_ID, event.getDeviceId());
+ args.putLong(Intent.EXTRA_TIME, event.getEventTime());
((SearchManager) getContext().getSystemService(Context.SEARCH_SERVICE))
.launchAssist(args);
return true;
diff --git a/core/java/com/android/internal/view/OWNERS b/core/java/com/android/internal/view/OWNERS
index 99a76861c542..851d1f37522a 100644
--- a/core/java/com/android/internal/view/OWNERS
+++ b/core/java/com/android/internal/view/OWNERS
@@ -2,4 +2,19 @@
file:/core/java/android/view/OWNERS
-per-file *Input* = file:/services/core/java/com/android/server/inputmethod/OWNERS \ No newline at end of file
+# Autofill
+per-file IInlineSuggestions*.aidl = file:/core/java/android/service/autofill/OWNERS
+per-file InlineSuggestions*.java = file:/core/java/android/service/autofill/OWNERS
+
+# Ime
+per-file *Input* = file:/services/core/java/com/android/server/inputmethod/OWNERS
+
+# Surface
+per-file *Surface* = file:/graphics/java/android/graphics/OWNERS
+per-file *Surface* = file:/services/core/java/com/android/server/wm/OWNERS
+
+# WindowManager
+per-file AppearanceRegion = file:/services/core/java/com/android/server/wm/OWNERS
+per-file BaseIWIndow.java = file:/services/core/java/com/android/server/wm/OWNERS
+per-file RotationPolicy.java = file:/services/core/java/com/android/server/wm/OWNERS
+per-file WindowManagerPolicyThread.java = file:/services/core/java/com/android/server/wm/OWNERS
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index cddb8b5802d0..fab65d05e69f 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -654,10 +654,9 @@
The default is false. -->
<bool name="config_lidControlsSleep">false</bool>
- <!-- Indicate whether closing the lid causes the device to enter the folded state which means
- to get a smaller screen and opening the lid causes the device to enter the unfolded state
- which means to get a larger screen. -->
- <bool name="config_lidControlsDisplayFold">false</bool>
+ <!-- The device state (supplied by DeviceStateManager) that should be treated as folded by the
+ display fold controller. Default is DeviceStateManager.INVALID_DEVICE_STATE. -->
+ <integer name="config_foldedDeviceState">-1</integer>
<!-- Indicate the display area rect for foldable devices in folded state. -->
<string name="config_foldedArea"></string>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index a2556a112941..611808d6c5e7 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3702,7 +3702,7 @@
<java-symbol type="string" name="config_customCountryDetector" />
<!-- For Foldables -->
- <java-symbol type="bool" name="config_lidControlsDisplayFold" />
+ <java-symbol type="integer" name="config_foldedDeviceState" />
<java-symbol type="string" name="config_foldedArea" />
<java-symbol type="array" name="config_disableApksUnlessMatchedSku_apk_list" />
diff --git a/core/tests/coretests/src/android/app/OWNERS b/core/tests/coretests/src/android/app/OWNERS
new file mode 100644
index 000000000000..bd7da0c3f209
--- /dev/null
+++ b/core/tests/coretests/src/android/app/OWNERS
@@ -0,0 +1 @@
+per-file Window*.java = file:/services/core/java/com/android/server/wm/OWNERS
diff --git a/core/tests/coretests/src/android/app/activity/OWNERS b/core/tests/coretests/src/android/app/activity/OWNERS
new file mode 100644
index 000000000000..0862c05e0ee4
--- /dev/null
+++ b/core/tests/coretests/src/android/app/activity/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/core/tests/coretests/src/android/app/servertransaction/OWNERS b/core/tests/coretests/src/android/app/servertransaction/OWNERS
new file mode 100644
index 000000000000..0862c05e0ee4
--- /dev/null
+++ b/core/tests/coretests/src/android/app/servertransaction/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/core/tests/coretests/src/android/app/time/OWNERS b/core/tests/coretests/src/android/app/time/OWNERS
new file mode 100644
index 000000000000..8f8089717e3b
--- /dev/null
+++ b/core/tests/coretests/src/android/app/time/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 847766
+mingaleev@google.com
+include /core/java/android/app/timedetector/OWNERS
diff --git a/core/tests/coretests/src/android/app/timedetector/GnssTimeSuggestionTest.java b/core/tests/coretests/src/android/app/timedetector/GnssTimeSuggestionTest.java
new file mode 100644
index 000000000000..e248010319e1
--- /dev/null
+++ b/core/tests/coretests/src/android/app/timedetector/GnssTimeSuggestionTest.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2020 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.app.timedetector;
+
+import static android.app.timezonedetector.ParcelableTestSupport.assertRoundTripParcelable;
+import static android.app.timezonedetector.ParcelableTestSupport.roundTripParcelable;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import android.os.TimestampedValue;
+
+import org.junit.Test;
+
+public class GnssTimeSuggestionTest {
+
+ private static final TimestampedValue<Long> ARBITRARY_TIME =
+ new TimestampedValue<>(1111L, 2222L);
+
+ @Test
+ public void testEquals() {
+ GnssTimeSuggestion one = new GnssTimeSuggestion(ARBITRARY_TIME);
+ assertEquals(one, one);
+
+ GnssTimeSuggestion two = new GnssTimeSuggestion(ARBITRARY_TIME);
+ assertEquals(one, two);
+ assertEquals(two, one);
+
+ TimestampedValue<Long> differentTime = new TimestampedValue<>(
+ ARBITRARY_TIME.getReferenceTimeMillis() + 1,
+ ARBITRARY_TIME.getValue());
+ GnssTimeSuggestion three = new GnssTimeSuggestion(differentTime);
+ assertNotEquals(one, three);
+ assertNotEquals(three, one);
+
+ // DebugInfo must not be considered in equals().
+ one.addDebugInfo("Debug info 1");
+ two.addDebugInfo("Debug info 2");
+ assertEquals(one, two);
+ }
+
+ @Test
+ public void testParcelable() {
+ GnssTimeSuggestion suggestion = new GnssTimeSuggestion(ARBITRARY_TIME);
+ assertRoundTripParcelable(suggestion);
+
+ // DebugInfo should also be stored (but is not checked by equals()
+ suggestion.addDebugInfo("This is debug info");
+ GnssTimeSuggestion rtSuggestion = roundTripParcelable(suggestion);
+ assertEquals(suggestion.getDebugInfo(), rtSuggestion.getDebugInfo());
+ }
+}
diff --git a/core/tests/coretests/src/android/app/timedetector/OWNERS b/core/tests/coretests/src/android/app/timedetector/OWNERS
new file mode 100644
index 000000000000..8f8089717e3b
--- /dev/null
+++ b/core/tests/coretests/src/android/app/timedetector/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 847766
+mingaleev@google.com
+include /core/java/android/app/timedetector/OWNERS
diff --git a/core/tests/coretests/src/android/app/timezone/OWNERS b/core/tests/coretests/src/android/app/timezone/OWNERS
new file mode 100644
index 000000000000..8f8089717e3b
--- /dev/null
+++ b/core/tests/coretests/src/android/app/timezone/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 847766
+mingaleev@google.com
+include /core/java/android/app/timedetector/OWNERS
diff --git a/core/tests/coretests/src/android/app/timezonedetector/OWNERS b/core/tests/coretests/src/android/app/timezonedetector/OWNERS
new file mode 100644
index 000000000000..8f8089717e3b
--- /dev/null
+++ b/core/tests/coretests/src/android/app/timezonedetector/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 847766
+mingaleev@google.com
+include /core/java/android/app/timedetector/OWNERS
diff --git a/core/tests/coretests/src/android/content/OWNERS b/core/tests/coretests/src/android/content/OWNERS
new file mode 100644
index 000000000000..911efb2562e7
--- /dev/null
+++ b/core/tests/coretests/src/android/content/OWNERS
@@ -0,0 +1 @@
+per-file ContextTest.java = file:/services/core/java/com/android/server/wm/OWNERS
diff --git a/core/tests/mockingcoretests/src/android/app/activity/OWNERS b/core/tests/mockingcoretests/src/android/app/activity/OWNERS
new file mode 100644
index 000000000000..0862c05e0ee4
--- /dev/null
+++ b/core/tests/mockingcoretests/src/android/app/activity/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/packages/Connectivity/OWNERS b/packages/Connectivity/OWNERS
new file mode 100644
index 000000000000..48e54da82cc2
--- /dev/null
+++ b/packages/Connectivity/OWNERS
@@ -0,0 +1,3 @@
+set noparent
+
+include platform/frameworks/base:/services/core/java/com/android/server/net/OWNERS
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml
index 5ad43e3c6008..846efa78decf 100644
--- a/packages/SettingsProvider/res/values/defaults.xml
+++ b/packages/SettingsProvider/res/values/defaults.xml
@@ -180,7 +180,7 @@
<!-- Default state of tap to wake -->
<bool name="def_double_tap_to_wake">true</bool>
- <!-- Default for Settings.Secure.NFC_PAYMENT_COMPONENT -->
+ <!-- Default for Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT -->
<string name="def_nfc_payment_component"></string>
<!-- Default setting for ability to add users from the lock screen -->
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 285c4a172e68..6e7b0b875294 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -103,6 +103,7 @@
<uses-permission android:name="android.permission.START_ACTIVITY_AS_CALLER" />
<uses-permission android:name="android.permission.START_TASKS_FROM_RECENTS" />
<uses-permission android:name="android.permission.GET_INTENT_SENDER_INTENT" />
+ <uses-permission android:name="android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS" />
<!-- WindowManager -->
<uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW" />
diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
index dddd39b17209..bc9500a68a52 100644
--- a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
+++ b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
@@ -21,7 +21,6 @@ import android.app.PendingIntent;
import android.app.people.ConversationChannel;
import android.app.people.IPeopleManager;
import android.app.people.PeopleSpaceTile;
-import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
@@ -120,8 +119,7 @@ public class PeopleSpaceUtils {
e -> e.getValue().getId().equals(shortcutId)).findFirst();
if (!entry.isPresent() || shortcutId == null) {
if (DEBUG) Log.d(TAG, "Matching conversation not found for shortcut ID");
- AppWidgetHost host = new AppWidgetHost(context, 0);
- host.deleteAppWidgetId(appWidgetId);
+ //TODO: Delete app widget id when crash is fixed (b/175486868)
continue;
}
PeopleSpaceTile tile = entry.get().getValue();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
index 01a729235eda..8d3b12868dd7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -1140,6 +1140,7 @@ public class NotificationPanelViewController extends PanelViewController {
if (isFullyCollapsed()) {
expand(true /* animate */);
} else {
+ traceQsJank(true /* startTracing */, false /* wasCancelled */);
flingSettings(0 /* velocity */, FLING_EXPAND);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java
index 5a01f471d0cd..8ed971087508 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java
@@ -862,6 +862,8 @@ public abstract class PanelViewController {
mView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
if (mAnimateAfterExpanding) {
notifyExpandingStarted();
+ InteractionJankMonitor.getInstance().begin(
+ CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE);
fling(0, true /* expand */);
} else {
setExpandedFraction(1f);
diff --git a/services/core/java/com/android/server/DropBoxManagerService.java b/services/core/java/com/android/server/DropBoxManagerService.java
index 886bfb8f4736..30fc3364f6b7 100644
--- a/services/core/java/com/android/server/DropBoxManagerService.java
+++ b/services/core/java/com/android/server/DropBoxManagerService.java
@@ -268,7 +268,7 @@ public final class DropBoxManagerService extends SystemService {
if (!DropBoxManagerService.this.mBooted) {
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
}
- getContext().sendBroadcastAsUser(intent, UserHandle.SYSTEM,
+ getContext().sendBroadcastAsUser(intent, UserHandle.ALL,
android.Manifest.permission.READ_LOGS);
}
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 730c64e6968c..d9ddebdccea6 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -108,6 +108,7 @@ import android.os.storage.StorageManagerInternal;
import android.os.storage.StorageVolume;
import android.os.storage.VolumeInfo;
import android.os.storage.VolumeRecord;
+import android.provider.DeviceConfig;
import android.provider.DocumentsContract;
import android.provider.Downloads;
import android.provider.MediaStore;
@@ -879,6 +880,8 @@ class StorageManagerService extends IStorageManager.Stub
com.android.internal.R.bool.config_zramWriteback)) {
ZramWriteback.scheduleZramWriteback(mContext);
}
+
+ updateTranscodeEnabled();
}
/**
@@ -910,6 +913,21 @@ class StorageManagerService extends IStorageManager.Stub
}
}
+ private void updateTranscodeEnabled() {
+ // See MediaProvider TranscodeHelper#getBooleanProperty for more information
+ boolean transcodeEnabled = false;
+ boolean defaultValue = true;
+
+ if (SystemProperties.getBoolean("persist.sys.fuse.transcode_user_control", false)) {
+ transcodeEnabled = SystemProperties.getBoolean("persist.sys.fuse.transcode_enabled",
+ defaultValue);
+ } else {
+ transcodeEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_STORAGE_NATIVE_BOOT,
+ "transcode_enabled", defaultValue);
+ }
+ SystemProperties.set("sys.fuse.transcode_enabled", String.valueOf(transcodeEnabled));
+ }
+
/**
* MediaProvider has a ton of code that makes assumptions about storage
* paths never changing, so we outright kill them to pick up new state.
@@ -4375,14 +4393,7 @@ class StorageManagerService extends IStorageManager.Stub
// Create package obb and data dir if it doesn't exist.
int appUid = UserHandle.getUid(userId, mPmInternal.getPackage(pkg).getUid());
- File file = new File(packageObbDir);
- if (!file.exists()) {
- vold.setupAppDir(packageObbDir, appUid);
- }
- file = new File(packageDataDir);
- if (!file.exists()) {
- vold.setupAppDir(packageDataDir, appUid);
- }
+ vold.ensureAppDirsCreated(new String[] {packageObbDir, packageDataDir}, appUid);
}
} catch (ServiceManager.ServiceNotFoundException | RemoteException e) {
Slog.e(TAG, "Unable to create obb and data directories for " + processName,e);
diff --git a/services/core/java/com/android/server/pm/AppsFilter.java b/services/core/java/com/android/server/pm/AppsFilter.java
index dac2e4ff4c62..b131aff24cee 100644
--- a/services/core/java/com/android/server/pm/AppsFilter.java
+++ b/services/core/java/com/android/server/pm/AppsFilter.java
@@ -347,7 +347,7 @@ public class AppsFilter {
}
final StateProvider stateProvider = command -> {
synchronized (injector.getLock()) {
- command.currentState(injector.getSettings().mPackages,
+ command.currentState(injector.getSettings().getPackagesLocked(),
injector.getUserManagerInternal().getUserInfos());
}
};
diff --git a/services/core/java/com/android/server/pm/OtaDexoptService.java b/services/core/java/com/android/server/pm/OtaDexoptService.java
index 7db2319b5164..d6400f3c879e 100644
--- a/services/core/java/com/android/server/pm/OtaDexoptService.java
+++ b/services/core/java/com/android/server/pm/OtaDexoptService.java
@@ -128,12 +128,12 @@ public class OtaDexoptService extends IOtaDexopt.Stub {
synchronized (mPackageManagerService.mLock) {
// Important: the packages we need to run with ab-ota compiler-reason.
important = PackageManagerServiceUtils.getPackagesForDexopt(
- mPackageManagerService.mSettings.mPackages.values(), mPackageManagerService,
- DEBUG_DEXOPT);
+ mPackageManagerService.mSettings.getPackagesLocked().values(),
+ mPackageManagerService, DEBUG_DEXOPT);
// Remove Platform Package from A/B OTA b/160735835.
important.removeIf(isPlatformPackage);
// Others: we should optimize this with the (first-)boot compiler-reason.
- others = new ArrayList<>(mPackageManagerService.mSettings.mPackages.values());
+ others = new ArrayList<>(mPackageManagerService.mSettings.getPackagesLocked().values());
others.removeAll(important);
others.removeIf(PackageManagerServiceUtils.REMOVE_IF_NULL_PKG);
others.removeIf(isPlatformPackage);
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index d14baf561f01..cd9d11dbe35f 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -17692,12 +17692,12 @@ public class PackageManagerService extends IPackageManager.Stub
final SparseArray<int[]> newBroadcastAllowList;
final String codePath;
synchronized (mLock) {
- final PackageSetting ps = mSettings.mPackages.get(mPackageName);
+ final PackageSetting ps = mSettings.getPackageLPr(mPackageName);
if (ps == null) {
return;
}
newBroadcastAllowList = mAppsFilter.getVisibilityAllowList(
- ps, mInstalledUserIds, mSettings.mPackages);
+ ps, mInstalledUserIds, mSettings.getPackagesLocked());
codePath = ps.getPathString();
}
Bundle extras = new Bundle();
@@ -17715,12 +17715,12 @@ public class PackageManagerService extends IPackageManager.Stub
public void onPackageUnstartable(int reason) {
final SparseArray<int[]> newBroadcastAllowList;
synchronized (mLock) {
- final PackageSetting ps = mSettings.mPackages.get(mPackageName);
+ final PackageSetting ps = mSettings.getPackageLPr(mPackageName);
if (ps == null) {
return;
}
newBroadcastAllowList = mAppsFilter.getVisibilityAllowList(
- ps, mInstalledUserIds, mSettings.mPackages);
+ ps, mInstalledUserIds, mSettings.getPackagesLocked());
}
Bundle extras = new Bundle();
extras.putInt(Intent.EXTRA_UID, mUid);
@@ -17737,12 +17737,12 @@ public class PackageManagerService extends IPackageManager.Stub
public void onPackageStartable() {
final SparseArray<int[]> newBroadcastAllowList;
synchronized (mLock) {
- final PackageSetting ps = mSettings.mPackages.get(mPackageName);
+ final PackageSetting ps = mSettings.getPackageLPr(mPackageName);
if (ps == null) {
return;
}
newBroadcastAllowList = mAppsFilter.getVisibilityAllowList(
- ps, mInstalledUserIds, mSettings.mPackages);
+ ps, mInstalledUserIds, mSettings.getPackagesLocked());
}
Bundle extras = new Bundle();
extras.putInt(Intent.EXTRA_UID, mUid);
@@ -17768,7 +17768,7 @@ public class PackageManagerService extends IPackageManager.Stub
public void onPackageLoadingProgressChanged(float progress) {
final PackageSetting ps;
synchronized (mLock) {
- ps = mSettings.mPackages.get(mPackageName);
+ ps = mSettings.getPackageLPr(mPackageName);
}
if (ps == null) {
return;
@@ -17791,7 +17791,7 @@ public class PackageManagerService extends IPackageManager.Stub
public void onHealthStatus(int storageId, int status) throws RemoteException {
final PackageSetting ps;
synchronized (mLock) {
- ps = mSettings.mPackages.get(mPackageName);
+ ps = mSettings.getPackageLPr(mPackageName);
}
if (ps == null) {
return;
@@ -17804,7 +17804,7 @@ public class PackageManagerService extends IPackageManager.Stub
int userId) {
final PackageSetting ps;
synchronized (mLock) {
- ps = mSettings.mPackages.get(packageName);
+ ps = mSettings.getPackageLPr(packageName);
if (ps == null) {
Slog.w(TAG, "Failed to get package setting. Package " + packageName
+ " is not installed");
@@ -24612,7 +24612,7 @@ public class PackageManagerService extends IPackageManager.Stub
// which was uninstalled while keeping its data.
AndroidPackage dataOwnerPkg = mPackages.get(packageName);
if (dataOwnerPkg == null) {
- PackageSetting ps = mSettings.mPackages.get(packageName);
+ PackageSetting ps = mSettings.getPackageLPr(packageName);
if (ps != null) {
dataOwnerPkg = ps.pkg;
}
@@ -26059,7 +26059,7 @@ public class PackageManagerService extends IPackageManager.Stub
public void notifyPackageCrashOrAnr(@NonNull String packageName) {
final PackageSetting ps;
synchronized (mLock) {
- ps = mSettings.mPackages.get(packageName);
+ ps = mSettings.getPackageLPr(packageName);
if (ps == null) {
Slog.w(TAG, "Failed notifyPackageCrash. Package " + packageName
+ " is not installed");
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 2d5034e624cd..7482ef4598f1 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -295,6 +295,7 @@ public final class Settings {
private final File mKernelMappingFilename;
/** Map from package name to settings */
+ @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
final ArrayMap<String, PackageSetting> mPackages = new ArrayMap<>();
/**
diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java
index c68fe81d0565..56fb5e8fd449 100644
--- a/services/core/java/com/android/server/pm/ShortcutService.java
+++ b/services/core/java/com/android/server/pm/ShortcutService.java
@@ -537,7 +537,9 @@ public class ShortcutService extends IShortcutService.Stub {
synchronized (mLock) {
// Clear the launcher cache for this user. It will be set again next time the default
// launcher is read from RoleManager.
- getUserShortcutsLocked(userId).setCachedLauncher(null);
+ if (isUserLoadedLocked(userId)) {
+ getUserShortcutsLocked(userId).setCachedLauncher(null);
+ }
}
}
diff --git a/services/core/java/com/android/server/policy/DisplayFoldController.java b/services/core/java/com/android/server/policy/DisplayFoldController.java
index b007a75c1ca5..ff51237a900a 100644
--- a/services/core/java/com/android/server/policy/DisplayFoldController.java
+++ b/services/core/java/com/android/server/policy/DisplayFoldController.java
@@ -20,12 +20,10 @@ import android.annotation.Nullable;
import android.content.Context;
import android.graphics.Rect;
import android.hardware.ICameraService;
-import android.hardware.Sensor;
-import android.hardware.SensorEvent;
-import android.hardware.SensorEventListener;
-import android.hardware.SensorManager;
+import android.hardware.devicestate.DeviceStateManager;
import android.hardware.display.DisplayManagerInternal;
import android.os.Handler;
+import android.os.HandlerExecutor;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.util.Slog;
@@ -63,7 +61,8 @@ class DisplayFoldController {
private String mFocusedApp;
private final DisplayFoldDurationLogger mDurationLogger = new DisplayFoldDurationLogger();
- DisplayFoldController(WindowManagerInternal windowManagerInternal,
+ DisplayFoldController(
+ Context context, WindowManagerInternal windowManagerInternal,
DisplayManagerInternal displayManagerInternal,
@Nullable CameraServiceProxy cameraServiceProxy, int displayId, Rect foldedArea,
Handler handler) {
@@ -73,6 +72,10 @@ class DisplayFoldController {
mDisplayId = displayId;
mFoldedArea = new Rect(foldedArea);
mHandler = handler;
+
+ DeviceStateManager deviceStateManager = context.getSystemService(DeviceStateManager.class);
+ deviceStateManager.registerDeviceStateListener(new DeviceStateListener(context),
+ new HandlerExecutor(handler));
}
void finishedGoingToSleep() {
@@ -83,11 +86,7 @@ class DisplayFoldController {
mDurationLogger.onFinishedWakingUp(mFolded);
}
- void requestDeviceFolded(boolean folded) {
- mHandler.post(() -> setDeviceFolded(folded));
- }
-
- void setDeviceFolded(boolean folded) {
+ private void setDeviceFolded(boolean folded) {
if (mFolded != null && mFolded == folded) {
return;
}
@@ -179,33 +178,6 @@ class DisplayFoldController {
}
}
- /**
- * Only used for the case that persist.debug.force_foldable is set.
- * This is using proximity sensor to simulate the fold state switch.
- */
- static DisplayFoldController createWithProxSensor(Context context, int displayId) {
- final SensorManager sensorManager = context.getSystemService(SensorManager.class);
- final Sensor proxSensor = sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
- if (proxSensor == null) {
- return null;
- }
-
- final DisplayFoldController result = create(context, displayId);
- sensorManager.registerListener(new SensorEventListener() {
- @Override
- public void onSensorChanged(SensorEvent event) {
- result.requestDeviceFolded(event.values[0] < 1f);
- }
-
- @Override
- public void onAccuracyChanged(Sensor sensor, int accuracy) {
- // Ignore.
- }
- }, proxSensor, SensorManager.SENSOR_DELAY_NORMAL);
-
- return result;
- }
-
void onDefaultDisplayFocusChanged(String pkg) {
mFocusedApp = pkg;
}
@@ -227,7 +199,26 @@ class DisplayFoldController {
foldedArea = Rect.unflattenFromString(configFoldedArea);
}
- return new DisplayFoldController(windowManagerService, displayService, cameraServiceProxy,
- displayId, foldedArea, DisplayThread.getHandler());
+ return new DisplayFoldController(context, windowManagerService, displayService,
+ cameraServiceProxy, displayId, foldedArea, DisplayThread.getHandler());
+ }
+
+ /**
+ * Listens to changes in device state and reports the state as folded if the device state
+ * matches the value in the {@link com.android.internal.R.integer.config_foldedDeviceState}
+ * resource.
+ */
+ private class DeviceStateListener implements DeviceStateManager.DeviceStateListener {
+ private final int mFoldedDeviceState;
+
+ DeviceStateListener(Context context) {
+ mFoldedDeviceState = context.getResources().getInteger(
+ com.android.internal.R.integer.config_foldedDeviceState);
+ }
+
+ @Override
+ public void onDeviceStateChanged(int deviceState) {
+ setDeviceFolded(deviceState == mFoldedDeviceState);
+ }
}
}
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index a9a94eb840aa..6919ceaa5a9f 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -472,7 +472,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
int mLidKeyboardAccessibility;
int mLidNavigationAccessibility;
- private boolean mLidControlsDisplayFold;
int mShortPressOnPowerBehavior;
int mLongPressOnPowerBehavior;
int mVeryLongPressOnPowerBehavior;
@@ -648,8 +647,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
break;
case MSG_LAUNCH_ASSIST:
final int deviceId = msg.arg1;
- final String hint = (String) msg.obj;
- launchAssistAction(hint, deviceId);
+ final Long eventTime = (Long) msg.obj;
+ launchAssistAction(null /* hint */, deviceId, eventTime);
break;
case MSG_LAUNCH_VOICE_ASSIST_WITH_WAKE_LOCK:
launchVoiceAssistWithWakeLock();
@@ -659,7 +658,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
finishPowerKeyPress();
break;
case MSG_POWER_LONG_PRESS:
- powerLongPress();
+ powerLongPress((Long) msg.obj /* eventTime */);
break;
case MSG_POWER_VERY_LONG_PRESS:
powerVeryLongPress();
@@ -934,9 +933,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Wait for a long press or for the button to be released to decide what to do.
if (hasLongPressOnPowerBehavior()) {
if ((event.getFlags() & KeyEvent.FLAG_LONG_PRESS) != 0) {
- powerLongPress();
+ powerLongPress(event.getEventTime());
} else {
- Message msg = mHandler.obtainMessage(MSG_POWER_LONG_PRESS);
+ Message msg = mHandler.obtainMessage(MSG_POWER_LONG_PRESS,
+ event.getEventTime());
msg.setAsynchronous(true);
mHandler.sendMessageDelayed(msg,
ViewConfiguration.get(mContext).getDeviceGlobalActionKeyTimeout());
@@ -953,9 +953,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (mSupportLongPressPowerWhenNonInteractive && hasLongPressOnPowerBehavior()) {
if ((event.getFlags() & KeyEvent.FLAG_LONG_PRESS) != 0) {
- powerLongPress();
+ powerLongPress(event.getEventTime());
} else {
- Message msg = mHandler.obtainMessage(MSG_POWER_LONG_PRESS);
+ Message msg = mHandler.obtainMessage(MSG_POWER_LONG_PRESS,
+ event.getEventTime());
msg.setAsynchronous(true);
mHandler.sendMessageDelayed(msg,
ViewConfiguration.get(mContext).getDeviceGlobalActionKeyTimeout());
@@ -1188,7 +1189,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return 1;
}
- private void powerLongPress() {
+ private void powerLongPress(long eventTime) {
final int behavior = getResolvedLongPressOnPowerBehavior();
switch (behavior) {
case LONG_PRESS_POWER_NOTHING:
@@ -1221,7 +1222,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, false,
"Power - Long Press - Go To Assistant");
final int powerKeyDeviceId = Integer.MIN_VALUE;
- launchAssistAction(null, powerKeyDeviceId);
+ launchAssistAction(null, powerKeyDeviceId, eventTime);
break;
}
}
@@ -1624,7 +1625,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
} else if ((event.getFlags() & KeyEvent.FLAG_LONG_PRESS) != 0) {
if (!keyguardOn) {
// Post to main thread to avoid blocking input pipeline.
- mHandler.post(() -> handleLongPressOnHome(event.getDeviceId()));
+ mHandler.post(() -> handleLongPressOnHome(event.getDeviceId(),
+ event.getEventTime()));
}
}
return -1;
@@ -1637,7 +1639,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
- private void handleLongPressOnHome(int deviceId) {
+ private void handleLongPressOnHome(int deviceId, long eventTime) {
if (mLongPressOnHomeBehavior == LONG_PRESS_HOME_NOTHING) {
return;
}
@@ -1649,7 +1651,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
launchAllAppsAction();
break;
case LONG_PRESS_HOME_ASSIST:
- launchAssistAction(null, deviceId);
+ launchAssistAction(null, deviceId, eventTime);
break;
case LONG_PRESS_HOME_NOTIFICATION_PANEL:
toggleNotificationPanel();
@@ -1789,8 +1791,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
com.android.internal.R.integer.config_lidKeyboardAccessibility);
mLidNavigationAccessibility = mContext.getResources().getInteger(
com.android.internal.R.integer.config_lidNavigationAccessibility);
- mLidControlsDisplayFold = mContext.getResources().getBoolean(
- com.android.internal.R.bool.config_lidControlsDisplayFold);
mAllowTheaterModeWakeFromKey = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_allowTheaterModeWakeFromKey);
@@ -1847,12 +1847,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
readConfigurationDependentBehaviors();
- if (mLidControlsDisplayFold) {
- mDisplayFoldController = DisplayFoldController.create(context, DEFAULT_DISPLAY);
- } else if (SystemProperties.getBoolean("persist.debug.force_foldable", false)) {
- mDisplayFoldController = DisplayFoldController.createWithProxSensor(context,
- DEFAULT_DISPLAY);
- }
+ mDisplayFoldController = DisplayFoldController.create(context, DEFAULT_DISPLAY);
mAccessibilityManager = (AccessibilityManager) context.getSystemService(
Context.ACCESSIBILITY_SERVICE);
@@ -2791,7 +2786,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (down) {
mPendingMetaAction = true;
} else if (mPendingMetaAction) {
- launchAssistAction(Intent.EXTRA_ASSIST_INPUT_HINT_KEYBOARD, event.getDeviceId());
+ launchAssistAction(Intent.EXTRA_ASSIST_INPUT_HINT_KEYBOARD, event.getDeviceId(),
+ event.getEventTime());
}
return -1;
}
@@ -3161,22 +3157,24 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// various parts of the UI.
/** Asks the status bar to startAssist(), usually a full "assistant" interface */
- private void launchAssistAction(String hint, int deviceId) {
+ private void launchAssistAction(String hint, int deviceId, long eventTime) {
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_ASSIST);
if (!isUserSetupComplete()) {
// Disable opening assist window during setup
return;
}
+
+ // Add Intent Extra data.
Bundle args = null;
- if (deviceId > Integer.MIN_VALUE || hint != null) {
- args = new Bundle();
- if (deviceId > Integer.MIN_VALUE) {
- args.putInt(Intent.EXTRA_ASSIST_INPUT_DEVICE_ID, deviceId);
- }
- if (hint != null) {
- args.putBoolean(hint, true);
- }
+ args = new Bundle();
+ if (deviceId > Integer.MIN_VALUE) {
+ args.putInt(Intent.EXTRA_ASSIST_INPUT_DEVICE_ID, deviceId);
+ }
+ if (hint != null) {
+ args.putBoolean(hint, true);
}
+ args.putLong(Intent.EXTRA_TIME, eventTime);
+
((SearchManager) mContext.createContextAsUser(UserHandle.of(mCurrentUserId), 0)
.getSystemService(Context.SEARCH_SERVICE)).launchAssist(args);
}
@@ -3798,7 +3796,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
final boolean longPressed = event.getRepeatCount() > 0;
if (down && !longPressed) {
Message msg = mHandler.obtainMessage(MSG_LAUNCH_ASSIST, event.getDeviceId(),
- 0 /* unused */, null /* hint */);
+ 0 /* unused */, event.getEventTime() /* eventTime */);
msg.setAsynchronous(true);
msg.sendToTarget();
}
@@ -4019,9 +4017,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return true;
}
- // Watches handle BACK specially
+ // Watches handle BACK and hardware buttons specially
if (mHasFeatureWatch && (keyCode == KeyEvent.KEYCODE_BACK
- || keyCode == KeyEvent.KEYCODE_STEM_PRIMARY)) {
+ || keyCode == KeyEvent.KEYCODE_STEM_PRIMARY
+ || keyCode == KeyEvent.KEYCODE_STEM_1
+ || keyCode == KeyEvent.KEYCODE_STEM_2
+ || keyCode == KeyEvent.KEYCODE_STEM_3)) {
return false;
}
@@ -4860,9 +4861,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
private void applyLidSwitchState() {
final int lidState = mDefaultDisplayPolicy.getLidState();
- if (mLidControlsDisplayFold && mDisplayFoldController != null) {
- mDisplayFoldController.requestDeviceFolded(lidState == LID_CLOSED);
- } else if (lidState == LID_CLOSED) {
+ if (lidState == LID_CLOSED) {
int lidBehavior = getLidBehavior();
switch (lidBehavior) {
case LID_BEHAVIOR_LOCK:
diff --git a/services/core/java/com/android/server/power/batterysaver/BatterySaverPolicy.java b/services/core/java/com/android/server/power/batterysaver/BatterySaverPolicy.java
index 8eb66cdee5cd..eea79f6eca95 100644
--- a/services/core/java/com/android/server/power/batterysaver/BatterySaverPolicy.java
+++ b/services/core/java/com/android/server/power/batterysaver/BatterySaverPolicy.java
@@ -1138,6 +1138,7 @@ public class BatterySaverPolicy extends ContentObserver implements
ipw.println(mLastDeviceConfigProperties.getString(key, null));
}
}
+ ipw.decreaseIndent();
ipw.println("mAccessibilityEnabled=" + mAccessibilityEnabled.get());
ipw.println("mAutomotiveProjectionActive=" + mAutomotiveProjectionActive.get());
@@ -1191,7 +1192,7 @@ public class BatterySaverPolicy extends ContentObserver implements
}
private void dumpMap(PrintWriter pw, ArrayMap<String, String> map) {
- if (map == null) {
+ if (map == null || map.size() == 0) {
pw.println("N/A");
return;
}
diff --git a/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java b/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java
index 192a00303a30..bd66aa39b8d2 100644
--- a/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java
+++ b/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java
@@ -1316,7 +1316,7 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub implements Rollba
private SparseIntArray getExtensionVersions() {
// This list must be updated whenever the current API level is increased, or should be
// replaced when we have another way of determining the relevant SDK versions.
- final int[] relevantSdkVersions = { Build.VERSION_CODES.R };
+ final int[] relevantSdkVersions = { Build.VERSION_CODES.R, Build.VERSION_CODES.S };
SparseIntArray result = new SparseIntArray(relevantSdkVersions.length);
for (int i = 0; i < relevantSdkVersions.length; i++) {
diff --git a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
index 8438652c084e..ac3816e7ea2d 100644
--- a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
+++ b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
@@ -1532,8 +1532,8 @@ public class StatsPullAtomService extends SystemService {
// All shared app gids are accounted together.
uid = LAST_SHARED_APPLICATION_GID;
mutateInPlace = true;
- } else if (UserHandle.isApp(uid)) {
- // Apps are accounted under their app id.
+ } else {
+ // Everything else is accounted under their base uid.
uid = UserHandle.getAppId(uid);
}
diff --git a/services/core/java/com/android/server/timedetector/OWNERS b/services/core/java/com/android/server/timedetector/OWNERS
index 09447a971bdd..8f8089717e3b 100644
--- a/services/core/java/com/android/server/timedetector/OWNERS
+++ b/services/core/java/com/android/server/timedetector/OWNERS
@@ -1 +1,3 @@
-include /core/java/android/app/timezone/OWNERS
+# Bug component: 847766
+mingaleev@google.com
+include /core/java/android/app/timedetector/OWNERS
diff --git a/services/core/java/com/android/server/timedetector/TimeDetectorService.java b/services/core/java/com/android/server/timedetector/TimeDetectorService.java
index 7de0e87f91c3..c7fe20415511 100644
--- a/services/core/java/com/android/server/timedetector/TimeDetectorService.java
+++ b/services/core/java/com/android/server/timedetector/TimeDetectorService.java
@@ -18,6 +18,7 @@ package com.android.server.timedetector;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.app.timedetector.GnssTimeSuggestion;
import android.app.timedetector.ITimeDetectorService;
import android.app.timedetector.ManualTimeSuggestion;
import android.app.timedetector.NetworkTimeSuggestion;
@@ -129,6 +130,14 @@ public final class TimeDetectorService extends ITimeDetectorService.Stub {
mHandler.post(() -> mTimeDetectorStrategy.suggestNetworkTime(timeSignal));
}
+ @Override
+ public void suggestGnssTime(@NonNull GnssTimeSuggestion timeSignal) {
+ enforceSuggestGnssTimePermission();
+ Objects.requireNonNull(timeSignal);
+
+ mHandler.post(() -> mTimeDetectorStrategy.suggestGnssTime(timeSignal));
+ }
+
/** Internal method for handling the auto time setting being changed. */
@VisibleForTesting
public void handleAutoTimeDetectionChanged() {
@@ -162,4 +171,10 @@ public final class TimeDetectorService extends ITimeDetectorService.Stub {
android.Manifest.permission.SET_TIME,
"set time");
}
+
+ private void enforceSuggestGnssTimePermission() {
+ mContext.enforceCallingOrSelfPermission(
+ android.Manifest.permission.SET_TIME,
+ "suggest gnss time");
+ }
}
diff --git a/services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java b/services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java
index f278ef68c536..b539f013d6d3 100644
--- a/services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java
+++ b/services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java
@@ -18,6 +18,7 @@ package com.android.server.timedetector;
import android.annotation.IntDef;
import android.annotation.NonNull;
+import android.app.timedetector.GnssTimeSuggestion;
import android.app.timedetector.ManualTimeSuggestion;
import android.app.timedetector.NetworkTimeSuggestion;
import android.app.timedetector.TelephonyTimeSuggestion;
@@ -41,7 +42,7 @@ import java.lang.annotation.RetentionPolicy;
*/
public interface TimeDetectorStrategy extends Dumpable {
- @IntDef({ ORIGIN_TELEPHONY, ORIGIN_MANUAL, ORIGIN_NETWORK })
+ @IntDef({ ORIGIN_TELEPHONY, ORIGIN_MANUAL, ORIGIN_NETWORK, ORIGIN_GNSS })
@Retention(RetentionPolicy.SOURCE)
@interface Origin {}
@@ -57,6 +58,10 @@ public interface TimeDetectorStrategy extends Dumpable {
@Origin
int ORIGIN_NETWORK = 3;
+ /** Used when a time value originated from a gnss signal. */
+ @Origin
+ int ORIGIN_GNSS = 4;
+
/** Processes the suggested time from telephony sources. */
void suggestTelephonyTime(@NonNull TelephonyTimeSuggestion timeSuggestion);
@@ -71,6 +76,9 @@ public interface TimeDetectorStrategy extends Dumpable {
/** Processes the suggested time from network sources. */
void suggestNetworkTime(@NonNull NetworkTimeSuggestion timeSuggestion);
+ /** Processes the suggested time from gnss sources. */
+ void suggestGnssTime(@NonNull GnssTimeSuggestion timeSuggestion);
+
/**
* Handles the auto-time configuration changing For example, when the auto-time setting is
* toggled on or off.
@@ -100,6 +108,8 @@ public interface TimeDetectorStrategy extends Dumpable {
return "network";
case ORIGIN_TELEPHONY:
return "telephony";
+ case ORIGIN_GNSS:
+ return "gnss";
default:
throw new IllegalArgumentException("origin=" + origin);
}
@@ -117,6 +127,8 @@ public interface TimeDetectorStrategy extends Dumpable {
return ORIGIN_NETWORK;
case "telephony":
return ORIGIN_TELEPHONY;
+ case "gnss":
+ return ORIGIN_GNSS;
default:
throw new IllegalArgumentException("originString=" + originString);
}
diff --git a/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java b/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java
index b5d49cfbe9c8..48af81e5c59c 100644
--- a/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java
+++ b/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java
@@ -23,6 +23,7 @@ import static java.util.stream.Collectors.joining;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.AlarmManager;
+import android.app.timedetector.GnssTimeSuggestion;
import android.app.timedetector.ManualTimeSuggestion;
import android.app.timedetector.NetworkTimeSuggestion;
import android.app.timedetector.TelephonyTimeSuggestion;
@@ -108,6 +109,10 @@ public final class TimeDetectorStrategyImpl implements TimeDetectorStrategy {
private final ReferenceWithHistory<NetworkTimeSuggestion> mLastNetworkSuggestion =
new ReferenceWithHistory<>(KEEP_SUGGESTION_HISTORY_SIZE);
+ @GuardedBy("this")
+ private final ReferenceWithHistory<GnssTimeSuggestion> mLastGnssSuggestion =
+ new ReferenceWithHistory<>(KEEP_SUGGESTION_HISTORY_SIZE);
+
/**
* The interface used by the strategy to interact with the surrounding service.
*
@@ -165,6 +170,20 @@ public final class TimeDetectorStrategyImpl implements TimeDetectorStrategy {
}
@Override
+ public synchronized void suggestGnssTime(@NonNull GnssTimeSuggestion timeSuggestion) {
+ final TimestampedValue<Long> newUtcTime = timeSuggestion.getUtcTime();
+
+ if (!validateAutoSuggestionTime(newUtcTime, timeSuggestion)) {
+ return;
+ }
+
+ mLastGnssSuggestion.set(timeSuggestion);
+
+ String reason = "GNSS time suggestion received: suggestion=" + timeSuggestion;
+ doAutoTimeDetection(reason);
+ }
+
+ @Override
public synchronized boolean suggestManualTime(@NonNull ManualTimeSuggestion suggestion) {
final TimestampedValue<Long> newUtcTime = suggestion.getUtcTime();
@@ -278,6 +297,11 @@ public final class TimeDetectorStrategyImpl implements TimeDetectorStrategy {
mLastNetworkSuggestion.dump(ipw);
ipw.decreaseIndent(); // level 2
+ ipw.println("Gnss suggestion history:");
+ ipw.increaseIndent(); // level 2
+ mLastGnssSuggestion.dump(ipw);
+ ipw.decreaseIndent(); // level 2
+
ipw.decreaseIndent(); // level 1
}
@@ -383,6 +407,14 @@ public final class TimeDetectorStrategyImpl implements TimeDetectorStrategy {
+ ", networkSuggestion=" + networkSuggestion
+ ", detectionReason=" + detectionReason;
}
+ } else if (origin == ORIGIN_GNSS) {
+ GnssTimeSuggestion gnssTimeSuggestion = findLatestValidGnssSuggestion();
+ if (gnssTimeSuggestion != null) {
+ newUtcTime = gnssTimeSuggestion.getUtcTime();
+ cause = "Found good gnss suggestion."
+ + ", gnssTimeSuggestion=" + gnssTimeSuggestion
+ + ", detectionReason=" + detectionReason;
+ }
} else {
Slog.w(LOG_TAG, "Unknown or unsupported origin=" + origin
+ " in " + Arrays.toString(originPriorities)
@@ -524,6 +556,26 @@ public final class TimeDetectorStrategyImpl implements TimeDetectorStrategy {
return networkSuggestion;
}
+ /** Returns the latest, valid, gnss suggestion. Returns {@code null} if there isn't one. */
+ @GuardedBy("this")
+ @Nullable
+ private GnssTimeSuggestion findLatestValidGnssSuggestion() {
+ GnssTimeSuggestion gnssTimeSuggestion = mLastGnssSuggestion.get();
+ if (gnssTimeSuggestion == null) {
+ // No gnss suggestions received. This is normal if there's no gnss signal.
+ return null;
+ }
+
+ TimestampedValue<Long> utcTime = gnssTimeSuggestion.getUtcTime();
+ long elapsedRealTimeMillis = mCallback.elapsedRealtimeMillis();
+ if (!validateSuggestionUtcTime(elapsedRealTimeMillis, utcTime)) {
+ // The latest suggestion is not valid, usually due to its age.
+ return null;
+ }
+
+ return gnssTimeSuggestion;
+ }
+
@GuardedBy("this")
private boolean setSystemClockIfRequired(
@Origin int origin, @NonNull TimestampedValue<Long> time, @NonNull String cause) {
@@ -652,6 +704,16 @@ public final class TimeDetectorStrategyImpl implements TimeDetectorStrategy {
}
/**
+ * Returns the latest valid gnss suggestion. Not intended for general use: it is used during
+ * tests to check strategy behavior.
+ */
+ @VisibleForTesting
+ @Nullable
+ public synchronized GnssTimeSuggestion findLatestValidGnssSuggestionForTests() {
+ return findLatestValidGnssSuggestion();
+ }
+
+ /**
* A method used to inspect state during tests. Not intended for general use.
*/
@VisibleForTesting
@@ -669,6 +731,15 @@ public final class TimeDetectorStrategyImpl implements TimeDetectorStrategy {
return mLastNetworkSuggestion.get();
}
+ /**
+ * A method used to inspect state during tests. Not intended for general use.
+ */
+ @VisibleForTesting
+ @Nullable
+ public synchronized GnssTimeSuggestion getLatestGnssSuggestion() {
+ return mLastGnssSuggestion.get();
+ }
+
private static boolean validateSuggestionUtcTime(
long elapsedRealtimeMillis, TimestampedValue<Long> utcTime) {
long referenceTimeMillis = utcTime.getReferenceTimeMillis();
diff --git a/services/core/java/com/android/server/timezone/OWNERS b/services/core/java/com/android/server/timezone/OWNERS
index 09447a971bdd..8f8089717e3b 100644
--- a/services/core/java/com/android/server/timezone/OWNERS
+++ b/services/core/java/com/android/server/timezone/OWNERS
@@ -1 +1,3 @@
-include /core/java/android/app/timezone/OWNERS
+# Bug component: 847766
+mingaleev@google.com
+include /core/java/android/app/timedetector/OWNERS
diff --git a/services/core/java/com/android/server/timezonedetector/OWNERS b/services/core/java/com/android/server/timezonedetector/OWNERS
index 09447a971bdd..8f8089717e3b 100644
--- a/services/core/java/com/android/server/timezonedetector/OWNERS
+++ b/services/core/java/com/android/server/timezonedetector/OWNERS
@@ -1 +1,3 @@
-include /core/java/android/app/timezone/OWNERS
+# Bug component: 847766
+mingaleev@google.com
+include /core/java/android/app/timedetector/OWNERS
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 791d74afebdd..a2b09908e22d 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -2538,9 +2538,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public int getLockTaskModeState() {
- synchronized (mGlobalLock) {
- return getLockTaskController().getLockTaskModeState();
- }
+ return getLockTaskController().getLockTaskModeState();
}
@Override
diff --git a/services/core/xsd/device-state-config/OWNERS b/services/core/xsd/device-state-config/OWNERS
new file mode 100644
index 000000000000..d9b0e2e5ffa5
--- /dev/null
+++ b/services/core/xsd/device-state-config/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/devicestate/OWNERS
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 92c64f822b78..242cee8eaccd 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -1281,6 +1281,10 @@ public final class SystemServer implements Dumpable {
inputManager = new InputManagerService(context);
t.traceEnd();
+ t.traceBegin("DeviceStateManagerService");
+ mSystemServiceManager.startService(DeviceStateManagerService.class);
+ t.traceEnd();
+
if (!disableCameraService) {
t.traceBegin("StartCameraServiceProxy");
mSystemServiceManager.startService(CameraServiceProxy.class);
@@ -1374,10 +1378,6 @@ public final class SystemServer implements Dumpable {
mSystemServiceManager.startService(AppIntegrityManagerService.class);
t.traceEnd();
- t.traceBegin("DeviceStateManagerService");
- mSystemServiceManager.startService(DeviceStateManagerService.class);
- t.traceEnd();
-
} catch (Throwable e) {
Slog.e("System", "******************************************");
Slog.e("System", "************ Failure starting core service");
diff --git a/services/tests/servicestests/src/com/android/server/timedetector/OWNERS b/services/tests/servicestests/src/com/android/server/timedetector/OWNERS
index 09447a971bdd..8f8089717e3b 100644
--- a/services/tests/servicestests/src/com/android/server/timedetector/OWNERS
+++ b/services/tests/servicestests/src/com/android/server/timedetector/OWNERS
@@ -1 +1,3 @@
-include /core/java/android/app/timezone/OWNERS
+# Bug component: 847766
+mingaleev@google.com
+include /core/java/android/app/timedetector/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorServiceTest.java b/services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorServiceTest.java
index 4a44005e9602..5276ac4e98c1 100644
--- a/services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorServiceTest.java
@@ -28,6 +28,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import android.app.timedetector.GnssTimeSuggestion;
import android.app.timedetector.ManualTimeSuggestion;
import android.app.timedetector.NetworkTimeSuggestion;
import android.app.timedetector.TelephonyTimeSuggestion;
@@ -174,6 +175,36 @@ public class TimeDetectorServiceTest {
mStubbedTimeDetectorStrategy.verifySuggestNetworkTimeCalled(NetworkTimeSuggestion);
}
+ @Test(expected = SecurityException.class)
+ public void testSuggestGnssTime_withoutPermission() {
+ doThrow(new SecurityException("Mock"))
+ .when(mMockContext).enforceCallingOrSelfPermission(anyString(), any());
+ GnssTimeSuggestion gnssTimeSuggestion = createGnssTimeSuggestion();
+
+ try {
+ mTimeDetectorService.suggestGnssTime(gnssTimeSuggestion);
+ fail();
+ } finally {
+ verify(mMockContext).enforceCallingOrSelfPermission(
+ eq(android.Manifest.permission.SET_TIME), anyString());
+ }
+ }
+
+ @Test
+ public void testSuggestGnssTime() throws Exception {
+ doNothing().when(mMockContext).enforceCallingOrSelfPermission(anyString(), any());
+
+ GnssTimeSuggestion gnssTimeSuggestion = createGnssTimeSuggestion();
+ mTimeDetectorService.suggestGnssTime(gnssTimeSuggestion);
+ mTestHandler.assertTotalMessagesEnqueued(1);
+
+ verify(mMockContext).enforceCallingOrSelfPermission(
+ eq(android.Manifest.permission.SET_TIME), anyString());
+
+ mTestHandler.waitForMessagesToBeProcessed();
+ mStubbedTimeDetectorStrategy.verifySuggestGnssTimeCalled(gnssTimeSuggestion);
+ }
+
@Test
public void testDump() {
when(mMockContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP))
@@ -219,12 +250,18 @@ public class TimeDetectorServiceTest {
return new NetworkTimeSuggestion(timeValue);
}
+ private static GnssTimeSuggestion createGnssTimeSuggestion() {
+ TimestampedValue<Long> timeValue = new TimestampedValue<>(100L, 1_000_000L);
+ return new GnssTimeSuggestion(timeValue);
+ }
+
private static class StubbedTimeDetectorStrategy implements TimeDetectorStrategy {
// Call tracking.
private TelephonyTimeSuggestion mLastTelephonySuggestion;
private ManualTimeSuggestion mLastManualSuggestion;
private NetworkTimeSuggestion mLastNetworkSuggestion;
+ private GnssTimeSuggestion mLastGnssSuggestion;
private boolean mHandleAutoTimeDetectionChangedCalled;
private boolean mDumpCalled;
@@ -245,6 +282,11 @@ public class TimeDetectorServiceTest {
}
@Override
+ public void suggestGnssTime(GnssTimeSuggestion timeSuggestion) {
+ mLastGnssSuggestion = timeSuggestion;
+ }
+
+ @Override
public void handleAutoTimeConfigChanged() {
mHandleAutoTimeDetectionChangedCalled = true;
}
@@ -258,6 +300,7 @@ public class TimeDetectorServiceTest {
mLastTelephonySuggestion = null;
mLastManualSuggestion = null;
mLastNetworkSuggestion = null;
+ mLastGnssSuggestion = null;
mHandleAutoTimeDetectionChangedCalled = false;
mDumpCalled = false;
}
@@ -274,6 +317,10 @@ public class TimeDetectorServiceTest {
assertEquals(expectedSuggestion, mLastNetworkSuggestion);
}
+ void verifySuggestGnssTimeCalled(GnssTimeSuggestion expectedSuggestion) {
+ assertEquals(expectedSuggestion, mLastGnssSuggestion);
+ }
+
void verifyHandleAutoTimeDetectionChangedCalled() {
assertTrue(mHandleAutoTimeDetectionChangedCalled);
}
diff --git a/services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorStrategyImplTest.java b/services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorStrategyImplTest.java
index 21396fd0516e..b1adb0b4ce60 100644
--- a/services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorStrategyImplTest.java
+++ b/services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorStrategyImplTest.java
@@ -16,6 +16,7 @@
package com.android.server.timedetector;
+import static com.android.server.timedetector.TimeDetectorStrategy.ORIGIN_GNSS;
import static com.android.server.timedetector.TimeDetectorStrategy.ORIGIN_NETWORK;
import static com.android.server.timedetector.TimeDetectorStrategy.ORIGIN_TELEPHONY;
@@ -25,6 +26,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import android.app.timedetector.GnssTimeSuggestion;
import android.app.timedetector.ManualTimeSuggestion;
import android.app.timedetector.NetworkTimeSuggestion;
import android.app.timedetector.TelephonyTimeSuggestion;
@@ -569,7 +571,53 @@ public class TimeDetectorStrategyImplTest {
}
@Test
- public void highPrioritySuggestionsShouldBeatLowerPrioritySuggestions() {
+ public void testSuggestGnssTime_autoTimeEnabled() {
+ mScript.pokeFakeClocks(ARBITRARY_CLOCK_INITIALIZATION_INFO)
+ .pokeAutoOriginPriorities(ORIGIN_GNSS)
+ .pokeAutoTimeDetectionEnabled(true);
+
+ GnssTimeSuggestion timeSuggestion =
+ mScript.generateGnssTimeSuggestion(ARBITRARY_TEST_TIME);
+
+ mScript.simulateTimePassing();
+
+ long expectedSystemClockMillis =
+ mScript.calculateTimeInMillisForNow(timeSuggestion.getUtcTime());
+ mScript.simulateGnssTimeSuggestion(timeSuggestion)
+ .verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis);
+ }
+
+ @Test
+ public void testSuggestGnssTime_autoTimeDisabled() {
+ mScript.pokeFakeClocks(ARBITRARY_CLOCK_INITIALIZATION_INFO)
+ .pokeAutoOriginPriorities(ORIGIN_GNSS)
+ .pokeAutoTimeDetectionEnabled(false);
+
+ GnssTimeSuggestion timeSuggestion =
+ mScript.generateGnssTimeSuggestion(ARBITRARY_TEST_TIME);
+
+ mScript.simulateTimePassing()
+ .simulateGnssTimeSuggestion(timeSuggestion)
+ .verifySystemClockWasNotSetAndResetCallTracking();
+ }
+
+ @Test
+ public void gnssTimeSuggestion_ignoredWhenReferencedTimeIsInThePast() {
+ mScript.pokeFakeClocks(ARBITRARY_CLOCK_INITIALIZATION_INFO)
+ .pokeAutoOriginPriorities(ORIGIN_GNSS)
+ .pokeAutoTimeDetectionEnabled(true);
+
+ Instant suggestedTime = TIME_LOWER_BOUND.minus(Duration.ofDays(1));
+ GnssTimeSuggestion timeSuggestion = mScript
+ .generateGnssTimeSuggestion(suggestedTime);
+
+ mScript.simulateGnssTimeSuggestion(timeSuggestion)
+ .verifySystemClockWasNotSetAndResetCallTracking()
+ .assertLatestGnssSuggestion(null);
+ }
+
+ @Test
+ public void highPrioritySuggestionsBeatLowerPrioritySuggestions_telephonyNetworkOrigins() {
mScript.pokeFakeClocks(ARBITRARY_CLOCK_INITIALIZATION_INFO)
.pokeAutoTimeDetectionEnabled(true)
.pokeAutoOriginPriorities(ORIGIN_TELEPHONY, ORIGIN_NETWORK);
@@ -672,22 +720,130 @@ public class TimeDetectorStrategyImplTest {
}
@Test
+ public void highPrioritySuggestionsBeatLowerPrioritySuggestions_networkGnssOrigins() {
+ mScript.pokeFakeClocks(ARBITRARY_CLOCK_INITIALIZATION_INFO)
+ .pokeAutoTimeDetectionEnabled(true)
+ .pokeAutoOriginPriorities(ORIGIN_NETWORK, ORIGIN_GNSS);
+
+ // Three obviously different times that could not be mistaken for each other.
+ Instant gnssTime1 = ARBITRARY_TEST_TIME;
+ Instant gnssTime2 = ARBITRARY_TEST_TIME.plus(Duration.ofDays(30));
+ Instant networkTime = ARBITRARY_TEST_TIME.plus(Duration.ofDays(60));
+ // A small increment used to simulate the passage of time, but not enough to interfere with
+ // macro-level time changes associated with suggestion age.
+ final long smallTimeIncrementMillis = 101;
+
+ // A gnss suggestion is made. It should be used because there is no network suggestion.
+ GnssTimeSuggestion gnssTimeSuggestion1 =
+ mScript.generateGnssTimeSuggestion(gnssTime1);
+ mScript.simulateTimePassing(smallTimeIncrementMillis)
+ .simulateGnssTimeSuggestion(gnssTimeSuggestion1)
+ .verifySystemClockWasSetAndResetCallTracking(
+ mScript.calculateTimeInMillisForNow(gnssTimeSuggestion1.getUtcTime()));
+
+ // Check internal state.
+ mScript.assertLatestNetworkSuggestion(null)
+ .assertLatestGnssSuggestion(gnssTimeSuggestion1);
+ assertEquals(gnssTimeSuggestion1, mScript.peekLatestValidGnssSuggestion());
+ assertNull("No network suggestions were made:", mScript.peekLatestValidNetworkSuggestion());
+
+ // Simulate a little time passing.
+ mScript.simulateTimePassing(smallTimeIncrementMillis)
+ .verifySystemClockWasNotSetAndResetCallTracking();
+
+ // Now a network suggestion is made. Network suggestions are prioritized over gnss
+ // suggestions so it should "win".
+ NetworkTimeSuggestion networkTimeSuggestion =
+ mScript.generateNetworkTimeSuggestion(networkTime);
+ mScript.simulateTimePassing(smallTimeIncrementMillis)
+ .simulateNetworkTimeSuggestion(networkTimeSuggestion)
+ .verifySystemClockWasSetAndResetCallTracking(
+ mScript.calculateTimeInMillisForNow(networkTimeSuggestion.getUtcTime()));
+
+ // Check internal state.
+ mScript.assertLatestNetworkSuggestion(networkTimeSuggestion)
+ .assertLatestGnssSuggestion(gnssTimeSuggestion1);
+ assertEquals(gnssTimeSuggestion1, mScript.peekLatestValidGnssSuggestion());
+ assertEquals(networkTimeSuggestion, mScript.peekLatestValidNetworkSuggestion());
+
+ // Simulate some significant time passing: half the time allowed before a time signal
+ // becomes "too old to use".
+ mScript.simulateTimePassing(TimeDetectorStrategyImpl.MAX_UTC_TIME_AGE_MILLIS / 2)
+ .verifySystemClockWasNotSetAndResetCallTracking();
+
+ // Now another gnss suggestion is made. Network suggestions are prioritized over
+ // gnss suggestions so the latest network suggestion should still "win".
+ GnssTimeSuggestion gnssTimeSuggestion2 =
+ mScript.generateGnssTimeSuggestion(gnssTime2);
+ mScript.simulateTimePassing(smallTimeIncrementMillis)
+ .simulateGnssTimeSuggestion(gnssTimeSuggestion2)
+ .verifySystemClockWasNotSetAndResetCallTracking();
+
+ // Check internal state.
+ mScript.assertLatestNetworkSuggestion(networkTimeSuggestion)
+ .assertLatestGnssSuggestion(gnssTimeSuggestion2);
+ assertEquals(gnssTimeSuggestion2, mScript.peekLatestValidGnssSuggestion());
+ assertEquals(networkTimeSuggestion, mScript.peekLatestValidNetworkSuggestion());
+
+ // Simulate some significant time passing: half the time allowed before a time signal
+ // becomes "too old to use". This should mean that telephonyTimeSuggestion is now too old to
+ // be used but networkTimeSuggestion2 is not.
+ mScript.simulateTimePassing(TimeDetectorStrategyImpl.MAX_UTC_TIME_AGE_MILLIS / 2);
+
+ // NOTE: The TimeDetectorStrategyImpl doesn't set an alarm for the point when the last
+ // suggestion it used becomes too old: it requires a new suggestion or an auto-time toggle
+ // to re-run the detection logic. This may change in future but until then we rely on a
+ // steady stream of suggestions to re-evaluate.
+ mScript.verifySystemClockWasNotSetAndResetCallTracking();
+
+ // Check internal state.
+ mScript.assertLatestNetworkSuggestion(networkTimeSuggestion)
+ .assertLatestGnssSuggestion(gnssTimeSuggestion2);
+ assertEquals(gnssTimeSuggestion2, mScript.peekLatestValidGnssSuggestion());
+ assertNull(
+ "Network suggestion should be expired:",
+ mScript.peekLatestValidNetworkSuggestion());
+
+ // Toggle auto-time off and on to force the detection logic to run.
+ mScript.simulateAutoTimeDetectionToggle()
+ .simulateTimePassing(smallTimeIncrementMillis)
+ .simulateAutoTimeDetectionToggle();
+
+ // Verify the latest gnss time now wins.
+ mScript.verifySystemClockWasSetAndResetCallTracking(
+ mScript.calculateTimeInMillisForNow(gnssTimeSuggestion2.getUtcTime()));
+
+ // Check internal state.
+ mScript.assertLatestNetworkSuggestion(networkTimeSuggestion)
+ .assertLatestGnssSuggestion(gnssTimeSuggestion2);
+ assertEquals(gnssTimeSuggestion2, mScript.peekLatestValidGnssSuggestion());
+ assertNull(
+ "Network suggestion should still be expired:",
+ mScript.peekLatestValidNetworkSuggestion());
+ }
+
+ @Test
public void whenAllTimeSuggestionsAreAvailable_higherPriorityWins_lowerPriorityComesFirst() {
mScript.pokeFakeClocks(ARBITRARY_CLOCK_INITIALIZATION_INFO)
.pokeAutoTimeDetectionEnabled(true)
- .pokeAutoOriginPriorities(ORIGIN_TELEPHONY, ORIGIN_NETWORK);
+ .pokeAutoOriginPriorities(ORIGIN_TELEPHONY, ORIGIN_NETWORK, ORIGIN_GNSS);
Instant networkTime = ARBITRARY_TEST_TIME;
- Instant telephonyTime = ARBITRARY_TEST_TIME.plus(Duration.ofDays(30));
+ Instant gnssTime = ARBITRARY_TEST_TIME.plus(Duration.ofDays(30));
+ Instant telephonyTime = ARBITRARY_TEST_TIME.plus(Duration.ofDays(60));
NetworkTimeSuggestion networkTimeSuggestion =
mScript.generateNetworkTimeSuggestion(networkTime);
+ GnssTimeSuggestion gnssTimeSuggestion =
+ mScript.generateGnssTimeSuggestion(gnssTime);
TelephonyTimeSuggestion telephonyTimeSuggestion =
mScript.generateTelephonyTimeSuggestion(ARBITRARY_SLOT_INDEX, telephonyTime);
mScript.simulateNetworkTimeSuggestion(networkTimeSuggestion)
+ .simulateGnssTimeSuggestion(gnssTimeSuggestion)
.simulateTelephonyTimeSuggestion(telephonyTimeSuggestion)
.assertLatestNetworkSuggestion(networkTimeSuggestion)
+ .assertLatestGnssSuggestion(gnssTimeSuggestion)
.assertLatestTelephonySuggestion(ARBITRARY_SLOT_INDEX, telephonyTimeSuggestion)
.verifySystemClockWasSetAndResetCallTracking(telephonyTime.toEpochMilli());
}
@@ -696,20 +852,25 @@ public class TimeDetectorStrategyImplTest {
public void whenAllTimeSuggestionsAreAvailable_higherPriorityWins_higherPriorityComesFirst() {
mScript.pokeFakeClocks(ARBITRARY_CLOCK_INITIALIZATION_INFO)
.pokeAutoTimeDetectionEnabled(true)
- .pokeAutoOriginPriorities(ORIGIN_TELEPHONY, ORIGIN_NETWORK);
+ .pokeAutoOriginPriorities(ORIGIN_TELEPHONY, ORIGIN_NETWORK, ORIGIN_GNSS);
Instant networkTime = ARBITRARY_TEST_TIME;
Instant telephonyTime = ARBITRARY_TEST_TIME.plus(Duration.ofDays(30));
+ Instant gnssTime = ARBITRARY_TEST_TIME.plus(Duration.ofDays(60));
NetworkTimeSuggestion networkTimeSuggestion =
mScript.generateNetworkTimeSuggestion(networkTime);
TelephonyTimeSuggestion telephonyTimeSuggestion =
mScript.generateTelephonyTimeSuggestion(ARBITRARY_SLOT_INDEX, telephonyTime);
+ GnssTimeSuggestion gnssTimeSuggestion =
+ mScript.generateGnssTimeSuggestion(gnssTime);
mScript.simulateTelephonyTimeSuggestion(telephonyTimeSuggestion)
.simulateNetworkTimeSuggestion(networkTimeSuggestion)
+ .simulateGnssTimeSuggestion(gnssTimeSuggestion)
.assertLatestNetworkSuggestion(networkTimeSuggestion)
.assertLatestTelephonySuggestion(ARBITRARY_SLOT_INDEX, telephonyTimeSuggestion)
+ .assertLatestGnssSuggestion(gnssTimeSuggestion)
.verifySystemClockWasSetAndResetCallTracking(telephonyTime.toEpochMilli());
}
@@ -728,7 +889,37 @@ public class TimeDetectorStrategyImplTest {
}
@Test
- public void suggestionsFromSourceNotListedInPrioritiesList_areIgnored() {
+ public void whenHigherPrioritySuggestionsAreNotAvailable_fallbacksToNext() {
+ mScript.pokeFakeClocks(ARBITRARY_CLOCK_INITIALIZATION_INFO)
+ .pokeAutoTimeDetectionEnabled(true)
+ .pokeAutoOriginPriorities(ORIGIN_TELEPHONY, ORIGIN_NETWORK, ORIGIN_GNSS);
+
+ GnssTimeSuggestion timeSuggestion =
+ mScript.generateGnssTimeSuggestion(ARBITRARY_TEST_TIME);
+
+ mScript.simulateGnssTimeSuggestion(timeSuggestion)
+ .assertLatestGnssSuggestion(timeSuggestion)
+ .verifySystemClockWasSetAndResetCallTracking(ARBITRARY_TEST_TIME.toEpochMilli());
+ }
+
+ @Test
+ public void suggestionsFromTelephonyOriginNotInPriorityList_areIgnored() {
+ mScript.pokeFakeClocks(ARBITRARY_CLOCK_INITIALIZATION_INFO)
+ .pokeAutoTimeDetectionEnabled(true)
+ .pokeAutoOriginPriorities(ORIGIN_NETWORK);
+
+ int slotIndex = ARBITRARY_SLOT_INDEX;
+ Instant testTime = ARBITRARY_TEST_TIME;
+ TelephonyTimeSuggestion timeSuggestion =
+ mScript.generateTelephonyTimeSuggestion(slotIndex, testTime);
+
+ mScript.simulateTelephonyTimeSuggestion(timeSuggestion)
+ .assertLatestTelephonySuggestion(ARBITRARY_SLOT_INDEX, timeSuggestion)
+ .verifySystemClockWasNotSetAndResetCallTracking();
+ }
+
+ @Test
+ public void suggestionsFromNetworkOriginNotInPriorityList_areIgnored() {
mScript.pokeFakeClocks(ARBITRARY_CLOCK_INITIALIZATION_INFO)
.pokeAutoTimeDetectionEnabled(true)
.pokeAutoOriginPriorities(ORIGIN_TELEPHONY);
@@ -742,6 +933,20 @@ public class TimeDetectorStrategyImplTest {
}
@Test
+ public void suggestionsFromGnssOriginNotInPriorityList_areIgnored() {
+ mScript.pokeFakeClocks(ARBITRARY_CLOCK_INITIALIZATION_INFO)
+ .pokeAutoTimeDetectionEnabled(true)
+ .pokeAutoOriginPriorities(ORIGIN_TELEPHONY);
+
+ GnssTimeSuggestion timeSuggestion = mScript.generateGnssTimeSuggestion(
+ ARBITRARY_TEST_TIME);
+
+ mScript.simulateGnssTimeSuggestion(timeSuggestion)
+ .assertLatestGnssSuggestion(timeSuggestion)
+ .verifySystemClockWasNotSetAndResetCallTracking();
+ }
+
+ @Test
public void autoOriginPrioritiesList_doesNotAffectManualSuggestion() {
mScript.pokeFakeClocks(ARBITRARY_CLOCK_INITIALIZATION_INFO)
.pokeAutoTimeDetectionEnabled(false)
@@ -945,6 +1150,11 @@ public class TimeDetectorStrategyImplTest {
return this;
}
+ Script simulateGnssTimeSuggestion(GnssTimeSuggestion timeSuggestion) {
+ mTimeDetectorStrategy.suggestGnssTime(timeSuggestion);
+ return this;
+ }
+
Script simulateAutoTimeDetectionToggle() {
mFakeCallback.simulateAutoTimeZoneDetectionToggle();
mTimeDetectorStrategy.handleAutoTimeConfigChanged();
@@ -995,6 +1205,14 @@ public class TimeDetectorStrategyImplTest {
}
/**
+ * White box test info: Asserts the latest gnss suggestion is as expected.
+ */
+ Script assertLatestGnssSuggestion(GnssTimeSuggestion expected) {
+ assertEquals(expected, mTimeDetectorStrategy.getLatestGnssSuggestion());
+ return this;
+ }
+
+ /**
* White box test info: Returns the telephony suggestion that would be used, if any, given
* the current elapsed real time clock and regardless of origin prioritization.
*/
@@ -1011,6 +1229,14 @@ public class TimeDetectorStrategyImplTest {
}
/**
+ * White box test info: Returns the gnss suggestion that would be used, if any, given the
+ * current elapsed real time clock and regardless of origin prioritization.
+ */
+ GnssTimeSuggestion peekLatestValidGnssSuggestion() {
+ return mTimeDetectorStrategy.findLatestValidGnssSuggestionForTests();
+ }
+
+ /**
* Generates a ManualTimeSuggestion using the current elapsed realtime clock for the
* reference time.
*/
@@ -1057,6 +1283,18 @@ public class TimeDetectorStrategyImplTest {
}
/**
+ * Generates a GnssTimeSuggestion using the current elapsed realtime clock for the
+ * reference time.
+ */
+ GnssTimeSuggestion generateGnssTimeSuggestion(Instant suggestedTime) {
+ TimestampedValue<Long> utcTime =
+ new TimestampedValue<>(
+ mFakeCallback.peekElapsedRealtimeMillis(),
+ suggestedTime.toEpochMilli());
+ return new GnssTimeSuggestion(utcTime);
+ }
+
+ /**
* Calculates what the supplied time would be when adjusted for the movement of the fake
* elapsed realtime clock.
*/
diff --git a/services/tests/servicestests/src/com/android/server/timezone/OWNERS b/services/tests/servicestests/src/com/android/server/timezone/OWNERS
index 09447a971bdd..8f8089717e3b 100644
--- a/services/tests/servicestests/src/com/android/server/timezone/OWNERS
+++ b/services/tests/servicestests/src/com/android/server/timezone/OWNERS
@@ -1 +1,3 @@
-include /core/java/android/app/timezone/OWNERS
+# Bug component: 847766
+mingaleev@google.com
+include /core/java/android/app/timedetector/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/timezonedetector/OWNERS b/services/tests/servicestests/src/com/android/server/timezonedetector/OWNERS
index 09447a971bdd..8f8089717e3b 100644
--- a/services/tests/servicestests/src/com/android/server/timezonedetector/OWNERS
+++ b/services/tests/servicestests/src/com/android/server/timezonedetector/OWNERS
@@ -1 +1,3 @@
-include /core/java/android/app/timezone/OWNERS
+# Bug component: 847766
+mingaleev@google.com
+include /core/java/android/app/timedetector/OWNERS
diff --git a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java
index 4bf93a26ec03..283fae563ea3 100644
--- a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java
+++ b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java
@@ -1038,6 +1038,7 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
if (mModule != null) {
mModule.detach();
mModule = null;
+ mServiceDisabled = false;
}
}
}
diff --git a/test-mock/src/android/test/mock/OWNERS b/test-mock/src/android/test/mock/OWNERS
new file mode 100644
index 000000000000..36d9cb2654bb
--- /dev/null
+++ b/test-mock/src/android/test/mock/OWNERS
@@ -0,0 +1 @@
+set noparent
diff --git a/wifi/Android.bp b/wifi/Android.bp
index 7a9ca6012be5..c05f52c7bef5 100644
--- a/wifi/Android.bp
+++ b/wifi/Android.bp
@@ -43,6 +43,7 @@ filegroup {
srcs: [
":framework-wifi-updatable-java-sources",
":framework-wifi-updatable-exported-aidl-sources",
+ ":module-utils-os-aidls",
],
}
@@ -85,13 +86,14 @@ java_defaults {
"framework-wifi-util-lib",
"android.hardware.wifi-V1.0-java-constants",
"modules-utils-build",
+ "modules-utils-os",
],
libs: [
"unsupportedappusage", // for android.compat.annotation.UnsupportedAppUsage
],
srcs: [
":framework-wifi-updatable-sources",
- ":framework-wifi-util-lib-aidls",
+ ":module-utils-os-aidls",
],
}
diff --git a/wifi/jarjar-rules.txt b/wifi/jarjar-rules.txt
index dc96df67e866..b15a8d75fabe 100644
--- a/wifi/jarjar-rules.txt
+++ b/wifi/jarjar-rules.txt
@@ -110,8 +110,6 @@ rule org.ksoap2.** com.android.wifi.x.@0
rule fi.iki.elonen.** com.android.wifi.x.@0
## used by both framework-wifi and service-wifi ##
-rule android.content.pm.BaseParceledListSlice* com.android.wifi.x.@0
-rule android.content.pm.ParceledListSlice* com.android.wifi.x.@0
rule android.os.HandlerExecutor* com.android.wifi.x.@0
rule android.telephony.Annotation* com.android.wifi.x.@0
rule com.android.internal.util.AsyncChannel* com.android.wifi.x.@0
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index e7b8475405ad..0d4e9c3a513d 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -16,8 +16,6 @@
package android.net.wifi;
-import android.content.pm.ParceledListSlice;
-
import android.net.wifi.hotspot2.OsuProvider;
import android.net.wifi.hotspot2.PasspointConfiguration;
import android.net.wifi.hotspot2.IProvisioningCallback;
@@ -47,6 +45,8 @@ import android.os.Messenger;
import android.os.ResultReceiver;
import android.os.WorkSource;
+import com.android.modules.utils.ParceledListSlice;
+
/**
* Interface that allows controlling and querying Wi-Fi connectivity.
*
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 03114982a71c..bccb2410ae09 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -34,7 +34,6 @@ import android.annotation.SystemService;
import android.app.ActivityManager;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
-import android.content.pm.ParceledListSlice;
import android.net.ConnectivityManager;
import android.net.DhcpInfo;
import android.net.MacAddress;
@@ -63,6 +62,7 @@ import android.util.SparseArray;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.modules.utils.ParceledListSlice;
import com.android.modules.utils.build.SdkLevel;
import java.lang.annotation.Retention;