Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
208 commits
Select commit Hold shift + click to select a range
583ad82
Revert "wifidisplay: restrict broadcast by the proper permission"
Jul 15, 2021
559b87f
Revert "BG-FGS-start while-in-use permission restriction improve..."
Aug 25, 2021
c2175a1
Fix parsing code parcelling errors
Jun 18, 2021
5ebcf76
Bluetooth: Fix formatting in getAlias()
Aug 18, 2021
1922418
Backporting the change of ag/15629060 to rvc-dev
Sep 2, 2021
14572ee
TIF: fix issue of using caller-aware methods after clearCallingIdenti…
Aug 13, 2021
33e1edf
Changed INTERACT_ACROSS_PROFILES appop to be set per UID
May 4, 2021
21daffd
Revert "Revert "BG-FGS-start while-in-use permission restriction impr…
haggertk Nov 3, 2021
1a43f66
Fix NPE on getTitle()
Jul 6, 2020
4122be1
Fix serialization bug in GpsNavigationMessage
Sep 21, 2021
cf90a73
Do not show the notification footer until the user is set up.
Sep 17, 2021
b7d18fb
DO NOT MERGE KeyStore ChunkedStreamer must tolerate update consuming …
Sep 23, 2021
3f45961
Disallow overlays for ResolverActivity
Oct 5, 2020
4852fa4
Import translations. DO NOT MERGE ANYWHERE
Sep 21, 2021
3a8d46c
Prevent apps from spamming addAccountExplicitly.
May 17, 2021
131d972
Allow forcing status bar state changes and do so when the screen turn…
Oct 21, 2021
d449e44
Update deletion conditions for a package's UsageStats.
Nov 9, 2021
72e9572
Revert "Revert "[pm] remove old stage dirs on low storage""
schfan-1 Oct 14, 2021
2dc509b
RESTRICT AUTOMERGE Remove line of code that was mistakently left in.
Nov 15, 2021
b871bc0
[DO NOT MERGE] Controls - Do not recreate intent
mpietal79 Oct 4, 2021
35d62d8
DO NOT MERGE Re-implement reading/writing Throwables from/to Parcel, …
zhanghai Dec 31, 2020
e603830
Don't crash if default supervision profile owner is not set
Jan 26, 2021
dd7645a
Don't abandon child sessions (1/n)
Jan 3, 2022
c7fbb93
[RESTRICT AUTOMERGE] Fix the inconsistency of protection level
kjackal Dec 24, 2021
955376f
Check group channels for FGSes
Jan 7, 2022
24ed6e0
Handle onNullBinding
Jan 11, 2022
579a7ef
Only allow trusted overlays to specify FLAG_SLIPPERY
vishniakou Jul 20, 2021
44378eb
Add ALLOW_SLIPPERY_TOUCHES permission
vishniakou Nov 29, 2021
693fcb9
Revert "Revert "Revert "BG-FGS-start while-in-use permission restrict…
haggertk Apr 5, 2022
4fdd2d2
Prevent apps from creating blocked channel groups
Jan 12, 2022
97b4f1a
Restrict AdbManager broadcasts to apps with MANAGE_DEBUGGING permission.
jdd510 Dec 22, 2021
7dc919d
BG-FGS-start while-in-use permission restriction improvement.
Feb 7, 2022
875c00e
[RESTRICT AUTOMERGE] Add hide-non-system-overlay flag for HarmfulAppW…
Jan 18, 2022
3e9c7df
Filter notification APIs by user
Feb 11, 2022
5aa832c
[RESTRICT AUTOMERGE] Do not resume activity if behind a translucent task
Feb 8, 2022
c62a96c
[DO NOT MERGE] Keyguard - Treat messsages to lock with priority
mpietal79 Oct 1, 2021
44b0cbb
Verify caller before auto granting slice permission
pinyaoting Mar 3, 2022
2739efb
Always restart apps if base.apk gets updated.
alexbuy Feb 25, 2022
b5214c8
Update GeofenceHardwareRequestParcelable to match parcel/unparcel for…
Mar 11, 2022
59c543a
DO NOT MERGE Add an OEM configurable limit for zen rules
Mar 1, 2022
91c6a72
Fix security hole in GateKeeperResponse
Mar 16, 2022
4fa2183
Prevent non-admin users from deleting system apps.
Mar 25, 2022
f84107b
Fix NPE
Mar 31, 2022
f6454b3
[rvc] RESTRICT AUTOMERGE Add finalizeWorkProfileProvisioning.
jscott1989 Apr 5, 2022
faf30a2
limit TelecomManager#registerPhoneAccount to 10; api doc update
Jan 31, 2022
7d08d54
Disallow PAP authentication when MPPE is requested
RemiNVG Feb 28, 2022
9f6eba1
[RESTRICT AUTOMERGE] StorageManagerService: don't ignore failures to …
ebiggers Aug 13, 2021
76488e7
[RESTRICT AUTOMERGE] UserDataPreparer: reboot to recovery if preparin…
ebiggers Jan 24, 2022
ac5d80f
[RESTRICT AUTOMERGE] UserDataPreparer: reboot to recovery for system …
ebiggers Mar 4, 2022
905f7f7
[RESTRICT AUTOMERGE] Ignore errors preparing user storage for existin…
ebiggers Mar 4, 2022
05a1a22
[RESTRICT AUTOMERGE] Log to EventLog on prepareUserStorage failure
ebiggers Mar 26, 2022
2ce42a7
Crash invalid FGS notifications
Jul 7, 2021
f80d4f6
[RESTRICT AUTOMERGE]Only allow system and same app to apply relinquis…
Feb 21, 2022
fd085b4
DO NOT MERGE Suppress notifications when device enter lockdown
wenhao1006 Feb 2, 2022
98f8c51
Make sure callingPackage belongs to callingUid when checking BG-FGS r…
May 8, 2022
f05af87
Clear mInterface before calling resetIkeState()
Mar 30, 2022
11c5d57
Remove package title from notification access confirmation intent
Apr 22, 2022
64cfbc7
[RESTRICT AUTOMERGE]Prevent set intent on non-leaf tasks
May 27, 2022
53607b1
Stop using invalid URL to prevent unexpected crash
Jun 2, 2022
b17f4b0
Only allow the system server to connect to sync adapters
Apr 19, 2022
bd1cab7
Fix duplicate permission privilege escalation
Apr 28, 2022
afddff3
Parcel: recycle recycles
smore-lore Mar 30, 2022
2695526
Remove package name from SafetyNet logs
Jun 30, 2022
9e399bb
Restrict getInputMethodWindowVisibleHeight
adrianroos Feb 16, 2022
31e8422
Limit the number of concurrently snoozed notifications
Jul 1, 2022
c0d719c
Stop crashing the system on hitting the alarm limit
Jun 27, 2022
edf37cd
Block FullScreenIntent while device is in use if notification has a s…
Jul 18, 2022
dda51b9
DO NOT MERGE - Exclude TYPE_PRIVATE_PRESENTATION app visiblity
Aug 5, 2022
9d9e13c
Store DND rule owners
Jun 16, 2021
e3e0e9a
Fix NPE when deleting old zen rules
Jun 22, 2021
9737847
Enforce zen rule limit on a package level.
Jun 28, 2022
c3a8fce
DO NOT MERGE
Mar 22, 2022
902d3bd
switch TelecomManager List getters to ParceledListSlice
Jun 23, 2022
ce6b5f9
[RESTRICT AUTOMERGE] Do not send new Intent to non-exported activity …
Aug 2, 2022
50ec233
Do not send AccessibilityEvent if notification is for different user.
Daniel-Norman Aug 12, 2022
8d96665
DO NOT MERGE Fix auto-grant of AR runtime permission if device is upg…
Jun 30, 2022
43192d2
Check rule package name in ZenModeHelper.addAutomaticRule
Aug 25, 2022
3889803
Trim any long string inputs that come in to AutomaticZenRule
Aug 29, 2022
a01a298
[RESTRICT AUTOMERGE] Check permission for VoiceInteraction
Jul 18, 2022
3a96ce7
Fix system zen rules by using owner package name if caller is system
Sep 6, 2022
d192ab4
[DO NOT MERGE] Do not dismiss keyguard after SIM PUK unlock
mpietal79 Aug 18, 2022
7d9e3b2
Change InputWindowInfo::isTrustedOverlay() to be permission and flag …
lzye May 10, 2020
d03d1f5
Add mechanism for a task's windows to be trusted overlays
Jul 15, 2021
b88a2e6
DO NOT MERGE: Revert "Map TYPE_TRUSTED_APPLICATION_OVERLAY to system …
Oct 4, 2021
b968614
SurfaceControl: Add setDropInputMode api
Jan 26, 2022
51ad6b1
Drop input for toast and child surfaces
Feb 2, 2022
9bf7153
Revert "Prevent non-admin users from deleting system apps."
Jul 19, 2022
6778ac2
Limit the size of NotificationChannel and NotificationChannelGroup
Aug 19, 2022
fcd7769
Prevent non-admin users from deleting system apps.
Aug 9, 2022
dfcfbbf
Include all enabled services when FEEDBACK_ALL_MASK.
Daniel-Norman Sep 1, 2022
773e4d0
[pm] forbid deletion of protected packages
schfan-1 Sep 9, 2022
63af641
Fix NPE
Sep 6, 2022
6eede71
Fix a security issue in app widget service.
pinyaoting Jul 14, 2022
7a5f25f
[RESTRICT AUTOMERGE] Allow activity to be reparent while allowTaskRep…
Sep 14, 2022
3477648
[DO NOT MERGE] Update window with FLAG_SECURE when bouncer is showing
mpietal79 Sep 14, 2022
0df01d7
[Do Not Merge] Ignore malformed shortcuts
pinyaoting Sep 21, 2022
2c62e71
[DO NOT MERGE] Fix permanent denial of service via setComponentEnable…
Sep 26, 2022
495da93
Add safety checks on KEY_INTENT mismatch.
haok-ggl Oct 4, 2022
b4a40e4
Validate package name passed to setApplicationRestrictions.
Aug 19, 2022
42928a5
[DO NOT MERGE] Revert "Check rule package name in ZenModeHelper.addAu…
Nov 7, 2022
1ef4016
[DO NOT MERGE] Revert "Fix system zen rules by using owner package na…
Nov 7, 2022
e464f83
Limit lengths of fields in Condition to a max length.
Sep 13, 2022
7b6fd9c
Limit length and number of MIME types you can set
Aug 30, 2022
8a5a68d
Disable all A11yServices from an uninstalled package.
Daniel-Norman Oct 5, 2022
f607871
[DO NOT MERGE] Fix conditionId string trimming in AutomaticZenRule
Oct 12, 2022
ce52917
RESTRICT AUTOMERGE Validate permission tree size on permission update
Sep 22, 2022
681c53f
[RESTRICT AUTOMERGE] Trim the activity info of another uid if no priv…
Sep 28, 2022
9b5d485
RESTRICT AUTOMERGE Revoke SYSTEM_ALERT_WINDOW on upgrade past api 23
Sep 23, 2022
e2afd05
Add protections against queueing a UsbRequest when the underlying Usb…
Sep 23, 2022
d1a58f1
Fix sharing to another profile where an app has multiple targets
Oct 11, 2022
f404756
Ensure that only SysUI can override pending intent launch flags
Oct 18, 2022
ea41928
Make Activites touch opaque - DO NOT MERGE
Apr 28, 2022
b631111
[RESTRICT AUTOMERGE] Correct the behavior of ACTION_PACKAGE_DATA_CLEARED
kjackal Oct 25, 2022
8c22f85
Convert argument to intent in ChooseTypeAndAccountActivity
Nov 22, 2022
01af156
Use rule package name in addAutomaticZenRule; specify "android" for a…
Nov 9, 2022
536a818
Revert "[RESTRICT AUTOMERGE] Trim the activity info of another uid if…
Jan 4, 2023
bfc32ef
Move service initialization
May 16, 2022
4b17f4d
Stop managed profile owner granting READ_SMS
acjohnstong Oct 5, 2021
6cee00a
Enable user graularity for lockdown mode
wenhao1006 Aug 30, 2022
0e521bd
RESTRICT AUTOMERGE Revoke dev perm if app is upgrading to post 23 and…
Dec 2, 2022
636d60d
Reconcile WorkSource parcel and unparcel code.
Sep 26, 2022
fa2cc49
Revert "Ensure that only SysUI can override pending intent launch flags"
Jan 11, 2023
4aaae27
Checking if package belongs to UID before registering broadcast receiver
Nov 7, 2022
5f7f5c0
Fix checkKeyIntentParceledCorrectly's bypass
haok-ggl Dec 12, 2022
d328d72
Encode Intent scheme when serializing to URI string RESTRICT AUTOMERGE
Jan 6, 2023
aef7c25
[DO NOT MERGE] Backport BAL restrictions from S to R, this blocks app…
Dec 27, 2022
cee46be
[RESTRICT AUTOMERGE] Strip part of the activity info of another uid i…
Sep 28, 2022
ebbd1f8
Add a limit on channel group creation
Jan 18, 2022
afedc81
[RESTRICT AUTOMERGE] Fix bypass BG-FGS and BAL via package manager APIs
Jan 11, 2023
4eddf04
Revert "Make Activites touch opaque - DO NOT MERGE"
jwdunlap Mar 1, 2023
4fffca9
[RESTRICT AUTOMERGE][pm] prevent system app downgrades of versions lo…
schfan-1 Jan 27, 2023
6467f0a
[RESTRICT AUTOMERGE][pm] still allow debuggable for system app downgr…
schfan-1 Feb 2, 2023
7448dda
Checks if AccessibilityServiceInfo is within parcelable size.
Daniel-Norman Feb 9, 2023
0d3f380
Uri: check authority and scheme as part of determining URI path
ohodson Apr 7, 2022
a6e8b28
enforce stricter rules when registering phoneAccounts
Nov 22, 2022
4e6c5be
Make Activites touch opaque - DO NOT MERGE
Mar 1, 2023
88360b6
Trim strings added to persistent snoozed notification storage.
Jan 5, 2023
1c01054
Limit the number of shortcuts per app that can be retained by system
pinyaoting Feb 15, 2023
de67ebf
Fix WindowInputTests#testOverlapWindow failing (1/2)
Jul 23, 2020
1c7a677
[RESTRICT AUTOMERGE] [SettingsProvider] mem limit should be checked b…
schfan-1 Aug 17, 2022
104b0fc
[RESTRICT AUTOMERGE][SettingsProvider] key size limit for mutating se…
schfan-1 Oct 12, 2022
6ddb642
Prevent sharesheet from previewing unowned URIs
Feb 22, 2023
a832aad
[DO NOT MERGE] Wait for preloading images to complete before inflatin…
Feb 15, 2023
6662cf6
[DO NOT MERGE] Prevent RemoteViews crashing SystemUi
Feb 22, 2023
e1f0b62
Check key intent for selectors and prohibited flags
g-brnlee Feb 18, 2023
95cc3ca
Handle invalid data during job loading.
kwadkore Sep 21, 2022
18b16a1
Allow filtering of services
Mar 7, 2023
38f3ebe
Enforce DevicePolicyManager.setUserControlDisabledPackages in AppStan…
acjohnstong Mar 8, 2023
a61b7a7
[RESTRICT AUTOMERGE] Add BubbleMetadata detection to block FSI
Mar 24, 2023
5dd1bc5
Remove Activity if it enters PiP without window
hwwang-google Feb 23, 2023
365b1b7
Passpoint Add more check to limit the config size
Oct 26, 2022
88b9366
Sanitize VPN label to prevent HTML injection
Mar 3, 2023
d0a8bb3
Limit the number of supported v1 and v2 signers
mpgroover Mar 31, 2023
42d0edf
DO NOT MERGE: Add size check on PPS#policy
Apr 13, 2023
c9a1e3a
DO NOT MERGE: Limit the ServiceFriendlyNames
Apr 12, 2023
15a4329
Only allow NEW_TASK flag when adjusting pending intents
Feb 8, 2023
59bf6c7
DO NOT MERGE Dismiss keyguard when simpin auth'd and...
Mar 28, 2023
e59d9de
DO NOT MERGE Increase notification channel limit.
Apr 28, 2023
46c91e4
Verify URI permissions for EXTRA_REMOTE_INPUT_HISTORY_ITEMS.
Apr 21, 2023
a9358d1
Truncate ShortcutInfo Id
Apr 21, 2023
5298648
Visit URIs in landscape/portrait custom remote views.
Apr 27, 2023
0a1d6d0
DO NOT MERGE: ActivityManager#killBackgroundProcesses can kill caller…
Oct 26, 2022
58755c0
ActivityManagerService: Allow openContentUri from vendor/system/product.
gborgera2 Mar 18, 2023
e2ae7ba
Verify URI permissions for notification shortcutIcon.
Apr 27, 2023
fc2177e
On device lockdown, always show the keyguard
May 8, 2023
540d3e6
Ensure policy has no absurdly long strings
Apr 5, 2023
5429fbc
Implement visitUris for RemoteViews ViewGroupActionAdd.
May 12, 2023
734bbf0
Check URIs in notification public version.
May 15, 2023
22a5ddf
Verify URI permissions in MediaMetadata
Apr 28, 2023
8aea0d8
Use Settings.System.getIntForUser instead of getInt to make sure user…
chandrusekar47 May 16, 2023
ea7a010
Resolve StatusHints image exploit across user.
May 25, 2023
2bee990
DO NOT MERGE Revert "Verify URI permissions for EXTRA_REMOTE_INPUT_HI…
Jul 3, 2023
b803f3d
DO NOT MERGE Grant carrier privileges if package has carrier config a…
Nov 1, 2022
7b76bac
Ignore virtual presentation windows - RESTRICT AUTOMERGE
Jun 14, 2023
3712b40
Forbid granting access to NLSes with too-long component names
Jun 15, 2023
c079856
Update AccountManagerService checkKeyIntentParceledCorrectly.
Jun 30, 2023
fdd8adc
Improve user handling when querying for resumable media
Jun 22, 2023
a17d2aa
RingtoneManager: verify default ringtone is audio
jmtrivi Dec 7, 2022
5fc03f0
Add placeholder when media control title is blank
May 30, 2023
16a8860
Import translations. DO NOT MERGE ANYWHERE
Jun 21, 2023
9d41d42
Verify URI permissions for EXTRA_REMOTE_INPUT_HISTORY_ITEMS.
May 8, 2023
28f202d
Do not share key mappings with JNI object
Jun 26, 2023
2e881ad
[DO NOT MERGE] Verify URI Permissions in Autofill RemoteViews
Jun 20, 2023
3c61664
Fix KCM key mapping cloning
Jul 12, 2023
341e878
Disallow loading icon from content URI to PipMenu
hwwang-google May 25, 2023
1136375
Fixing DatabaseUtils to detect malformed UTF-16 strings
Jun 2, 2023
87c8caf
Add userId check before loading icon in Device Controls
Jul 4, 2023
f9b2711
RESTRICT AUTOMERGE: SettingsProvider: exclude secure_frp_mode from re…
ebiggers Jul 28, 2023
09e783a
[RESTRICT AUTOMERGE] Ignore small source rect hint
hwwang-google Jul 31, 2023
019db41
Revert "DO NOT MERGE Dismiss keyguard when simpin auth'd and..."
Aug 10, 2023
cd73140
DO NOT MERGE Fix BAL via notification.publicVersion
Jun 16, 2023
eb65225
[DO NOT MERGE] Check caller's uid in backupAgentCreated callback
piee199 Jul 27, 2023
1683b61
Use type safe API of readParcelableArray
199ashish Aug 3, 2023
e4ca53b
RESTRICT AUTOMERGE Make log reader thread a class member
Jul 24, 2023
f8d761d
[SettingsProvider] verify ringtone URI before setting
schfan-1 Aug 14, 2023
5dd09a8
Visit Uris added by WearableExtender
Jul 5, 2023
30acb43
Fix bypass BAL via `requestGeofence`
Jul 5, 2023
e1adb6d
Visit Uris related to Notification style extras
Aug 11, 2023
c3add36
RESTRICT AUTOMERGE: Drop invalid data.
kwadkore Sep 23, 2022
e8c6759
Validate URI-based shortcut icon at creation time.
pinyaoting Jul 12, 2023
2849567
Require permission to unlock keyguard
Jul 31, 2023
18c2463
Restrict number of shortcuts can be added through addDynamicShortcuts
pinyaoting Jun 8, 2023
6961808
Use readUniqueFileDescriptor in incidentd service
waghpawan Jun 13, 2023
19fd931
Validate userId when publishing shortcuts
pinyaoting Jul 24, 2023
ebc737d
Revert "On device lockdown, always show the keyguard"
Sep 14, 2023
ad9eeee
Adding in verification of calling UID in onShellCommand
Feb 2, 2023
8009b05
Updated: always show the keyguard on device lockdown
Sep 19, 2023
9279d75
RESTRICT AUTOMERGE: Check URI permissions for resumable media artwork
Aug 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ filegroup {
":framework_native_aidl",
":gatekeeper_aidl",
":gsiservice_aidl",
":guiconstants_aidl",
":incidentcompanion_aidl",
":installd_aidl",
":keystore_aidl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ void restrictApp(@NonNull String packageName, int userId,

void setActiveAdminApps(Set<String> adminPkgs, int userId);

void setAdminProtectedPackages(Set<String> packageNames, int userId);

void onAdminDataAvailable();

void clearCarrierPrivilegedApps();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,10 @@ public void run() {
}
} catch (XmlPullParserException | IOException e) {
Slog.wtf(TAG, "Error jobstore xml.", e);
} catch (Exception e) {
// Crashing at this point would result in a boot loop, so live with a general
// Exception for system stability's sake.
Slog.wtf(TAG, "Unexpected exception", e);
} finally {
if (mPersistInfo.countAllJobsLoaded < 0) { // Only set them once.
mPersistInfo.countAllJobsLoaded = numJobs;
Expand Down Expand Up @@ -817,6 +821,15 @@ private JobStatus restoreJobFromXml(boolean rtcIsGood, XmlPullParser parser)
} catch (NumberFormatException e) {
Slog.d(TAG, "Error reading constraints, skipping.");
return null;
} catch (XmlPullParserException e) {
Slog.d(TAG, "Error Parser Exception.", e);
return null;
} catch (IOException e) {
Slog.d(TAG, "Error I/O Exception.", e);
return null;
} catch (IllegalArgumentException e) {
Slog.e(TAG, "Constraints contained invalid data", e);
return null;
}
parser.next(); // Consume </constraints>

Expand Down Expand Up @@ -912,8 +925,14 @@ private JobStatus restoreJobFromXml(boolean rtcIsGood, XmlPullParser parser)
return null;
}

PersistableBundle extras = PersistableBundle.restoreFromXml(parser);
jobBuilder.setExtras(extras);
final PersistableBundle extras;
try {
extras = PersistableBundle.restoreFromXml(parser);
jobBuilder.setExtras(extras);
} catch (IllegalArgumentException e) {
Slog.e(TAG, "Persisted extras contained invalid data", e);
return null;
}
parser.nextTag(); // Consume </extras>

final JobInfo builtJob;
Expand Down Expand Up @@ -959,7 +978,8 @@ private JobInfo.Builder buildBuilderFromXml(XmlPullParser parser) throws NumberF
return new JobInfo.Builder(jobId, cname);
}

private void buildConstraintsFromXml(JobInfo.Builder jobBuilder, XmlPullParser parser) {
private void buildConstraintsFromXml(JobInfo.Builder jobBuilder, XmlPullParser parser)
throws XmlPullParserException, IOException {
String val;

final String netCapabilities = parser.getAttributeValue(null, "net-capabilities");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ static class Lock {}
@GuardedBy("mActiveAdminApps")
private final SparseArray<Set<String>> mActiveAdminApps = new SparseArray<>();

/** List of admin protected packages. Can contain {@link android.os.UserHandle#USER_ALL}. */
@GuardedBy("mAdminProtectedPackages")
private final SparseArray<Set<String>> mAdminProtectedPackages = new SparseArray<>();

/**
* Set of system apps that are headless (don't have any declared activities, enabled or
* disabled). Presence in this map indicates that the app is a headless system app.
Expand Down Expand Up @@ -1019,6 +1023,9 @@ public void onUserRemoved(int userId) {
synchronized (mActiveAdminApps) {
mActiveAdminApps.remove(userId);
}
synchronized (mAdminProtectedPackages) {
mAdminProtectedPackages.remove(userId);
}
}
}

Expand Down Expand Up @@ -1108,6 +1115,10 @@ private int getAppMinBucket(String packageName, int appId, int userId) {
return STANDBY_BUCKET_EXEMPTED;
}

if (isAdminProtectedPackages(packageName, userId)) {
return STANDBY_BUCKET_EXEMPTED;
}

if (isActiveNetworkScorer(packageName)) {
return STANDBY_BUCKET_EXEMPTED;
}
Expand Down Expand Up @@ -1510,6 +1521,17 @@ boolean isActiveDeviceAdmin(String packageName, int userId) {
}
}

private boolean isAdminProtectedPackages(String packageName, int userId) {
synchronized (mAdminProtectedPackages) {
if (mAdminProtectedPackages.contains(UserHandle.USER_ALL)
&& mAdminProtectedPackages.get(UserHandle.USER_ALL).contains(packageName)) {
return true;
}
return mAdminProtectedPackages.contains(userId)
&& mAdminProtectedPackages.get(userId).contains(packageName);
}
}

@Override
public void addActiveDeviceAdmin(String adminPkg, int userId) {
synchronized (mActiveAdminApps) {
Expand All @@ -1533,6 +1555,17 @@ public void setActiveAdminApps(Set<String> adminPkgs, int userId) {
}
}

@Override
public void setAdminProtectedPackages(Set<String> packageNames, int userId) {
synchronized (mAdminProtectedPackages) {
if (packageNames == null || packageNames.isEmpty()) {
mAdminProtectedPackages.remove(userId);
} else {
mAdminProtectedPackages.put(userId, packageNames);
}
}
}

@Override
public void onAdminDataAvailable() {
mAdminDataAvailableLatch.countDown();
Expand All @@ -1555,6 +1588,13 @@ Set<String> getActiveAdminAppsForTest(int userId) {
}
}

@VisibleForTesting
Set<String> getAdminProtectedPackagesForTest(int userId) {
synchronized (mAdminProtectedPackages) {
return mAdminProtectedPackages.get(userId);
}
}

/**
* Returns {@code true} if the supplied package is the device provisioning app. Otherwise,
* returns {@code false}.
Expand Down
20 changes: 12 additions & 8 deletions cmds/incidentd/src/IncidentService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,13 @@ status_t IncidentService::onTransact(uint32_t code, const Parcel& data, Parcel*

switch (code) {
case SHELL_COMMAND_TRANSACTION: {
int in = data.readFileDescriptor();
int out = data.readFileDescriptor();
int err = data.readFileDescriptor();
unique_fd in, out, err;
if (status_t status = data.readUniqueFileDescriptor(&in); status != OK) return status;

if (status_t status = data.readUniqueFileDescriptor(&out); status != OK) return status;

if (status_t status = data.readUniqueFileDescriptor(&err); status != OK) return status;

int argc = data.readInt32();
Vector<String8> args;
for (int i = 0; i < argc && data.dataAvail() > 0; i++) {
Expand All @@ -512,15 +516,15 @@ status_t IncidentService::onTransact(uint32_t code, const Parcel& data, Parcel*
sp<IResultReceiver> resultReceiver =
IResultReceiver::asInterface(data.readStrongBinder());

FILE* fin = fdopen(in, "r");
FILE* fout = fdopen(out, "w");
FILE* ferr = fdopen(err, "w");
FILE* fin = fdopen(in.release(), "r");
FILE* fout = fdopen(out.release(), "w");
FILE* ferr = fdopen(err.release(), "w");

if (fin == NULL || fout == NULL || ferr == NULL) {
resultReceiver->send(NO_MEMORY);
} else {
err = command(fin, fout, ferr, args);
resultReceiver->send(err);
status_t result = command(fin, fout, ferr, args);
resultReceiver->send(result);
}

if (fin != NULL) {
Expand Down
23 changes: 21 additions & 2 deletions cmds/statsd/src/StatsService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,15 @@ StatsService::StatsService(const sp<Looper>& handlerLooper, shared_ptr<LogEventQ
init_system_properties();

if (mEventQueue != nullptr) {
std::thread pushedEventThread([this] { readLogs(); });
pushedEventThread.detach();
mLogsReaderThread = std::make_unique<std::thread>([this] { readLogs(); });
}
}

StatsService::~StatsService() {
if (mEventQueue != nullptr) {
stopReadingLogs();
mLogsReaderThread->join();
}
}

/* Runs on a dedicated thread to process pushed events. */
Expand All @@ -177,6 +180,13 @@ void StatsService::readLogs() {
while (1) {
// Block until an event is available.
auto event = mEventQueue->waitPop();

// Below flag will be set when statsd is exiting and log event will be pushed to break
// out of waitPop.
if (mIsStopRequested) {
break;
}

// Pass it to StatsLogProcess to all configs/metrics
// At this point, the LogEventQueue is not blocked, so that the socketListener
// can read events from the socket and write to buffer to avoid data drop.
Expand Down Expand Up @@ -1335,6 +1345,15 @@ void StatsService::statsCompanionServiceDiedImpl() {
mPullerManager->SetStatsCompanionService(nullptr);
}

void StatsService::stopReadingLogs() {
mIsStopRequested = true;
// Push this event so that readLogs will process and break out of the loop
// after the stop is requested.
int64_t timeStamp;
std::unique_ptr<LogEvent> logEvent = std::make_unique<LogEvent>(/*uid=*/0, /*pid=*/0);
mEventQueue->push(std::move(logEvent), &timeStamp);
}

} // namespace statsd
} // namespace os
} // namespace android
8 changes: 8 additions & 0 deletions cmds/statsd/src/StatsService.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,13 @@ class StatsService : public BnStatsd {
*/
void statsCompanionServiceDiedImpl();

/*
* This method is used to stop log reader thread.
*/
void stopReadingLogs();

std::atomic<bool> mIsStopRequested = false;

/**
* Tracks the uid <--> package name mapping.
*/
Expand Down Expand Up @@ -380,6 +387,7 @@ class StatsService : public BnStatsd {
*/
mutable mutex mShellSubscriberMutex;
std::shared_ptr<LogEventQueue> mEventQueue;
std::unique_ptr<std::thread> mLogsReaderThread;

MultiConditionTrigger mBootCompleteTrigger;
static const inline string kBootCompleteTag = "BOOT_COMPLETE";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,10 @@ private void sendServiceInfo() {
IAccessibilityServiceConnection connection =
AccessibilityInteractionClient.getInstance().getConnection(mConnectionId);
if (mInfo != null && connection != null) {
if (!mInfo.isWithinParcelableSize()) {
throw new IllegalStateException(
"Cannot update service info: size is larger than safe parcelable limits.");
}
try {
connection.setServiceInfo(mInfo);
mInfo = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import android.graphics.drawable.Drawable;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Build;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
Expand Down Expand Up @@ -1028,6 +1029,15 @@ public int describeContents() {
return 0;
}

/** @hide */
public final boolean isWithinParcelableSize() {
final Parcel parcel = Parcel.obtain();
writeToParcel(parcel, 0);
final boolean result = parcel.dataSize() <= IBinder.MAX_IPC_SIZE;
parcel.recycle();
return result;
}

public void writeToParcel(Parcel parcel, int flagz) {
parcel.writeInt(eventTypes);
parcel.writeStringArray(packageNames);
Expand Down
7 changes: 7 additions & 0 deletions core/java/android/accounts/Account.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import com.android.internal.annotations.GuardedBy;

import java.util.Objects;
import java.util.Set;

/**
Expand Down Expand Up @@ -85,6 +86,12 @@ public Account(String name, String type, String accessId) {
if (TextUtils.isEmpty(type)) {
throw new IllegalArgumentException("the type must not be empty: " + type);
}
if (name.length() > 200) {
throw new IllegalArgumentException("account name is longer than 200 characters");
}
if (type.length() > 200) {
throw new IllegalArgumentException("account type is longer than 200 characters");
}
this.name = name;
this.type = type;
this.accessId = accessId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public void run(final AccountManagerFuture<Bundle> accountManagerFuture) {
mExistingAccounts = AccountManager.get(this).getAccountsForPackage(mCallingPackage,
mCallingUid);
intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(intent, REQUEST_ADD_ACCOUNT);
startActivityForResult(new Intent(intent), REQUEST_ADD_ACCOUNT);
return;
}
} catch (OperationCanceledException e) {
Expand Down
3 changes: 3 additions & 0 deletions core/java/android/app/ActivityManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -3933,6 +3933,9 @@ public void restartPackage(String packageName) {
* processes to reclaim memory; the system will take care of restarting
* these processes in the future as needed.
*
* <p class="note">Third party applications can only use this API to kill their own processes.
* </p>
*
* @param packageName The name of the package whose processes are to
* be killed.
*/
Expand Down
16 changes: 10 additions & 6 deletions core/java/android/app/ActivityOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.content.Intent.FLAG_RECEIVER_FOREGROUND;
import static android.view.Display.INVALID_DISPLAY;

import android.annotation.NonNull;
Expand Down Expand Up @@ -61,7 +63,7 @@
* {@link android.content.Context#startActivity(android.content.Intent, android.os.Bundle)
* Context.startActivity(Intent, Bundle)} and related methods.
*/
public class ActivityOptions {
public class ActivityOptions extends ComponentOptions {
private static final String TAG = "ActivityOptions";

/**
Expand Down Expand Up @@ -963,13 +965,12 @@ public boolean getLaunchTaskBehind() {
}

private ActivityOptions() {
super();
}

/** @hide */
public ActivityOptions(Bundle opts) {
// If the remote side sent us bad parcelables, they won't get the
// results they want, which is their loss.
opts.setDefusable(true);
super(opts);

mPackageName = opts.getString(KEY_PACKAGE_NAME);
try {
Expand Down Expand Up @@ -1373,7 +1374,9 @@ public void setPendingIntentLaunchFlags(@android.content.Intent.Flags int flags)
* @hide
*/
public int getPendingIntentLaunchFlags() {
return mPendingIntentLaunchFlags;
// b/243794108: Ignore all flags except the new task flag, to be reconsidered in b/254490217
return mPendingIntentLaunchFlags &
(FLAG_ACTIVITY_NEW_TASK | FLAG_RECEIVER_FOREGROUND);
}

/**
Expand Down Expand Up @@ -1575,8 +1578,9 @@ public void update(ActivityOptions otherOptions) {
* object; you must not modify it, but can supply it to the startActivity
* methods that take an options Bundle.
*/
@Override
public Bundle toBundle() {
Bundle b = new Bundle();
Bundle b = super.toBundle();
if (mPackageName != null) {
b.putString(KEY_PACKAGE_NAME, mPackageName);
}
Expand Down
Loading