Commit Graph

39 Commits

Author SHA1 Message Date
Jason Chiu
5d82f6a648 Remove the package name restriction of ACTION_UNINSTALL_PACKAGE
PackageInstaller has protected the intent action by setting
"android:priority=1".

Test: manual
Fix: 332228634
Change-Id: If0794e5957366d8b26acd0362b59c6c9076a0c4f
2024-04-17 16:26:52 +08:00
Jason Chiu
071dfe8691 [Safer intents] Applications
To avoid implicit intents, make intents launch explicitly.

Test: build, robotest
Bug: 323061508
Change-Id: I9bf4eb102550f4afd8d14a6799940d37fc0ab9a7
2024-03-28 04:13:47 +00:00
lpeter
b3e2179531 Allow uninstallation of current home app
Change the behavior to allow uninstallation of the current home app
if it is a non-system app and/or there are other candidate apps
available.

Bug: 131721576
Test: atest com.android.settings.applications.appinfo.AppButtonsPreferenceControllerTest
Test: atest com.android.settings.spa.app.appinfo.AppButtonRepositoryTest
Change-Id: I556966894240aaf91c0e6424dce514b6a35d1001
2024-02-01 23:57:15 +00:00
David Liu
fcb6e1a5ac Fixed logging ACTION_SETTINGS_DISABLE_APP with package name
Bug: 317386395
Test: fixing metrics only + local build pass
Change-Id: I6bac53d3219315f9d225bfe367c7b3bdc423ca7c
2023-12-21 19:49:27 +00:00
Chaohui Wang
778c2dc3d5 Remove context from applicationFeatureProvider
ApplicationFeatureProvider is created by using application context,
no need pass context in when get.

Bug: 286764889
Test: m Settings
Change-Id: I7f8dfe5716b7b55e0ff984f7603875d7896e2313
2023-07-03 13:54:26 +08:00
Alisher Alikhodjaev
c0fd86f781 Revert "Update for Utils.isSystemPackage()"
Revert submission 20385585-isSystemPackage

Reason for revert: DroidMonitor: Potential culprit for Bug 259576639 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.
Reverted Changes:
Id80c40a30:Update for Utils.isSystemPackage()
I8af59268c:Use ApplicationInfo.isSignedWithPlatformKey()

Change-Id: If161c0e418fe623ac0bf8c0b164c1ba16a876a6a
2022-11-17 22:19:13 +00:00
Chaohui Wang
dc46bc9077 Update for Utils.isSystemPackage()
And we also no longer need to load the PackageInfos with the deprecated
flag PackageManager.GET_SIGNATURES.

Bug: 235727273
Test: Manually with Settings App
Change-Id: Id80c40a309e91d4766582375d2c1e25a6f8cf441
2022-11-10 10:20:08 +08:00
Chaohui Wang
d21f5916d2 Clean up AppButtonsPreferenceController
mDisableAfterUninstall and mUpdatedSysApp is always false.
And appChanged is always true.

Bug: 236346018
Test: Manual with Settings App
Change-Id: Icfb9fbea92d5c728cbef9d76569d59d5085a51e6
2022-09-22 10:02:44 +08:00
Patrick Baumann
a12fa8a2f7 Require permission while sending QUERY_PACKAGE_RESTART
Bug: 230755401
Test: Manual - force stop works
Change-Id: I7812ea51da0041b8dfae14d779da72f1295f4c94
2022-07-12 17:21:55 +00:00
ykhung
e12712dd1d Add package name into the metric for enable/disable app user actions
add package name into the metric per @wangkelly request to analyze users behavior in the battery setting relative CUJ:
go/battery-setting-enums

Bug: 199807285
Test: make SettingsRoboTests
Change-Id: Ica6da59b933b0dcff940215d4e537a670bac52cb
2021-09-14 05:02:29 +00:00
Yanli Wan
796ce5ee10 Show device admin warning dialog if force stop is not allowed
Test: manual
Test: atest AppButtonsPreferenceControllerTest
Bug: 192082470
Change-Id: I2c0028b4ff4578221a7686a3fe4511c70e1eed7d
2021-07-02 17:52:17 +00:00
ykhung
a3d3c22a27 Add metric for new battery relative functions for S (1/2)
Reference the table from PM requested:
https://docs.google.com/spreadsheets/d/1TC_6MLVMvOS0p1ic0wPfQ-19AOuY8Kc8FUJdqaQSM4I/edit?ts=6098b296#gid=0

Bug: 188505537
Test: make SettingsRoboTests
Change-Id: I2a4df9ab900cbeaf9885bb2dbc21ea848920bc81
2021-05-19 12:22:20 +00:00
Yan Zhu
460c2cbc0f Clean up split system user code in packages/apps/Settings/
Remove legacy code belonged to Andrometa project. Split system user
feature is always turned off now.

Bug: 137101239
Test: build, sync and reboot
Change-Id: Ieb84a6e131383dcd263a5d9b29a49dc64d905fe0
2021-01-12 16:57:49 -08:00
Yanting Yang
62b15ac669 Update App info behavior for mainline module
As requested by framework team, the mainline module should be considered
as system apps and not stoppable and disable-able. Since many of these
modules provide critical functionality, disabling them can result in a
very unstable device.

According to the request, Settings will apply below changes to App info
page for protecting mainline modules:
- Hide "Force stop" and "Disable" in App info.
- Disable "Clear storage" and "Clear cache" in "Storage & cache".

Since the mainline module checking API interface changed, also change
the dependent files and test cases.

Fixes: 156955322
Test: robotest and verify "Cell Broadcast Service" in App info
Change-Id: Ibc239bdaf3364eda541a33add382364cfdc6fc9b
2020-06-11 13:04:55 +08:00
Nate Myren
d55449aec0 Add Auto Revoke log to the App Info page
Test: manual
Bug: 154650244
Change-Id: Ibc944ce72d176204cc20c6d0460bf5efe6f7a878
2020-05-07 10:02:35 -07:00
Yanting Yang
9dc0a45fd8 Fix NPE crash when opening the app info from shortcut suggestion
It occurs NPE in invoking refreshUi() of AppButtonsPreferenceController
when user fully install the instant app from google play and then
directly open app info from the shortcut suggestion in launcher.

Root cause:
AppButtonsPreferenceController.refreshUi() will be invoked when user
directly open app info from the shortcut suggestion in launcher. In
refreshUi(), we will update the information of button preference, but
the preferences will not be initialized if device existed an instant
version for the app.

Solution:
Check button preference and initial them if need in refreshUi().

Fixes: 137854835
Test: visual, robotests
Change-Id: Id5c3e53b9db2683cab970c10eace7925d889eea3
2020-04-30 08:53:16 +08:00
Alex Johnston
8d430de5d5 Fix AppButtonPreferenceControllerTest
* isSystem was not being mocked.
* The tests where isSystem should return true
  were not being tested properly.

Bug: 151569506
Test: atest com.android.settings.applications.appinfo.AppButtonsPreferenceControllerTest
Change-Id: Ib4249bca8f3c0321d0b64b4dbd4c4e5fc29586e1
2020-03-16 09:37:10 +00:00
Alex Johnston
341f995971 DPC can be uninstalled in personal profile in New COPE
* For an organization-owned device, the DPC should be able to
  be uninstalled in the personal profile. Previously, the
  observed behaviour was that the uninstall button in the App
  Info Screen was being greyed out.
* This was because the previous logic did not allow for
  uninstalling any app which has a profile owner or device
  owner on *any* user.
* This CL updates this logic, such that, for non-system apps
  uninstalling is blocked only if the app has a profile owner
  or device owner for the current calling user.

Bug: 149381804
Test: Manual testing
      atest com.android.settings.applications.appinfo.AppButtonsPreferenceControllerTest
Change-Id: Ifaf03daa41724dbbd869c7e1371a77cc39d15ac7
2020-03-12 13:38:19 +00:00
Raff Tsai
88228c3399 Fix Settings crash when click uninstall button
When mPackageName is null, mFinish is true. OnResume() doesn't
invoke refreshUI(). It causes uninstall button is still enabled.
The solution is hiding AppButtonsPreference when mFinish is true.

Fixes: 138524326
Test: make RunSettingsRoboTests ROBOTEST_FILTER
Change-Id: I9759e53f002afbd4c88d8d536df3bf01c343135e
2019-07-30 11:18:09 +08:00
Vinit Nayak
f7d423d106 Remove Settings from recents after app uninstall
SettingsActivity now calls finishAndRemoveTask
instead of only finish() to prevent blank
recent task from showing in overview.

Test: Visually inspected bug doesn't exist. Wrote
Roboelectric tests

Fixes: 129733119

Change-Id: I5b73c1b611e6eb52bb6665c215276efdc85c19b2
2019-07-11 16:09:49 -07:00
Narayan Kamath
67d149ae37 Hide AppButtonsPreferenceController for system modules.
Bug: 131927465
Test: atest AppButtonsPreferenceControllerTest
Change-Id: I2d3aa3429f61325afe49bfe322522fe9ccd03b2c
2019-05-17 18:54:39 +01:00
Zoran Jovanovic
c6d79cd0da Don't allow RRO uninstall if overlay is enabled
System RROs can never be uninstalled. Also, enabled RRO, i.e.
RRO applied to their target packages, must not be uninstalled by
end-user because that may be dangerous to the configuration of
its target package. Disabled RROs, i.e. RRO not applied to their
target packages, are free to be uninstalled to reclaim space.

Bug: 124556507
Test: manual + `make RunSettingsRoboTests ROBOTEST_FILTER=AppButtonsPreferenceControllerTest`
Change-Id: Ib6bd2765c8cb88a5887de817a08a1541eaee0cab
2019-04-01 20:32:51 +00:00
Torne (Richard Coles)
185acfc5ae Remove WebView fallback package handling.
There is no longer a special "fallback package" state for WebView that
means it should not be able to have its enabled/disabled state
controlled by the user. Remove the code used to implement this in
Settings.

Bug: 129470358
Test: verify that WebView's enable/disable button is not greyed out
Change-Id: Ifc0921511a71282a77f239e5ff5955e60fab6e2c
2019-03-28 14:11:50 -04:00
tmfang
ebf7b888d6 Change icons for disable and enable button
Test: visual
Fixes: 124116610
Change-Id: Ia300eeba36d853117699d3bec724373df2e354d3
2019-03-27 10:53:24 +08:00
tmfang
0d79b61634 Use "Disable"/"Enable" for system app
- Also modify warning message for disable dialog.

Bug: 124116610
Bug: 128769312

Test: visual
Change-Id: I2f68f51538d3dd17898aa668dae52d1d8e955ec7
2019-03-19 19:39:27 +08:00
Fan Zhang
31b210017b Migrate all MetricsProto enums to SettingsEnums
Bug: 122855168
Test: rebuild
Change-Id: I962d9a71179f86b7cae9dc5e9a00e0aa1557dc76
2019-01-17 14:55:42 -08:00
tmfang
72b25d65d3 Add an open button in App info page.
Per new UX, we need to add an "Open" button
in App info page. When user clicks this button,
it will launch application.

Test: visual, robotest
Bug: 116346008
Change-Id: Ic4a36979d08bf8d58f792474cd3c9b34a147fef8
2018-12-04 10:44:13 +08:00
tmfang
8ad18fb3eb Use SettingsLib's ActionButtonsPreference
Since we moved old ActionButtonPreference into
SettingsLib, we need to update new imports and
declaration in Settings source code.

Test: robotest, manual test
Bug: 120005054
Change-Id: I1e3514ba68a856071c81534d54c99c3d1a11a8ca
2018-12-03 15:12:41 +00:00
TreeHugger Robot
3704899fc9 Merge changes from topic "settings-action-button"
* changes:
  Remove setButtonPositive method
  Apply new action button visual design
  Create a new visual design for action buttons
2018-11-16 10:45:29 +00:00
tmfang
5c7f4de999 Remove setButtonPositive method
Since new UI design only exist two button in layout,
we don't need these methods anymore.

Test: robotest
Bug: 116346008
Change-Id: If2e8f7dddb9c13e480438f36fe3c5d6affa4e9ff
2018-11-16 14:33:16 +08:00
tmfang
3adb74ea60 Apply new action button visual design
- Add some icon resources.
- Add icon for each button in action button preference.
- Update "Enable" and "Disable" string to "Install" and "uninstall".
- Remove unused string.
- Add divider between entity header and action buttons.

Test: visual, robotest
Fixes: 119203074
Bug: 116346008
Change-Id: Ib8d7aeb2943d39d257e977b84f165f002bf47559
2018-11-16 14:33:03 +08:00
Fan Zhang
a6c7db1888 Update logging: switch a bunch of action() logging calls.
Use generic action(int, int, int, String, int) instead of
action(Context, int, string, Pair...) when possible.

Bug: 117860032
Test: robotests
Change-Id: I5213b52b2b10d80a3c488c37718df81b3b0a428f
2018-11-13 21:50:34 -08:00
Philip P. Moltmann
e3f721132a RestrictedLockUtils was split into ...Internal
This means that in some cases RestrictedLockUtils has to be used and in
some RestrictedLockUtilsInternal.

This causes a lot of trivial code changes.

I also updated the ordering of the imports in all affected files.

Bug: 110953302
Test: Built
      make -j RunSettingsRoboTests
Change-Id: I9bdf8b89134f853bae4f38c81af436715c73e924
2018-08-30 08:11:39 -07: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
tmfang
27c84de325 Settings Fragment Migration (Build pass app)
This patch focused on fixing compile errors and some runtime errors.

Test: We can't test it now. But we will have an integration test later.
Bug: 110259478
Change-Id: I16c471ddcd0fa1460c665b7f74d86fcace5ee67b
2018-07-11 18:24:51 -07:00
tmfang
99cc23d0da Settings Fragment Migration (Change imports)
This commit *only* changes imports and optimize imports.
We don't do anything else.

This patch can't compile pass and run test case.
We will update other patches to fix these problem.

Change list.

1. import android.app.Fragment; ->
   import androidx.fragment.app.Fragment;
2. import android.app.DialogFragment; ->
   import androidx.fragment.app.DialogFragment;
3. import android.app.ListFragment; ->
   import androidx.fragment.app.ListFragment;
4. import android.app.LoaderManager; ->
   import androidx.loader.app.LoaderManager;
5. import android.content.AsyncTaskLoader; ->
   import androidx.loader.content.AsyncTaskLoader;
6. import android.content.Loader; ->
   import androidx.loader.content.Loader;
7. import android.app.FragmentTransaction; ->
   import androidx.fragment.app.FragmentTransaction;
8. import android.app.FragmentManager; ->
   import androidx.fragment.app.FragmentManager;
9. import android.app.LoaderManager.LoaderCallbacks; ->
    import androidx.loader.app.LoaderManager.LoaderCallbacks;

Bug: 110259478
Test: Can't test it.
Change-Id: I0a3f98fff34a3494a839c3c42aeabcec3df2c8b3
2018-07-11 18:23:51 -07:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Fan Zhang
ca6d86c5ab Move device admin viewer/adder to specialaccess package.
Bug: 110207366
Test: robo
Change-Id: I51552dcc5ec6525040cfde17087b7f3f6b21b581
2018-06-15 08:56:14 -07:00
Doris Ling
2511d108ed Consolidate the 2 app button prefernece controllers.
- move the fuelgauge app button controller and the button dialog
fragment into app info package and change app detail fragment to use
that controller instead.
- remove the original appinfo/AppActionButtonPreferenceController

Change-Id: I94ca072a8dfe6051853eb23efa1f96ac3e13d79d
Fixes: 80312809
Test: make RunSettingsRoboTests
2018-06-12 13:43:25 -07:00