Commit Graph

24 Commits

Author SHA1 Message Date
Chaohui Wang
3e5c32df67 Clean up unused methods from AppStateAppOpsBridge
Bug: 258256121
Test: Manually with Settings
Change-Id: I88092cdf6135af784ec90bf0112526ae18557c94
2022-11-09 16:36:35 +08:00
Treehugger Robot
48b4af999a Merge "Fix array-related errorprone warnings" am: a93e78f781 am: a89e7aea3b am: cdacabf984 am: 49a0bbc650 am: ac7a368afd
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2183972

Change-Id: I0ebc25250b00a36bef5a72dd87192013b08e098f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-17 20:53:49 +00:00
Treehugger Robot
a93e78f781 Merge "Fix array-related errorprone warnings" 2022-08-17 18:37:46 +00:00
Cole Faust
a21ac03acb Fix array-related errorprone warnings
The ArrayEquals, ArrayHashCode, ArrayToString, and
ArraysAsListPrimitiveArray errorprone findings were
demoted from errors to warnings. Fix existing
occurrences of them so they can be made errors again.

Bug: 242630963
Test: RUN_ERROR_PRONE=true m javac-check
Change-Id: Ida6513002f8fd845a385924be290b720f06c4748
2022-08-15 18:52:37 -07:00
Rhed Jao
bd2bcd5cca [Settings] Passing correct user id to getAppOpPermissionPackages
A new user id parameter is added to the
IPackageManager#getAppOpPermissionPackages API. Update the new api
usage to the Settings application.

Bug: 229684723
Test: atest SettingsUnitTests
Test: m -j RunSettingsRoboTests \
      ROBOTEST_FILTER="AlarmsAndRemindersDetailsTest|
            AlarmsAndRemindersDetailPreferenceControllerTest"
Change-Id: I8c90f0a57426c669478367004571cca5dfb05cb6
2022-05-30 14:55:50 +08:00
Adam Bookatz
30dafd4140 UM.getUserHandle -> UM.getProcessUserId
UM is being made @UserHandleAware, so using an explicit method avoids ambiguity.

Bug: 201679968

Test: (No-op) compiles and treehugger
Change-Id: If067af7ced5017a9689cafbf99ceec1d26c06b3b
2021-10-05 12:55:22 -07:00
Suprabh Shukla
c8b9240535 Adding alarms and reminders activity
Adding a settings screen to control the permission SCHEDULE_EXACT_ALARM.
Apps can start this by starting a newly introduced API intent
REQUEST_SCHEDULE_EXACT_ALARM.

Test: make -j RunSettingsRoboTests
Manually by UI inspection:
Settings -> Apps -> Special App access -> Alarms and Reminders
or by running:
adb shell am start -a android.settings.REQUEST_SCHEDULE_EXACT_ALARM

Bug: 171306433
Bug: 171305516
Change-Id: I1293d38fc50a22b2af46f80ab24f676ed632f964
2021-02-23 22:32:24 -08:00
Tsung-Mao Fang
59e1e64258 Handle null case in AppStateAppOpsBridge
AppStateAppOpsBridge#getEntries returns null if no app
is requesting AppStateAppOpsBridge#mPermissions,
which would cause the settings app to crash in
AppStateAppOpsBridge#loadAllExtraInfo or
AppStateAppOpsBridge#loadAppOpsStates.

Try to skip null case here and set null for extraInfo
when we get null from AppStateAppOpsBridge#getEntries.

Change-Id: Iac03ec11869eeac62fa055da26b4b7a10dc65bb8
Fix: 147479269
Test: Open All files access and no crash.
2020-02-12 18:17:08 +08:00
Todd Kennedy
b6aaed1bfc Link PACKAGE_USAGE_STATS with LOADER_USAGE_STATS
Bug: 148374455
Test: Manual
Test: Create three packages; 1) only request PACKAGE_USAGE_STATS, 2) only request LOADER_USAGE_STATS, 3) request both
Test: Go to Settings -> Apps & Notifications -> Special app access
Test: See that there is only a single entry for "Usage access"
Test: Under "Usage access", see all three test apps appear
Test: Disable access for each application and verify that only the appop for the declared permisson is flipped using
Test: adb shell cmd appops get <<PACKAGE_NAME>>
Change-Id: I7741a703fd4494832347e51e113adf974cc31d2b
2020-01-27 15:15:02 -08:00
shafik
430b94bbc1 Add settings UI for MANAGE_EXTERNAL_STORAGE
Adds a Special App Access setting for the app-op
OP_MANAGE_EXTERNAL_STORAGE. All apps requesting the corresponding
permission will be displayed in the settings page. Toggling the
preference switch for an app will grant/revoke the app-op.

All of the external references to the permission, app-op and their
corresponding activities and logic use the name "Manage External
Storage". All of the external displays and strings use the name "All
files access"

Test: * Install app with uses-permission MANAGE_EXTERNAL_STORAGE
      * Observe it appearing the All files access page
      * Toggle the switch and observe the change in
        'adb shell dumpsys appops'
Bug: 146425146

Change-Id: If5c9c5daa3616a3310c090283acfda933bf9df26
2020-01-08 09:24:25 +00:00
Fan Zhang
23f8d59d02 Sort imports
Having consistent import order will reduce chance of merge
conflict between internal and external master

Test: rebuild
Change-Id: I0b1a170967ddcce7f388603fd521f6ed1eeba30b
2018-08-28 22:13:15 +00:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
Fan Zhang
01cfb9d8c5 Remove wrapper for ConnectionManager/IPackageManager
Bug: 76167422
Test: robotests
Change-Id: I5f051b0ce58b97a3cfd5d4bae469463dcd6d83ac
2018-04-02 17:09:10 -07:00
Tony Mantler
fb9e3afc84 Fix VisibleForTesting annotation in AppStateAppOpsBridge
Should be PRIVATE (the default) and not NONE since it's called from the
regular constructor for the object.

Bug: Clean-up
Test: Compiles
Change-Id: I9eb8881ed03dcddd1b478e313f5a314b338fccd7
2018-02-02 10:48:03 -08:00
Doris Ling
dee1a22c45 Consolidate all wrappers used for testing.
- Add the wrapper package and move all wrappers to the wrapper package.
- Get rid of some wrapper interface/impl implementation and have a
wrapper class directly.

Bug: 65634579
Test: make RunSettingsRoboTests
Change-Id: Ic757d8f7bacfa7a034c7e692205bc1dc4b0e1de1
2017-09-14 18:24:49 -07:00
Jian Zhou
3aee5e1ad0 Merge "Settings: Fix SparseArray null pointer issue in monkey issues"
am: 41b4d908bb

Change-Id: If3c634811506bdc9f3de5501e60f6a662ac2873a
2017-07-27 18:22:21 +00:00
Jian Zhou
2b7e3f228d Settings: Fix SparseArray null pointer issue in monkey issues
SparseArray null pointer causes monkey test exception, add a
protect for this.

Change-Id: Iade3148a846962875f5f38c5d2bf5631d0d9ac42

Bug: 62685823
2017-06-16 13:51:15 +08:00
Doris Ling
cc28cb372d Fix crash when primary user select app installed by secondary user.
- PackageManager.getPackageInfo() can return null. When trying to check
the app permission info, check for null package info and only process
the permission info when package info is available.
- Update usage of PackageManager.MATCH_UNINSTALLED_PACKAGES to
PackageManager.MATCH_ANY_USER, as the implementation for querying
packages for other users have been changed.
- Add PackageManager APIs used by AppStateAppOpsBridge to
IPackageManagerWrapper for test purpose.
- Change UserManager.get() to Context.getSystemService() to fix test
failure.

Change-Id: I52de924618aa252ffaae02b8f06ebe5b1d0def61
Fix: 37409266
Test: make RunSettingsRoboTests
2017-05-05 14:53:32 -07:00
Jason Monk
bde1a7cfb1 Fix crash in not installed for this user apps
Change-Id: I96fa409c5a91cdb6758dbf81714c1c97e28f47b6
Fixes: 28637871
2016-05-11 11:33:04 -04:00
Jason Monk
39b467482d Depend on support lib preferences
Bug: 24576551
Change-Id: Ic6190bacd3f7582c9bbc8de972da4612bd92421e
2015-10-13 10:12:20 -04:00
Billy Lau
3d9c7fc998 Bug: 21588539 Move CHANGE_NETWORK_STATE to be in SYSTEM_SETTINGS
Change the implementation of AppStateAppOpsBridge to handle multiple
requested permissions in one operation due to the merging of
CHANGE_NETWORK_STATE permission with WRITE_SETTINGS.

This change will affect the packages that will be listed under the
"Write system settings" option in Settings->Apps->[Gear/Cog].

Change-Id: I7d2304d2846b6f505a7b1c3fcf53e7a9bd184ed5
2015-08-04 23:44:36 +01:00
Billy Lau
fee785645b Bug: 22718745 Intents to 'draw over other apps' should go direct to the package's
page instead of the top level one

Settings:
Added two activities to handle app-specific Intent when app invoke permission
management UI.

SettingsActivity:
Added two fragment classes to handle app-specific Intent when app invoke permission
management UI.

AndroidManifest.xml:
We handle both Intent to top level settings and app-specific management UI for
app ops protected permissions.

AppStateAppOpsBridge:
Added a new field to PermissionState to keep track of permission declared vs one
that is actually granted during install time.

AppState{Overlay/Usage/WriteSettings}Bridge:
Updated the fields affected by changes in PermissionState.

{DrawOverlay/UsageAccess/WriteSettings}Details:
Disabled the toggling of permission if the app did not declare for the asked
permission.

Change-Id: Ibf63e4d9a4fbf7899a93d2176abb1204c4f75557
2015-07-29 23:04:57 +01:00
Billy Lau
7f70ba18e6 Bug: 21589105 Rescoping SYSTEM_ALERT_WINDOW and WRITE_SETTINGS permission to an
explicit toggle to be enabled through Settings via Apps -> Advanced Apps.

Added new and refactored an old xml to define the UX for two new Preferences
in Advanced Settings. Modified the existing AdvancedAppSettings to add
control flow for two new settings. Also enriched ManageApplications to
handle these cases. Added additional strings in xml/values/strings.xml
to support these settings. Also defined new classes to handle these the
toggle of these permissions per app.

Refactored codes from AppStateUsageBridge to a generic AppStateAppOpsBridge so
that future usages related to AppOps can inherit from this class.

Change-Id: I43b81282a063e05844c7805556a6d05cfc02bcdb
2015-07-13 22:39:49 +01:00