Merge "Fix null RollbackManager in RollbackHealthObserver and minor todos"
diff --git a/api/current.txt b/api/current.txt
index fa05e56..6a2c842 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5811,6 +5811,7 @@
method public final void setInterruptionFilter(int);
method public void setNotificationDelegate(@NonNull String);
method public void setNotificationPolicy(@NonNull android.app.NotificationManager.Policy);
+ method public boolean shouldHideSilentStatusBarIcons();
method public boolean updateAutomaticZenRule(String, android.app.AutomaticZenRule);
field public static final String ACTION_APP_BLOCK_STATE_CHANGED = "android.app.action.APP_BLOCK_STATE_CHANGED";
field public static final String ACTION_AUTOMATIC_ZEN_RULE = "android.app.action.AUTOMATIC_ZEN_RULE";
@@ -36527,7 +36528,7 @@
field public static final String ACCOUNT_TYPE_LOCAL = "LOCAL";
field public static final String ACTION_EVENT_REMINDER = "android.intent.action.EVENT_REMINDER";
field public static final String ACTION_HANDLE_CUSTOM_EVENT = "android.provider.calendar.action.HANDLE_CUSTOM_EVENT";
- field public static final String ACTION_VIEW_WORK_CALENDAR_EVENT = "android.provider.calendar.action.VIEW_WORK_CALENDAR_EVENT";
+ field public static final String ACTION_VIEW_MANAGED_PROFILE_CALENDAR_EVENT = "android.provider.calendar.action.VIEW_MANAGED_PROFILE_CALENDAR_EVENT";
field public static final String AUTHORITY = "com.android.calendar";
field public static final String CALLER_IS_SYNCADAPTER = "caller_is_syncadapter";
field public static final android.net.Uri CONTENT_URI;
@@ -41555,6 +41556,7 @@
method public void onNotificationRemoved(android.service.notification.StatusBarNotification);
method public void onNotificationRemoved(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap);
method public void onNotificationRemoved(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap, int);
+ method public void onStatusBarIconsBehaviorChanged(boolean);
method public final void requestInterruptionFilter(int);
method public final void requestListenerHints(int);
method public static void requestRebind(android.content.ComponentName);
diff --git a/api/system-current.txt b/api/system-current.txt
index 19b3f0e..44c3dfe 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -4095,6 +4095,7 @@
public class CaptivePortal implements android.os.Parcelable {
ctor public CaptivePortal(android.os.IBinder);
+ method public void logEvent(int, String);
method public void useNetwork();
field public static final int APP_RETURN_DISMISSED = 0; // 0x0
field public static final int APP_RETURN_UNWANTED = 1; // 0x1
diff --git a/api/test-current.txt b/api/test-current.txt
index 4fc1757..91d0019 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -804,6 +804,7 @@
public class CaptivePortal implements android.os.Parcelable {
ctor public CaptivePortal(android.os.IBinder);
+ method public void logEvent(int, String);
method public void useNetwork();
field public static final int APP_RETURN_DISMISSED = 0; // 0x0
field public static final int APP_RETURN_UNWANTED = 1; // 0x1
@@ -2386,6 +2387,10 @@
method public boolean isSystemGroup();
}
+ public abstract class LayoutInflater {
+ method public void setPrecompiledLayoutsEnabledForTesting(boolean);
+ }
+
public final class MotionEvent extends android.view.InputEvent implements android.os.Parcelable {
method public void setActionButton(int);
method public void setButtonState(int);
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index 8953940..ec78428 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -65,6 +65,9 @@
boolean areNotificationsEnabled(String pkg);
int getPackageImportance(String pkg);
+ boolean shouldHideSilentStatusIcons(String callingPkg);
+ void setHideSilentStatusIcons(boolean hide);
+
void setBubblesAllowed(String pkg, int uid, boolean allowed);
boolean areBubblesAllowed(String pkg);
boolean areBubblesAllowedForPackage(String pkg, int uid);
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 621f134..587b591 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -20,6 +20,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SdkConstant;
+import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
@@ -353,7 +354,8 @@
public static final int IMPORTANCE_MIN = 1;
/**
- * Low notification importance: shows everywhere, but is not intrusive.
+ * Low notification importance: Shows in the shade, and potentially in the status bar
+ * (see {@link #shouldHideSilentStatusBarIcons()}), but is not audibly intrusive.
*/
public static final int IMPORTANCE_LOW = 2;
@@ -1162,6 +1164,22 @@
}
}
+ /**
+ * Returns whether the user wants silent notifications (see {@link #IMPORTANCE_LOW} to appear
+ * in the status bar.
+ *
+ * <p>Only available for {@link #isNotificationListenerAccessGranted(ComponentName) notification
+ * listeners}.
+ */
+ public boolean shouldHideSilentStatusBarIcons() {
+ INotificationManager service = getService();
+ try {
+ return service.shouldHideSilentStatusIcons(mContext.getOpPackageName());
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
/** @hide */
public boolean isNotificationPolicyAccessGrantedForPackage(String pkg) {
INotificationManager service = getService();
diff --git a/core/java/android/net/CaptivePortal.java b/core/java/android/net/CaptivePortal.java
index 3b01266..3ab35e1 100644
--- a/core/java/android/net/CaptivePortal.java
+++ b/core/java/android/net/CaptivePortal.java
@@ -117,4 +117,17 @@
} catch (RemoteException e) {
}
}
+
+ /**
+ * Log a captive portal login event.
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ public void logEvent(int eventId, String packageName) {
+ try {
+ ICaptivePortal.Stub.asInterface(mBinder).logEvent(eventId, packageName);
+ } catch (RemoteException e) {
+ }
+ }
}
diff --git a/core/java/android/net/ICaptivePortal.aidl b/core/java/android/net/ICaptivePortal.aidl
index 56ae57d..707b4f6 100644
--- a/core/java/android/net/ICaptivePortal.aidl
+++ b/core/java/android/net/ICaptivePortal.aidl
@@ -22,4 +22,5 @@
*/
oneway interface ICaptivePortal {
void appResponse(int response);
+ void logEvent(int eventId, String packageName);
}
diff --git a/core/java/android/net/INetworkMonitorCallbacks.aidl b/core/java/android/net/INetworkMonitorCallbacks.aidl
index 0bc2575..a8682f9 100644
--- a/core/java/android/net/INetworkMonitorCallbacks.aidl
+++ b/core/java/android/net/INetworkMonitorCallbacks.aidl
@@ -26,4 +26,5 @@
void notifyPrivateDnsConfigResolved(in PrivateDnsConfigParcel config);
void showProvisioningNotification(String action);
void hideProvisioningNotification();
+ void logCaptivePortalLoginEvent(int eventId, String packageName);
}
\ No newline at end of file
diff --git a/core/java/android/provider/CalendarContract.java b/core/java/android/provider/CalendarContract.java
index 8a52f1f..3e5bd4b 100644
--- a/core/java/android/provider/CalendarContract.java
+++ b/core/java/android/provider/CalendarContract.java
@@ -138,8 +138,8 @@
* Action used to help apps show calendar events in the managed profile.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
- public static final String ACTION_VIEW_WORK_CALENDAR_EVENT =
- "android.provider.calendar.action.VIEW_WORK_CALENDAR_EVENT";
+ public static final String ACTION_VIEW_MANAGED_PROFILE_CALENDAR_EVENT =
+ "android.provider.calendar.action.VIEW_MANAGED_PROFILE_CALENDAR_EVENT";
/**
* Intent Extras key: {@link EventsColumns#CUSTOM_APP_URI} for the event in
@@ -166,7 +166,7 @@
public static final String EXTRA_EVENT_ALL_DAY = "allDay";
/**
- * Intent Extras key: The id of an event.
+ * Intent Extras key: An extra of type {@code long} holding the id of an event.
*/
public static final String EXTRA_EVENT_ID = "id";
@@ -218,7 +218,7 @@
* When this API is called, the system will attempt to start an activity
* in the managed profile with an intent targeting the same caller package.
* The intent will have its action set to
- * {@link CalendarContract#ACTION_VIEW_WORK_CALENDAR_EVENT} and contain extras
+ * {@link CalendarContract#ACTION_VIEW_MANAGED_PROFILE_CALENDAR_EVENT} and contain extras
* corresponding to the API's arguments. A calendar app intending to support
* cross-profile events viewing should handle this intent, parse the arguments
* and show the appropriate UI.
@@ -226,10 +226,10 @@
* @param context the context.
* @param eventId the id of the event to be viewed. Will be put into {@link #EXTRA_EVENT_ID}
* field of the intent.
- * @param start the start time of the event. Will be put into {@link #EXTRA_EVENT_BEGIN_TIME}
- * field of the intent.
- * @param end the end time of the event. Will be put into {@link #EXTRA_EVENT_END_TIME} field
- * of the intent.
+ * @param startMs the start time of the event in milliseconds since epoch.
+ * Will be put into {@link #EXTRA_EVENT_BEGIN_TIME} field of the intent.
+ * @param endMs the end time of the event in milliseconds since epoch.
+ * Will be put into {@link #EXTRA_EVENT_END_TIME} field of the intent.
* @param allDay if the event is an all-day event. Will be put into
* {@link #EXTRA_EVENT_ALL_DAY} field of the intent.
* @param flags flags to be set on the intent via {@link Intent#setFlags}
@@ -241,12 +241,12 @@
* @see #EXTRA_EVENT_ALL_DAY
*/
public static boolean startViewCalendarEventInManagedProfile(@NonNull Context context,
- long eventId, long start, long end, boolean allDay, int flags) {
+ long eventId, long startMs, long endMs, boolean allDay, int flags) {
Preconditions.checkNotNull(context, "Context is null");
final DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(
Context.DEVICE_POLICY_SERVICE);
- return dpm.startViewCalendarEventInManagedProfile(eventId, start,
- end, allDay, flags);
+ return dpm.startViewCalendarEventInManagedProfile(eventId, startMs,
+ endMs, allDay, flags);
}
/**
diff --git a/core/java/android/service/notification/INotificationListener.aidl b/core/java/android/service/notification/INotificationListener.aidl
index 1ddc099e..22104b5 100644
--- a/core/java/android/service/notification/INotificationListener.aidl
+++ b/core/java/android/service/notification/INotificationListener.aidl
@@ -33,6 +33,7 @@
void onListenerConnected(in NotificationRankingUpdate update);
void onNotificationPosted(in IStatusBarNotificationHolder notificationHolder,
in NotificationRankingUpdate update);
+ void onStatusBarIconsBehaviorChanged(boolean hideSilentStatusIcons);
// stats only for assistant
void onNotificationRemoved(in IStatusBarNotificationHolder notificationHolder,
in NotificationRankingUpdate update, in NotificationStats stats, int reason);
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index c734b63..d4e8879 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -469,6 +469,17 @@
}
/**
+ * Implement this method to be notified when the behavior of silent notifications in the status
+ * bar changes. See {@link NotificationManager#shouldHideSilentStatusBarIcons()}.
+ *
+ * @param hideSilentStatusIcons whether or not status bar icons should be hidden for silent
+ * notifications
+ */
+ public void onStatusBarIconsBehaviorChanged(boolean hideSilentStatusIcons) {
+ // optional
+ }
+
+ /**
* Implement this method to learn about notification channel modifications.
*
* <p>The caller must have {@link CompanionDeviceManager#getAssociations() an associated
@@ -1411,6 +1422,12 @@
mHandler.obtainMessage(
MyHandler.MSG_ON_NOTIFICATION_CHANNEL_GROUP_MODIFIED, args).sendToTarget();
}
+
+ @Override
+ public void onStatusBarIconsBehaviorChanged(boolean hideSilentStatusIcons) {
+ mHandler.obtainMessage(MyHandler.MSG_ON_STATUS_BAR_ICON_BEHAVIOR_CHANGED,
+ hideSilentStatusIcons).sendToTarget();
+ }
}
/**
@@ -2142,6 +2159,7 @@
public static final int MSG_ON_INTERRUPTION_FILTER_CHANGED = 6;
public static final int MSG_ON_NOTIFICATION_CHANNEL_MODIFIED = 7;
public static final int MSG_ON_NOTIFICATION_CHANNEL_GROUP_MODIFIED = 8;
+ public static final int MSG_ON_STATUS_BAR_ICON_BEHAVIOR_CHANGED = 9;
public MyHandler(Looper looper) {
super(looper, null, false);
@@ -2207,6 +2225,10 @@
int modificationType = (int) args.arg4;
onNotificationChannelGroupModified(pkgName, user, group, modificationType);
} break;
+
+ case MSG_ON_STATUS_BAR_ICON_BEHAVIOR_CHANGED: {
+ onStatusBarIconsBehaviorChanged((Boolean) msg.obj);
+ } break;
}
}
}
diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java
index dc7c343..6061cb2 100644
--- a/core/java/android/view/LayoutInflater.java
+++ b/core/java/android/view/LayoutInflater.java
@@ -20,6 +20,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemService;
+import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.pm.ApplicationInfo;
@@ -399,10 +400,15 @@
}
private void initPrecompiledViews() {
- // Check if precompiled layouts are enabled by a system property.
- mUseCompiledView =
- SystemProperties.getBoolean(USE_PRECOMPILED_LAYOUT_SYSTEM_PROPERTY, false);
+ initPrecompiledViews(
+ SystemProperties.getBoolean(USE_PRECOMPILED_LAYOUT_SYSTEM_PROPERTY, false));
+ }
+
+ private void initPrecompiledViews(boolean enablePrecompiledViews) {
+ mUseCompiledView = enablePrecompiledViews;
+
if (!mUseCompiledView) {
+ mPrecompiledClassLoader = null;
return;
}
@@ -431,6 +437,17 @@
}
mUseCompiledView = false;
}
+ if (!mUseCompiledView) {
+ mPrecompiledClassLoader = null;
+ }
+ }
+
+ /**
+ * @hide for use by CTS tests
+ */
+ @TestApi
+ public void setPrecompiledLayoutsEnabledForTesting(boolean enablePrecompiledLayouts) {
+ initPrecompiledViews(enablePrecompiledLayouts);
}
/**
diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto
index 712994b..a160451 100644
--- a/core/proto/android/providers/settings/global.proto
+++ b/core/proto/android/providers/settings/global.proto
@@ -230,8 +230,6 @@
}
optional Connectivity connectivity = 32;
- reserved 145; // Used to be ContentCapture, which moved to DeviceConfig
-
optional SettingProto contact_metadata_sync_enabled = 33 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto contacts_database_wal_enabled = 34 [ (android.privacy).dest = DEST_AUTOMATIC ];
@@ -1039,5 +1037,5 @@
// Please insert fields in alphabetical order and group them into messages
// if possible (to avoid reaching the method limit).
- // Next tag = 149;
+ // Next tag = 145 then 149; // (145 was removed)
}
diff --git a/libs/hwui/private/hwui/DrawVkInfo.h b/libs/hwui/private/hwui/DrawVkInfo.h
index abc4dbf..fb55f5c 100644
--- a/libs/hwui/private/hwui/DrawVkInfo.h
+++ b/libs/hwui/private/hwui/DrawVkInfo.h
@@ -29,7 +29,7 @@
VkDevice device;
VkQueue queue;
uint32_t graphics_queue_index;
- uint32_t instance_version;
+ uint32_t api_version;
const char* const* enabled_instance_extension_names;
uint32_t enabled_instance_extension_names_length;
const char* const* enabled_device_extension_names;
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp
index 1e75202..582d51e 100644
--- a/libs/hwui/renderthread/VulkanManager.cpp
+++ b/libs/hwui/renderthread/VulkanManager.cpp
@@ -83,7 +83,6 @@
mDevice = VK_NULL_HANDLE;
mPhysicalDevice = VK_NULL_HANDLE;
mInstance = VK_NULL_HANDLE;
- mInstanceVersion = 0u;
mInstanceExtensions.clear();
mDeviceExtensions.clear();
free_features_extensions_structs(mPhysicalDeviceFeatures2);
@@ -100,7 +99,7 @@
0, // applicationVersion
"android framework", // pEngineName
0, // engineVerison
- VK_MAKE_VERSION(1, 1, 0), // apiVersion
+ mAPIVersion, // apiVersion
};
{
@@ -377,8 +376,9 @@
}
GET_PROC(EnumerateInstanceVersion);
- LOG_ALWAYS_FATAL_IF(mEnumerateInstanceVersion(&mInstanceVersion));
- LOG_ALWAYS_FATAL_IF(mInstanceVersion < VK_MAKE_VERSION(1, 1, 0));
+ uint32_t instanceVersion;
+ LOG_ALWAYS_FATAL_IF(mEnumerateInstanceVersion(&instanceVersion));
+ LOG_ALWAYS_FATAL_IF(instanceVersion < VK_MAKE_VERSION(1, 1, 0));
GrVkExtensions extensions;
LOG_ALWAYS_FATAL_IF(!this->setupDevice(extensions, mPhysicalDeviceFeatures2));
@@ -398,7 +398,7 @@
backendContext.fDevice = mDevice;
backendContext.fQueue = mGraphicsQueue;
backendContext.fGraphicsQueueIndex = mGraphicsQueueIndex;
- backendContext.fInstanceVersion = mInstanceVersion;
+ backendContext.fMaxAPIVersion = mAPIVersion;
backendContext.fVkExtensions = &extensions;
backendContext.fDeviceFeatures2 = &mPhysicalDeviceFeatures2;
backendContext.fGetProc = std::move(getProc);
@@ -446,7 +446,7 @@
.device = mDevice,
.queue = mGraphicsQueue,
.graphics_queue_index = mGraphicsQueueIndex,
- .instance_version = mInstanceVersion,
+ .api_version = mAPIVersion,
.enabled_instance_extension_names = mInstanceExtensions.data(),
.enabled_instance_extension_names_length =
static_cast<uint32_t>(mInstanceExtensions.size()),
diff --git a/libs/hwui/renderthread/VulkanManager.h b/libs/hwui/renderthread/VulkanManager.h
index abe78ef..6426fe2 100644
--- a/libs/hwui/renderthread/VulkanManager.h
+++ b/libs/hwui/renderthread/VulkanManager.h
@@ -246,7 +246,7 @@
VkCommandBuffer mDummyCB = VK_NULL_HANDLE;
// Variables saved to populate VkFunctorInitParams.
- uint32_t mInstanceVersion = 0u;
+ static const uint32_t mAPIVersion = VK_MAKE_VERSION(1, 1, 0);
std::vector<const char*> mInstanceExtensions;
std::vector<const char*> mDeviceExtensions;
VkPhysicalDeviceFeatures2 mPhysicalDeviceFeatures2{};
diff --git a/native/webview/plat_support/draw_fn.h b/native/webview/plat_support/draw_fn.h
index e31ce19..5b3e496 100644
--- a/native/webview/plat_support/draw_fn.h
+++ b/native/webview/plat_support/draw_fn.h
@@ -84,7 +84,7 @@
VkDevice device;
VkQueue queue;
uint32_t graphics_queue_index;
- uint32_t instance_version;
+ uint32_t api_version;
const char* const* enabled_instance_extension_names;
uint32_t enabled_instance_extension_names_length;
const char* const* enabled_device_extension_names;
diff --git a/native/webview/plat_support/draw_functor.cpp b/native/webview/plat_support/draw_functor.cpp
index afe103a..6deb47f 100644
--- a/native/webview/plat_support/draw_functor.cpp
+++ b/native/webview/plat_support/draw_functor.cpp
@@ -102,7 +102,7 @@
.device = init_vk_params.device,
.queue = init_vk_params.queue,
.graphics_queue_index = init_vk_params.graphics_queue_index,
- .instance_version = init_vk_params.instance_version,
+ .api_version = init_vk_params.api_version,
.enabled_instance_extension_names =
init_vk_params.enabled_instance_extension_names,
.enabled_instance_extension_names_length =
diff --git a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
index 7eaf04b..0a571c5 100644
--- a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
+++ b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
@@ -60,7 +60,6 @@
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
-import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import java.io.IOException;
@@ -107,11 +106,11 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ mCaptivePortal = getIntent().getParcelableExtra(ConnectivityManager.EXTRA_CAPTIVE_PORTAL);
logMetricsEvent(MetricsEvent.ACTION_CAPTIVE_PORTAL_LOGIN_ACTIVITY);
mCm = ConnectivityManager.from(this);
mNetwork = getIntent().getParcelableExtra(ConnectivityManager.EXTRA_NETWORK);
- mCaptivePortal = getIntent().getParcelableExtra(ConnectivityManager.EXTRA_CAPTIVE_PORTAL);
mUserAgent =
getIntent().getStringExtra(ConnectivityManager.EXTRA_CAPTIVE_PORTAL_USER_AGENT);
mUrl = getUrl();
@@ -637,7 +636,7 @@
}
private void logMetricsEvent(int event) {
- MetricsLogger.action(this, event, getPackageName());
+ mCaptivePortal.logEvent(event, getPackageName());
}
private static final SparseArray<String> SSL_ERRORS = new SparseArray<>();
diff --git a/packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java b/packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
index f21561f..b34efc4 100644
--- a/packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
+++ b/packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
@@ -687,6 +687,15 @@
}
sendMessage(CMD_CAPTIVE_PORTAL_APP_FINISHED, response);
}
+
+ @Override
+ public void logEvent(int eventId, String packageName)
+ throws RemoteException {
+ mContext.enforceCallingPermission(
+ android.Manifest.permission.CONNECTIVITY_INTERNAL,
+ "CaptivePortal");
+ mCallback.logCaptivePortalLoginEvent(eventId, packageName);
+ }
}));
final CaptivePortalProbeResult probeRes = mLastPortalProbeResult;
intent.putExtra(EXTRA_CAPTIVE_PORTAL_URL, probeRes.detectUrl);
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 3453e79..a18eb76 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -593,11 +593,6 @@
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
android:process=":ui"
android:visibleToInstantApps="true">
- <intent-filter>
- <action android:name="android.intent.action.CHOOSER_UI" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.VOICE" />
- </intent-filter>
</activity>
<!-- Doze with notifications, run in main sysui process for every user -->
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
index f66a57b..9b3d7ed 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
@@ -137,8 +137,10 @@
}
public NotificationIconAreaController createNotificationIconAreaController(Context context,
- StatusBar statusBar, StatusBarStateController statusBarStateController) {
- return new NotificationIconAreaController(context, statusBar, statusBarStateController);
+ StatusBar statusBar, StatusBarStateController statusBarStateController,
+ NotificationListener listener) {
+ return new NotificationIconAreaController(context, statusBar, statusBarStateController,
+ listener);
}
public KeyguardIndicationController createKeyguardIndicationController(Context context,
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index 83fd970..8731bd5 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -238,14 +238,14 @@
*/
public void setExpandedBubble(BubbleView bubbleToExpand) {
mExpandedBubble = bubbleToExpand;
- boolean prevExpanded = mIsExpanded;
- mIsExpanded = true;
- if (!prevExpanded) {
+ if (!mIsExpanded) {
// If we weren't previously expanded we should animate open.
animateExpansion(true /* expand */);
} else {
- // If we were expanded just update the views
+ // Otherwise just update the views
+ // TODO: probably animate / page to expanded one
updateExpandedBubble();
+ updatePointerPosition();
requestUpdate();
}
mExpandedBubble.getEntry().setShowInShadeWhenBubble(false);
@@ -387,7 +387,6 @@
mIsExpanded = shouldExpand;
updateExpandedBubble();
applyCurrentState();
- //requestUpdate();
mIsAnimating = true;
@@ -400,7 +399,10 @@
if (shouldExpand) {
mBubbleContainer.setController(mExpandedAnimationController);
mExpandedAnimationController.expandFromStack(
- mStackAnimationController.getStackPosition(), updateAfter);
+ mStackAnimationController.getStackPosition(), () -> {
+ updatePointerPosition();
+ updateAfter.run();
+ });
} else {
mBubbleContainer.cancelAllAnimations();
mExpandedAnimationController.collapseBackToStack(
@@ -649,10 +651,7 @@
}
// Bubble with notification as expanded state doesn't need a header / title
mExpandedViewContainer.setHeaderText(null);
-
}
- float pointerPosition = mExpandedBubble.getPosition().x + (mExpandedBubble.getWidth() / 2);
- mExpandedViewContainer.setPointerPosition((int) pointerPosition);
}
private void applyCurrentState() {
@@ -690,6 +689,14 @@
}
}
+ private void updatePointerPosition() {
+ if (mExpandedBubble != null) {
+ float pointerPosition = mExpandedBubble.getPosition().x
+ + (mExpandedBubble.getWidth() / 2f);
+ mExpandedViewContainer.setPointerPosition((int) pointerPosition);
+ }
+ }
+
private void applyRowState(ExpandableNotificationRow view) {
view.reset();
view.setHeadsUp(false);
diff --git a/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyDialog.kt b/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyDialog.kt
index db5c244..e2688f1 100644
--- a/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyDialog.kt
+++ b/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyDialog.kt
@@ -19,6 +19,7 @@
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
+import android.content.pm.PackageManager
import android.content.res.ColorStateList
import android.os.UserHandle
import android.util.IconDrawableFactory
@@ -157,16 +158,21 @@
} else {
icons.visibility = View.GONE
}
- item.setOnClickListener(object : View.OnClickListener {
- val intent = Intent(Intent.ACTION_REVIEW_APP_PERMISSION_USAGE)
- .putExtra(Intent.EXTRA_PACKAGE_NAME, app.packageName)
- .putExtra(Intent.EXTRA_USER, UserHandle.getUserHandleForUid(app.uid))
- override fun onClick(v: View?) {
- Dependency.get(ActivityStarter::class.java)
- .postStartActivityDismissingKeyguard(intent, 0)
- dismissDialog?.invoke()
- }
- })
+ try {
+ // Check if package exists
+ context.packageManager.getPackageInfo(app.packageName, 0)
+ item.setOnClickListener(object : View.OnClickListener {
+ val intent = Intent(Intent.ACTION_REVIEW_APP_PERMISSION_USAGE)
+ .putExtra(Intent.EXTRA_PACKAGE_NAME, app.packageName)
+ .putExtra(Intent.EXTRA_USER, UserHandle.getUserHandleForUid(app.uid))
+ override fun onClick(v: View?) {
+ Dependency.get(ActivityStarter::class.java)
+ .postStartActivityDismissingKeyguard(intent, 0)
+ dismissDialog?.invoke()
+ }
+ })
+ } catch (e: PackageManager.NameNotFoundException) {}
+
itemList.addView(item)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java
index f3a46ce..0583843 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java
@@ -20,6 +20,8 @@
import static com.android.systemui.statusbar.phone.StatusBar.DEBUG;
import static com.android.systemui.statusbar.phone.StatusBar.ENABLE_CHILD_NOTIFICATIONS;
+import android.annotation.SuppressLint;
+import android.app.NotificationManager;
import android.content.ComponentName;
import android.content.Context;
import android.os.RemoteException;
@@ -32,10 +34,13 @@
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.NotificationListenerWithPlugins;
+import java.util.ArrayList;
+
/**
* This class handles listening to notification updates and passing them along to
* NotificationPresenter to be displayed to the user.
*/
+@SuppressLint("OverrideAbstract")
public class NotificationListener extends NotificationListenerWithPlugins {
private static final String TAG = "NotificationListener";
@@ -47,6 +52,7 @@
private final NotificationGroupManager mGroupManager =
Dependency.get(NotificationGroupManager.class);
+ private final ArrayList<NotificationSettingsListener> mSettingsListeners = new ArrayList<>();
private final Context mContext;
protected NotificationPresenter mPresenter;
@@ -55,6 +61,10 @@
mContext = context;
}
+ public void addNotificationSettingsListener(NotificationSettingsListener listener) {
+ mSettingsListeners.add(listener);
+ }
+
@Override
public void onListenerConnected() {
if (DEBUG) Log.d(TAG, "onListenerConnected");
@@ -70,6 +80,8 @@
mEntryManager.addNotification(sbn, currentRanking);
}
});
+ NotificationManager noMan = mContext.getSystemService(NotificationManager.class);
+ onStatusBarIconsBehaviorChanged(noMan.shouldHideSilentStatusBarIcons());
}
@Override
@@ -133,6 +145,13 @@
}
}
+ @Override
+ public void onStatusBarIconsBehaviorChanged(boolean hideSilentStatusIcons) {
+ for (NotificationSettingsListener listener : mSettingsListeners) {
+ listener.onStatusBarIconsBehaviorChanged(hideSilentStatusIcons);
+ }
+ }
+
public void setUpWithPresenter(NotificationPresenter presenter) {
mPresenter = presenter;
@@ -144,4 +163,10 @@
Log.e(TAG, "Unable to register notification listener", e);
}
}
+
+ public interface NotificationSettingsListener {
+
+ default void onStatusBarIconsBehaviorChanged(boolean hideSilentStatusIcons) { }
+
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
index e86996a..9e99fe9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
@@ -11,9 +11,7 @@
import android.view.ViewGroup;
import android.widget.FrameLayout;
-import androidx.annotation.NonNull;
-import androidx.collection.ArrayMap;
-
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.util.ContrastColorUtil;
import com.android.internal.widget.ViewClippingUtil;
@@ -21,6 +19,7 @@
import com.android.systemui.R;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
+import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.StatusBarStateController;
@@ -28,11 +27,13 @@
import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
-import com.android.systemui.tuner.TunerService;
import java.util.ArrayList;
import java.util.function.Function;
+import androidx.annotation.NonNull;
+import androidx.collection.ArrayMap;
+
/**
* A controller for the space in the status bar to the left of the system icons. This area is
* normally reserved for notifications.
@@ -46,18 +47,19 @@
private final NotificationEntryManager mEntryManager;
private final Runnable mUpdateStatusBarIcons = this::updateStatusBarIcons;
private final StatusBarStateController mStatusBarStateController;
- private final TunerService.Tunable mTunable = new TunerService.Tunable() {
- @Override
- public void onTuningChanged(String key, String newValue) {
- if (key.equals(LOW_PRIORITY)) {
- mShowLowPriority = "1".equals(newValue)
- || !NotificationUtils.useNewInterruptionModel(mContext);
- if (mNotificationScrollLayout != null) {
- updateStatusBarIcons();
+ @VisibleForTesting
+ final NotificationListener.NotificationSettingsListener mSettingsListener =
+ new NotificationListener.NotificationSettingsListener() {
+ @Override
+ public void onStatusBarIconsBehaviorChanged(boolean hideSilentStatusIcons) {
+ if (NotificationUtils.useNewInterruptionModel(mContext)) {
+ mShowLowPriority = !hideSilentStatusIcons;
+ if (mNotificationScrollLayout != null) {
+ updateStatusBarIcons();
+ }
+ }
}
- }
- }
- };
+ };
private int mIconSize;
private int mIconHPadding;
@@ -71,7 +73,7 @@
private ViewGroup mNotificationScrollLayout;
private Context mContext;
private boolean mFullyDark;
- private boolean mShowLowPriority;
+ private boolean mShowLowPriority = true;
/**
* Ratio representing being awake or in ambient mode, where 1 is dark and 0 awake.
@@ -90,15 +92,15 @@
view -> view instanceof StatusBarWindowView;
public NotificationIconAreaController(Context context, StatusBar statusBar,
- StatusBarStateController statusBarStateController) {
+ StatusBarStateController statusBarStateController,
+ NotificationListener notificationListener) {
mStatusBar = statusBar;
mContrastColorUtil = ContrastColorUtil.getInstance(context);
mContext = context;
mEntryManager = Dependency.get(NotificationEntryManager.class);
mStatusBarStateController = statusBarStateController;
mStatusBarStateController.addCallback(this);
-
- Dependency.get(TunerService.class).addTunable(mTunable, LOW_PRIORITY);
+ notificationListener.addNotificationSettingsListener(mSettingsListener);
initializeNotificationAreaViews(context);
}
@@ -243,6 +245,11 @@
true /* hideRepliedMessages */);
}
+ @VisibleForTesting
+ boolean shouldShouldLowPriorityIcons() {
+ return mShowLowPriority;
+ }
+
/**
* Updates the notification icons for a host layout. This will ensure that the notification
* host layout will have the same icons like the ones in here.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 1470d0f..ceadd1e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -801,7 +801,8 @@
mNotificationLogger.setUpWithContainer(notifListContainer);
mNotificationIconAreaController = SystemUIFactory.getInstance()
- .createNotificationIconAreaController(context, this, mStatusBarStateController);
+ .createNotificationIconAreaController(
+ context, this, mStatusBarStateController, mNotificationListener);
inflateShelf();
mNotificationIconAreaController.setupShelf(mNotificationShelf);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java
index c880172..bcf5964 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java
@@ -17,10 +17,12 @@
package com.android.systemui.statusbar;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.app.Notification;
+import android.app.NotificationManager;
import android.os.Handler;
import android.os.UserHandle;
import android.service.notification.NotificationListenerService;
@@ -55,6 +57,7 @@
// Dependency mocks:
@Mock private NotificationEntryManager mEntryManager;
@Mock private NotificationRemoteInputManager mRemoteInputManager;
+ @Mock private NotificationManager mNotificationManager;
private NotificationListener mListener;
private StatusBarNotification mSbn;
@@ -67,6 +70,7 @@
mRemoteInputManager);
mDependency.injectTestDependency(Dependency.MAIN_HANDLER,
new Handler(TestableLooper.get(this).getLooper()));
+ mContext.addMockSystemService(NotificationManager.class, mNotificationManager);
when(mEntryManager.getNotificationData()).thenReturn(mNotificationData);
@@ -106,4 +110,28 @@
// RankingMap may be modified by plugins.
verify(mEntryManager).updateNotificationRanking(any());
}
+
+ @Test
+ public void testOnConnectReadStatusBarSetting() {
+ NotificationListener.NotificationSettingsListener settingsListener =
+ mock(NotificationListener.NotificationSettingsListener.class);
+ mListener.addNotificationSettingsListener(settingsListener);
+
+ when(mNotificationManager.shouldHideSilentStatusBarIcons()).thenReturn(true);
+
+ mListener.onListenerConnected();
+
+ verify(settingsListener).onStatusBarIconsBehaviorChanged(true);
+ }
+
+ @Test
+ public void testOnStatusBarIconsBehaviorChanged() {
+ NotificationListener.NotificationSettingsListener settingsListener =
+ mock(NotificationListener.NotificationSettingsListener.class);
+ mListener.addNotificationSettingsListener(settingsListener);
+
+ mListener.onStatusBarIconsBehaviorChanged(true);
+
+ verify(settingsListener).onStatusBarIconsBehaviorChanged(true);
+ }
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java
new file mode 100644
index 0000000..13145b8
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar.phone;
+
+import static android.provider.Settings.Secure.NOTIFICATION_NEW_INTERRUPTION_MODEL;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import android.content.Context;
+import android.provider.Settings;
+import android.support.test.filters.SmallTest;
+import android.testing.AndroidTestingRunner;
+import android.testing.TestableLooper;
+
+import com.android.systemui.SysuiTestCase;
+import com.android.systemui.statusbar.CommandQueue;
+import com.android.systemui.statusbar.NotificationListener;
+import com.android.systemui.statusbar.StatusBarStateController;
+import com.android.systemui.statusbar.phone.LightBarTransitionsController.DarkIntensityApplier;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+@SmallTest
+@RunWith(AndroidTestingRunner.class)
+@TestableLooper.RunWithLooper
+public class NotificationIconAreaControllerTest extends SysuiTestCase {
+
+ @Mock
+ private NotificationListener mListener;
+ @Mock
+ StatusBar mStatusBar;
+ @Mock
+ StatusBarStateController mStatusBarStateController;
+ private NotificationIconAreaController mController;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+
+ mController = new NotificationIconAreaController(mContext, mStatusBar,
+ mStatusBarStateController, mListener);
+ }
+
+ @Test
+ public void testNotificationIcons_featureOff() {
+ Settings.Secure.putInt(
+ mContext.getContentResolver(), NOTIFICATION_NEW_INTERRUPTION_MODEL, 0);
+ assertTrue(mController.shouldShouldLowPriorityIcons());
+ }
+
+ @Test
+ public void testNotificationIcons_featureOn_settingHideIcons() {
+ Settings.Secure.putInt(
+ mContext.getContentResolver(), NOTIFICATION_NEW_INTERRUPTION_MODEL, 1);
+ mController.mSettingsListener.onStatusBarIconsBehaviorChanged(true);
+
+ assertFalse(mController.shouldShouldLowPriorityIcons());
+ }
+
+ @Test
+ public void testNotificationIcons_featureOn_settingShowIcons() {
+ Settings.Secure.putInt(
+ mContext.getContentResolver(), NOTIFICATION_NEW_INTERRUPTION_MODEL, 1);
+ mController.mSettingsListener.onStatusBarIconsBehaviorChanged(false);
+
+ assertTrue(mController.shouldShouldLowPriorityIcons());
+ }
+}
diff --git a/services/backup/java/com/android/server/backup/UserBackupManagerService.java b/services/backup/java/com/android/server/backup/UserBackupManagerService.java
index 7d228f1..8b2c1b9 100644
--- a/services/backup/java/com/android/server/backup/UserBackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/UserBackupManagerService.java
@@ -1863,7 +1863,7 @@
// The agent was running with a stub Application object, so shut it down.
// !!! We hardcode the confirmation UI's package name here rather than use a
// manifest flag! TODO something less direct.
- if (app.uid >= Process.FIRST_APPLICATION_UID
+ if (!UserHandle.isCore(app.uid)
&& !app.packageName.equals("com.android.backupconfirm")) {
if (MORE_DEBUG) Slog.d(TAG, "Killing agent host process");
mActivityManager.killApplicationProcess(app.processName, app.uid);
diff --git a/services/backup/java/com/android/server/backup/restore/PerformUnifiedRestoreTask.java b/services/backup/java/com/android/server/backup/restore/PerformUnifiedRestoreTask.java
index 7763d7b..324c2d9 100644
--- a/services/backup/java/com/android/server/backup/restore/PerformUnifiedRestoreTask.java
+++ b/services/backup/java/com/android/server/backup/restore/PerformUnifiedRestoreTask.java
@@ -45,9 +45,9 @@
import android.os.Bundle;
import android.os.Message;
import android.os.ParcelFileDescriptor;
-import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
+import android.os.UserHandle;
import android.util.EventLog;
import android.util.Slog;
@@ -1174,7 +1174,7 @@
// b. the app does not state android:killAfterRestore="false" in its manifest
final int appFlags = mCurrentPackage.applicationInfo.flags;
final boolean killAfterRestore =
- (mCurrentPackage.applicationInfo.uid >= Process.FIRST_APPLICATION_UID)
+ !UserHandle.isCore(mCurrentPackage.applicationInfo.uid)
&& ((mRestoreDescription.getDataType()
== RestoreDescription.TYPE_FULL_STREAM)
|| ((appFlags & ApplicationInfo.FLAG_KILL_AFTER_RESTORE) != 0));
diff --git a/services/backup/java/com/android/server/backup/utils/AppBackupUtils.java b/services/backup/java/com/android/server/backup/utils/AppBackupUtils.java
index 2db8928..7ee3047 100644
--- a/services/backup/java/com/android/server/backup/utils/AppBackupUtils.java
+++ b/services/backup/java/com/android/server/backup/utils/AppBackupUtils.java
@@ -31,7 +31,6 @@
import android.content.pm.PackageManagerInternal;
import android.content.pm.Signature;
import android.content.pm.SigningInfo;
-import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
import android.util.Slog;
@@ -72,7 +71,7 @@
}
// 2. they run as a system-level uid
- if ((app.uid < Process.FIRST_APPLICATION_UID)) {
+ if (UserHandle.isCore(app.uid)) {
// and the backup is happening for non-system user
if (userId != UserHandle.USER_SYSTEM && !app.packageName.equals(
PACKAGE_MANAGER_SENTINEL)) {
diff --git a/services/backup/java/com/android/server/backup/utils/RestoreUtils.java b/services/backup/java/com/android/server/backup/utils/RestoreUtils.java
index cce5b3b..97bde9c 100644
--- a/services/backup/java/com/android/server/backup/utils/RestoreUtils.java
+++ b/services/backup/java/com/android/server/backup/utils/RestoreUtils.java
@@ -34,7 +34,7 @@
import android.content.pm.Signature;
import android.os.Bundle;
import android.os.IBinder;
-import android.os.Process;
+import android.os.UserHandle;
import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
@@ -162,7 +162,7 @@
if (AppBackupUtils.signaturesMatch(sigs, pkg, pmi)) {
// If this is a system-uid app without a declared backup agent,
// don't restore any of the file data.
- if ((pkg.applicationInfo.uid < Process.FIRST_APPLICATION_UID)
+ if (UserHandle.isCore(pkg.applicationInfo.uid)
&& (pkg.applicationInfo.backupAgentName == null)) {
Slog.w(TAG, "Installed app " + info.packageName
+ " has restricted uid and no agent");
diff --git a/services/backup/java/com/android/server/backup/utils/TarBackupReader.java b/services/backup/java/com/android/server/backup/utils/TarBackupReader.java
index f4b235a..f3b8098 100644
--- a/services/backup/java/com/android/server/backup/utils/TarBackupReader.java
+++ b/services/backup/java/com/android/server/backup/utils/TarBackupReader.java
@@ -53,7 +53,7 @@
import android.content.pm.PackageManagerInternal;
import android.content.pm.Signature;
import android.os.Bundle;
-import android.os.Process;
+import android.os.UserHandle;
import android.util.Slog;
import com.android.server.backup.FileMetadata;
@@ -404,8 +404,7 @@
if ((flags & ApplicationInfo.FLAG_ALLOW_BACKUP) != 0) {
// Restore system-uid-space packages only if they have
// defined a custom backup agent
- if ((pkgInfo.applicationInfo.uid
- >= Process.FIRST_APPLICATION_UID)
+ if (!UserHandle.isCore(pkgInfo.applicationInfo.uid)
|| (pkgInfo.applicationInfo.backupAgentName != null)) {
// Verify signatures against any installed version; if they
// don't match, then we fall though and ignore the data. The
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index de7c8cc..58263fc 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -146,6 +146,7 @@
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.IBatteryStats;
+import com.android.internal.logging.MetricsLogger;
import com.android.internal.net.LegacyVpnInfo;
import com.android.internal.net.VpnConfig;
import com.android.internal.net.VpnInfo;
@@ -2685,6 +2686,11 @@
EVENT_PROVISIONING_NOTIFICATION, PROVISIONING_NOTIFICATION_HIDE,
mNai.network.netId));
}
+
+ @Override
+ public void logCaptivePortalLoginEvent(int eventId, String packageName) {
+ new MetricsLogger().action(eventId, packageName);
+ }
}
private boolean networkRequiresValidation(NetworkAgentInfo nai) {
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index 669ff2b..5e7ea05 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -234,6 +234,7 @@
private static native void nativeReloadPointerIcons(long ptr);
private static native void nativeSetCustomPointerIcon(long ptr, PointerIcon icon);
private static native void nativeSetPointerCapture(long ptr, boolean detached);
+ private static native boolean nativeCanDispatchToDisplay(long ptr, int deviceId, int displayId);
// Input event injection constants defined in InputDispatcher.h.
private static final int INPUT_EVENT_INJECTION_SUCCEEDED = 0;
@@ -1890,6 +1891,16 @@
return new String[0];
}
+ /**
+ * Gets if an input device could dispatch to the given display".
+ * @param deviceId The input device id.
+ * @param displayId The specific display id.
+ * @return True if the device could dispatch to the given display, false otherwise.
+ */
+ public boolean canDispatchToDisplay(int deviceId, int displayId) {
+ return nativeCanDispatchToDisplay(mPtr, deviceId, displayId);
+ }
+
// Native callback.
private int getKeyRepeatTimeout() {
return ViewConfiguration.getKeyRepeatTimeout();
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 467b192..e68bcda 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -2366,6 +2366,28 @@
}
@Override
+ public boolean shouldHideSilentStatusIcons(String callingPkg) {
+ checkCallerIsSameApp(callingPkg);
+
+ if (isCallerSystemOrPhone()
+ || mListeners.isListenerPackage(callingPkg)) {
+ return mPreferencesHelper.shouldHideSilentStatusIcons();
+ } else {
+ throw new SecurityException("Only available for notification listeners");
+ }
+ }
+
+ @Override
+ public void setHideSilentStatusIcons(boolean hide) {
+ checkCallerIsSystem();
+
+ mPreferencesHelper.setHideSilentStatusIcons(hide);
+ handleSavePolicyFile();
+
+ mListeners.onStatusBarIconsBehaviorChanged(hide);
+ }
+
+ @Override
public int getPackageImportance(String pkg) {
checkCallerIsSystemOrSameApp(pkg);
return mPreferencesHelper.getImportance(pkg, Binder.getCallingUid());
@@ -7324,6 +7346,20 @@
return mLightTrimListeners.contains(info) ? TRIM_LIGHT : TRIM_FULL;
}
+ public void onStatusBarIconsBehaviorChanged(boolean hideSilentStatusIcons) {
+ for (final ManagedServiceInfo info : getServices()) {
+ mHandler.post(() -> {
+ final INotificationListener listener = (INotificationListener) info.service;
+ try {
+ listener.onStatusBarIconsBehaviorChanged(hideSilentStatusIcons);
+ } catch (RemoteException ex) {
+ Log.e(TAG, "unable to notify listener "
+ + "(hideSilentStatusIcons): " + listener, ex);
+ }
+ });
+ }
+ }
+
/**
* asynchronously notify all listeners about a new notification
*
diff --git a/services/core/java/com/android/server/notification/PreferencesHelper.java b/services/core/java/com/android/server/notification/PreferencesHelper.java
index 3f0043c..6ed4f5c 100644
--- a/services/core/java/com/android/server/notification/PreferencesHelper.java
+++ b/services/core/java/com/android/server/notification/PreferencesHelper.java
@@ -76,6 +76,7 @@
private static final String TAG_CHANNEL = "channel";
private static final String TAG_GROUP = "channelGroup";
private static final String TAG_DELEGATE = "delegate";
+ private static final String TAG_STATUS_ICONS = "status_icons";
private static final String ATT_VERSION = "version";
private static final String ATT_NAME = "name";
@@ -89,10 +90,13 @@
private static final String ATT_APP_USER_LOCKED_FIELDS = "app_user_locked_fields";
private static final String ATT_ENABLED = "enabled";
private static final String ATT_USER_ALLOWED = "allowed";
+ private static final String ATT_HIDE_SILENT = "hide_silent";
private static final int DEFAULT_PRIORITY = Notification.PRIORITY_DEFAULT;
private static final int DEFAULT_VISIBILITY = NotificationManager.VISIBILITY_NO_OVERRIDE;
private static final int DEFAULT_IMPORTANCE = NotificationManager.IMPORTANCE_UNSPECIFIED;
+ @VisibleForTesting
+ static final boolean DEFAULT_HIDE_SILENT_STATUS_BAR_ICONS = false;
private static final boolean DEFAULT_SHOW_BADGE = true;
private static final boolean DEFAULT_ALLOW_BUBBLE = true;
private static final boolean DEFAULT_OEM_LOCKED_IMPORTANCE = false;
@@ -124,6 +128,7 @@
private SparseBooleanArray mBadgingEnabled;
private boolean mAreChannelsBypassingDnd;
+ private boolean mHideSilentStatusBarIcons;
public PreferencesHelper(Context context, PackageManager pm, RankingHandler rankingHandler,
ZenModeHelper zenHelper) {
@@ -143,9 +148,8 @@
String tag = parser.getName();
if (!TAG_RANKING.equals(tag)) return;
synchronized (mPackagePreferences) {
- // Clobber groups and channels with the xml, but don't delete other data that wasn't present
-
- // at the time of serialization.
+ // Clobber groups and channels with the xml, but don't delete other data that wasn't
+ // present at the time of serialization.
mRestoredWithoutUids.clear();
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT) {
tag = parser.getName();
@@ -153,7 +157,10 @@
return;
}
if (type == XmlPullParser.START_TAG) {
- if (TAG_PACKAGE.equals(tag)) {
+ if (TAG_STATUS_ICONS.equals(tag)) {
+ mHideSilentStatusBarIcons = XmlUtils.readBooleanAttribute(
+ parser, ATT_HIDE_SILENT, DEFAULT_HIDE_SILENT_STATUS_BAR_ICONS);
+ } else if (TAG_PACKAGE.equals(tag)) {
int uid = XmlUtils.readIntAttribute(parser, ATT_UID, UNKNOWN_UID);
String name = parser.getAttributeValue(null, ATT_NAME);
if (!TextUtils.isEmpty(name)) {
@@ -375,6 +382,11 @@
public void writeXml(XmlSerializer out, boolean forBackup) throws IOException {
out.startTag(null, TAG_RANKING);
out.attribute(null, ATT_VERSION, Integer.toString(XML_VERSION));
+ if (mHideSilentStatusBarIcons != DEFAULT_HIDE_SILENT_STATUS_BAR_ICONS) {
+ out.startTag(null, TAG_STATUS_ICONS);
+ out.attribute(null, ATT_HIDE_SILENT, String.valueOf(mHideSilentStatusBarIcons));
+ out.endTag(null, TAG_STATUS_ICONS);
+ }
synchronized (mPackagePreferences) {
final int N = mPackagePreferences.size();
@@ -781,6 +793,14 @@
}
}
+ public boolean shouldHideSilentStatusIcons() {
+ return mHideSilentStatusBarIcons;
+ }
+
+ public void setHideSilentStatusIcons(boolean hide) {
+ mHideSilentStatusBarIcons = hide;
+ }
+
public void lockChannelsForOEM(String[] appOrChannelList) {
if (appOrChannelList == null) {
return;
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index a8492fb..080f965 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -1665,35 +1665,42 @@
final int len = devices != null ? devices.length : 0;
for (int i = 0; i < len; i++) {
InputDevice device = devices[i];
- if (!device.isVirtual()) {
- final int sources = device.getSources();
- final int presenceFlag = device.isExternal() ?
- WindowManagerPolicy.PRESENCE_EXTERNAL :
- WindowManagerPolicy.PRESENCE_INTERNAL;
+ // Ignore virtual input device.
+ if (device.isVirtual()) {
+ continue;
+ }
- // TODO(multi-display): Configure on per-display basis.
- if (mWmService.mIsTouchDevice) {
- if ((sources & InputDevice.SOURCE_TOUCHSCREEN) ==
- InputDevice.SOURCE_TOUCHSCREEN) {
- config.touchscreen = Configuration.TOUCHSCREEN_FINGER;
- }
- } else {
- config.touchscreen = Configuration.TOUCHSCREEN_NOTOUCH;
- }
+ // Check if input device can dispatch events to current display.
+ // If display type is virtual, will follow the default display.
+ if (!mWmService.mInputManager.canDispatchToDisplay(device.getId(),
+ displayInfo.type == Display.TYPE_VIRTUAL ? DEFAULT_DISPLAY : mDisplayId)) {
+ continue;
+ }
- if ((sources & InputDevice.SOURCE_TRACKBALL) == InputDevice.SOURCE_TRACKBALL) {
- config.navigation = Configuration.NAVIGATION_TRACKBALL;
- navigationPresence |= presenceFlag;
- } else if ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD
- && config.navigation == Configuration.NAVIGATION_NONAV) {
- config.navigation = Configuration.NAVIGATION_DPAD;
- navigationPresence |= presenceFlag;
- }
+ final int sources = device.getSources();
+ final int presenceFlag = device.isExternal()
+ ? WindowManagerPolicy.PRESENCE_EXTERNAL : WindowManagerPolicy.PRESENCE_INTERNAL;
- if (device.getKeyboardType() == InputDevice.KEYBOARD_TYPE_ALPHABETIC) {
- config.keyboard = Configuration.KEYBOARD_QWERTY;
- keyboardPresence |= presenceFlag;
+ if (mWmService.mIsTouchDevice) {
+ if ((sources & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN) {
+ config.touchscreen = Configuration.TOUCHSCREEN_FINGER;
}
+ } else {
+ config.touchscreen = Configuration.TOUCHSCREEN_NOTOUCH;
+ }
+
+ if ((sources & InputDevice.SOURCE_TRACKBALL) == InputDevice.SOURCE_TRACKBALL) {
+ config.navigation = Configuration.NAVIGATION_TRACKBALL;
+ navigationPresence |= presenceFlag;
+ } else if ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD
+ && config.navigation == Configuration.NAVIGATION_NONAV) {
+ config.navigation = Configuration.NAVIGATION_DPAD;
+ navigationPresence |= presenceFlag;
+ }
+
+ if (device.getKeyboardType() == InputDevice.KEYBOARD_TYPE_ALPHABETIC) {
+ config.keyboard = Configuration.KEYBOARD_QWERTY;
+ keyboardPresence |= presenceFlag;
}
}
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp
index ff0b0d6..33317b5 100644
--- a/services/core/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/core/jni/com_android_server_input_InputManagerService.cpp
@@ -1652,6 +1652,13 @@
im->setCustomPointerIcon(spriteIcon);
}
+static jboolean nativeCanDispatchToDisplay(JNIEnv* env, jclass /* clazz */, jlong ptr,
+ jint deviceId, jint displayId) {
+
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
+ return im->getInputManager()->getReader()->canDispatchToDisplay(deviceId, displayId);
+}
+
// ----------------------------------------------------------------------------
static const JNINativeMethod gInputManagerMethods[] = {
@@ -1726,6 +1733,8 @@
(void*) nativeReloadPointerIcons },
{ "nativeSetCustomPointerIcon", "(JLandroid/view/PointerIcon;)V",
(void*) nativeSetCustomPointerIcon },
+ { "nativeCanDispatchToDisplay", "(JII)Z",
+ (void*) nativeCanDispatchToDisplay },
};
#define FIND_CLASS(var, className) \
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 51bdbb3..8f223b2 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -74,20 +74,14 @@
import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES;
import static android.provider.Settings.Global.PRIVATE_DNS_MODE;
import static android.provider.Settings.Global.PRIVATE_DNS_SPECIFIER;
-
import static android.provider.Telephony.Carriers.DPC_URI;
import static android.provider.Telephony.Carriers.ENFORCE_KEY;
import static android.provider.Telephony.Carriers.ENFORCE_MANAGED_URI;
-import static com.android.internal.logging.nano.MetricsProto.MetricsEvent
- .PROVISIONING_ENTRY_POINT_ADB;
-import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker
- .STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW;
-
+import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.PROVISIONING_ENTRY_POINT_ADB;
+import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW;
import static com.android.server.devicepolicy.TransferOwnershipMetadataManager.ADMIN_TYPE_DEVICE_OWNER;
import static com.android.server.devicepolicy.TransferOwnershipMetadataManager.ADMIN_TYPE_PROFILE_OWNER;
-
-
import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME;
import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
@@ -240,11 +234,11 @@
import com.android.internal.util.FunctionalUtils.ThrowingRunnable;
import com.android.internal.util.JournaledFile;
import com.android.internal.util.Preconditions;
+import com.android.internal.util.StatLogger;
import com.android.internal.util.XmlUtils;
import com.android.internal.widget.LockPatternUtils;
import com.android.server.LocalServices;
import com.android.server.LockGuard;
-import com.android.internal.util.StatLogger;
import com.android.server.SystemServerInitThreadPool;
import com.android.server.SystemService;
import com.android.server.devicepolicy.DevicePolicyManagerService.ActiveAdmin.TrustAgentInfo;
@@ -14207,7 +14201,8 @@
+ "calendar APIs", packageName));
return false;
}
- final Intent intent = new Intent(CalendarContract.ACTION_VIEW_WORK_CALENDAR_EVENT);
+ final Intent intent = new Intent(
+ CalendarContract.ACTION_VIEW_MANAGED_PROFILE_CALENDAR_EVENT);
intent.setPackage(packageName);
intent.putExtra(CalendarContract.EXTRA_EVENT_ID, eventId);
intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, start);
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
index bde9dde..47ec390 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
@@ -2006,6 +2006,28 @@
}
@Test
+ public void testXml_statusBarIcons_default() throws Exception {
+ ByteArrayOutputStream baos = writeXmlAndPurge(PKG_O, UID_O, false);
+ mHelper = new PreferencesHelper(getContext(), mPm, mHandler, mMockZenModeHelper);
+ loadStreamXml(baos, false);
+
+ assertEquals(PreferencesHelper.DEFAULT_HIDE_SILENT_STATUS_BAR_ICONS,
+ mHelper.shouldHideSilentStatusIcons());
+ }
+
+ @Test
+ public void testXml_statusBarIcons() throws Exception {
+ mHelper.setHideSilentStatusIcons(!PreferencesHelper.DEFAULT_HIDE_SILENT_STATUS_BAR_ICONS);
+
+ ByteArrayOutputStream baos = writeXmlAndPurge(PKG_O, UID_O, false);
+ mHelper = new PreferencesHelper(getContext(), mPm, mHandler, mMockZenModeHelper);
+ loadStreamXml(baos, false);
+
+ assertEquals(!PreferencesHelper.DEFAULT_HIDE_SILENT_STATUS_BAR_ICONS,
+ mHelper.shouldHideSilentStatusIcons());
+ }
+
+ @Test
public void testSetNotificationDelegate() {
mHelper.setNotificationDelegate(PKG_O, UID_O, "other", 53);
assertEquals("other", mHelper.getNotificationDelegate(PKG_O, UID_O));
diff --git a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
index 17847ea..145e269 100644
--- a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
+++ b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
@@ -23,17 +23,9 @@
import android.text.TextUtils;
import android.util.Log;
-import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
-import java.security.KeyFactory;
-import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -1126,6 +1118,12 @@
String value = PASSWORD_KEY.equals(key) ? "<removed>" : mFields.get(key);
sb.append(key).append(" ").append(value).append("\n");
}
+ if (mEapMethod >= 0 && mEapMethod < Eap.strings.length) {
+ sb.append("eap_method: ").append(Eap.strings[mEapMethod]).append("\n");
+ }
+ if (mPhase2Method > 0 && mPhase2Method < Phase2.strings.length) {
+ sb.append("phase2_method: ").append(Phase2.strings[mPhase2Method]).append("\n");
+ }
return sb.toString();
}