2076 Commits

Author SHA1 Message Date
Bryce Lee
6272c7f83f Do not remove the default display during tests.
The default display is used by some tests that exercise features only
functional only on the default display (like policy rotation). This CL
makes this display not get removed with the created test displays and
ensures no collision in id space from a previous test run (done in the
test setup).

Change-Id: Ia14b9c023c779d263283fe8c7b512dca17ff312f
Fix: 36385757
Test: bit FrameworksServicesTests:com.android.server.wm.StackWindowControllerTests#testRemoveContainer_deferRemoval
2017-03-20 14:48:16 -07:00
Geoffrey Pitsch
1f17e024a1 Delete the Default Channel when an app starts using channels.
New apps should create their own channels.
Not using channels will silently fail.

STOPSHIPS:
Throw to provide better feedback for developers.
Delete the default channel for all apps that target O.

Test: runtest systemui-notification
Change-Id: Ic93f103efe397f563eaaf1c2e7d8bf9093b2b2e1
2017-03-20 16:49:59 -04:00
Michael Wright
7121697a5e BZZZZZZT! BZZZZZT! New Vibrator APIs
Replace the existing Vibrator APIs with a new class to encapsulate the
haptic effect information, and add the ability to control the vibration
strength.

Test: cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.cts.VibratorTest
      cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.cts.VibrationEffectTest
      runtest systemui-notification
      Manual testing with $T/google_experimental/users/michaelwr/Vibrator

Bug: 30961353

Change-Id: Idbb9864a7b084c85e7b7de3257a0e6b40d9d91d6
2017-03-20 16:09:51 +00:00
Julia Reynolds
d0a5b1684a Don't backup deleted channels.
Change-Id: I58a23700c9f6ccf5d3d6b7fa9f80be78ef9421f0
Fixes: 36381209
Test: runtest systemui-notification
2017-03-20 14:55:16 +00:00
TreeHugger Robot
2903d13157 Merge "Better call emulation for DevicePolicyManagerTest" 2017-03-17 23:11:46 +00:00
Robin Lee
088d7aa9c1 Exfiltrate cert code from DevicePolicyManager
The intent is for this not to cause any behaviour changes, just to
make it easier to see what is going on with the code.

Permissions are checked in DevicePolicyManagerService. All calls to
CertificateMonitor are privileged.

Test: runtest -x frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
Test: cts-tradefed run cts-dev --module CtsDevicePolicyManagerTestCases
Change-Id: I98224087315a62234732f08b53fe91884be86386
2017-03-17 19:44:53 +00:00
Robin Lee
2c68dadb20 Better call emulation for DevicePolicyManagerTest
Let's have several separate contexts instead of doing strange things
with package names in one monolithic context representing every single
user on the device at once, sometimes multiple times in the same call.

Syntax looks like:

        runAsCaller(callerContext, dpms, (dpm) -> {
            assertSomething(dpm.doSomething(caller, param));
        });

When a caller calls into DevicePolicyManager here's what happens:

PRE

- a new DevicePolicyManager is created with the caller context
- service context callingIdentity is saved
- the callingUid, callingPid, and callingPermissions are added to the service context

TEST

- client-side test code interacts with DevicePolicyManager using the caller context
- server-side coder under test runs as DevicePolicyManagerService using the service context

POST

- service context callingIdentity is restored to what it was before the test.

This should be easier to reason about.

Test: runtest -x frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
Test: cts-tradefed run cts-dev --module CtsDevicePolicyManagerTestCases
Change-Id: I148e3f298b0a958639ce261e9cf91f6eb49fae4d
2017-03-17 19:44:46 +00:00
Andrii Kulian
c1b59ed73e Merge "Separate global and override config sent to client" 2017-03-17 15:39:37 +00:00
Andrii Kulian
446079600e Separate global and override config sent to client
There is some flakiness in View#onConfigurationChanged callback -
if ViewRootImpl receives config update earlier than ActivityThread,
it may not detect the configuration change and skip inner updates.
Also now ViewRootImpl assumes that it receives the global config as
a param, but instead it gets merged config from WM. This means that
ViewRootImpl#sConfigCallbacks was sending incorrect values to the
recipients.

This CL switches to sending global and override configuration to the
client separately. Also in case if there is a corresponding activity,
it first updates it and waits for update callback to ViewRootImpl.
This way global config and override config for activity will always
be set first and resources will be updated before inner state of
ViewRootImpl is updated.

Bug: 35870157
Bug: 34164473
Test: android.server.cts.ActivityManagerDisplayTests
Test: testOnMovedToDisplayCallback
Change-Id: Ic9e7541cf25ecfac6ec90e48f7efb0ece91f657e
2017-03-16 19:13:02 -07:00
Bryce Lee
6b9b130c98 Merge "Fix AppWindowTokenTests#testLandscapeSeascapeRotationByPolicy" 2017-03-16 21:39:21 +00:00
TreeHugger Robot
587b60282e Merge "frameworks/base: Add APCT tests to the device-tests suite." 2017-03-16 17:35:12 +00:00
Julia Reynolds
9bfba59417 Better deletions
- Allow apps to delete notification groups (which cascade to delete all
channels therein)
- Allow apps to get their groups, so they know what they might want to
delete
- Don't throw if someone tries to delete something that already doesn't
exist.

Change-Id: I5f6e25497c5da1e57b52737586e86097332f88f9
Fixes: 36245468
Fixes: 36127382
Test: runtest systemui-notification, cts
2017-03-16 14:32:50 +00:00
Julia Reynolds
41103f4212 Support for showing deleted channel count in settings.
Bug: 36119790
Test: runtest systemui-notification
Change-Id: Ie30243314d64ded66267d0dc85cc0ad940d917f8
2017-03-16 14:24:17 +00:00
Julia Reynolds
1d97e6a0c1 Remove resource id channel/group name fields
Apps can listen for the LOCALE_CHANGED broadcast to
change names if needed.

Fixes: 35336590
Test: runtest systemui-notification, cts, manual
Change-Id: I62d2778f61e99200692755a6f268828a374837e6
2017-03-16 14:20:28 +00:00
Rubin Xu
8b30ec3f49 Fix SynthethicPassowrdManager unit tests
Mock DevicePolicyManager in the unit tests.

Bug: 34600579
Test: runtest frameworks-services -c com.android.server.SyntheticPasswordTests
Change-Id: Ieca30a74d7d9d867994e912d188231510f54e76c
2017-03-16 11:55:27 +00:00
Simran Basi
473a16e492 frameworks/base: Add APCT tests to the device-tests suite.
This CL adds the APCT tests within this project to
a similar suite as CTS known as device-tests.

The current method of running APCT tests in the infrastructure
is unaffected.

Bug: 35882476
Test: `make dist device-tests -j` and local builds of
      continuous_instrumentation_tests & continuous_native_tests

Change-Id: Ifa382fe691842c1cd76897775b9e2a1653449eb5
2017-03-15 14:46:27 -07:00
Bryce Lee
310de9e5ee Fix AppWindowTokenTests#testLandscapeSeascapeRotationByPolicy
Previously this test was marked as blocked by b/35034729. This bug
has been fixed, however the test still fails due to other issues
addressed here.

Addressed issues are as follows:
1. Updating rotation by display manager requires a display with the
default display id present. This display is removed during setup. The
first id to be used by a display after this point is the
default id + 1. We already have logic in place to avoid collisions so
it is safe and correct to start out at the default id.
2. Without allowing the animator to complete its steps after a
rotation, future rotations will be deferred. We must simulate the
steps taken by the and resulting from the animtor. These include
marking the orientation change as complete and performing a surface
placement afterwards.

Bug: 35034729
Test: bit FrameworksServicesTests:com.android.server.wm.AppWindowTokenTests
Change-Id: Ib01c047ac49982a4a3c1debaa3cee1b7b9b53632
2017-03-15 10:18:21 -07:00
Calin Juravle
dc61d1b2c0 Merge "Add missing return in DexManager" 2017-03-14 18:02:34 +00:00
Phil Weaver
58277fab89 Merge "Add haptic feedback for a11y shortcut" 2017-03-14 14:47:54 +00:00
Calin Juravle
2dfc1b3e12 Add missing return in DexManager
Harmless issue but which can spam the logs.

Test: mostly manual since the check is buried deep inside and cannot be
verified accurately. I added another test to DexManager to stress that
code path and then checked the logs.

Bug: 36117123
Change-Id: I1a878a200f3f726dfaa85f1bed1398acc8dce979
2017-03-13 18:44:11 -07:00
Eugene Susla
ef4351cc72 Dont dispatch a11y events that have no subscribers
This allows to avoid A11yManager -> A11yManagerService IPC, when there's no
subscribers to a given event

Test: steps:
  - Enable A11yManager.DEBUG
  - Navigate through a few random activities
  - In logcat, ensure log messages are present, notifying that certain events
  won't be dispatched
Change-Id: Ia019fb66053f10095b3651407d09de8e89cdd227
2017-03-13 17:51:04 -07:00
Andrii Kulian
ca6d48f337 Merge "Move rotation tracking to DisplayContent" 2017-03-13 22:09:34 +00:00
Phil Weaver
32ea37255d Add haptic feedback for a11y shortcut
Bug: 35036259
Test: Activated shortcut, felt the vibration. Also added unit test.
Change-Id: I3070620d9152ce9b9bb084ee4f01d26020f125d0
2017-03-13 13:01:50 -07:00
Julia Reynolds
e866533f11 Allow blocked apps to create channels
Change-Id: I64b90332095f949af003db3db98da75b22a09c64
Fixes: 36040396
Test: runtest systemui-notification
2017-03-13 17:09:18 +00:00
Paul Duffin
2abe1be543 Use --multi-dex native to avoid dex limit
Bug: 32912773
Test: make checkbuild
Change-Id: If23b6a746494d862059ce76ef20b225a6c27c379
2017-03-11 12:26:13 +00:00
Andrii Kulian
8ee7285128 Move rotation tracking to DisplayContent
This CL moves rotation tracking from WindowManagerService to
DisplayContent. This way displays can be rotated independently and
rotation of the main display won't affect rotation of secondary
ones.

Bug: 34242678
Test: android.server.cts.ActivityManagerDisplayTests
Test: testRotationNotAffectingSecondaryScreen
Change-Id: Ic46aaa523482b31ff5ec77f0c2908ceda1156fc0
2017-03-10 18:34:18 -08:00
TreeHugger Robot
bd7ae7df28 Merge "Basic accessibility support for picture-in-picture" 2017-03-11 01:52:51 +00:00
Sudheer Shanka
c37cc60301 Merge "Update IUidObserver.onUidStateChanged to include procStateSeq." 2017-03-11 00:19:50 +00:00
Sudheer Shanka
8025580449 Update IUidObserver.onUidStateChanged to include procStateSeq.
This procStateSeq is associated with the process state change of
an uid and will help in identifying if network policy rules have been
updated for a process state change.

Bug: 27803922
Test: runtest -c com.android.server.am.ActivityManagerServiceTest
      frameworks-services
Change-Id: Iaab8d004f476b96f28d08c886c7b0a6b585b9fef
2017-03-10 16:04:41 -08:00
Sudheer Shanka
61f31c7b3a Merge changes If6c9684f,Iefab4b8b
* changes:
  Extract the logic to dispatch uid state changes into separate method.
  Add tests for ActivityManagerService.dispatchUidsChanged.
2017-03-11 00:03:51 +00:00
Phil Weaver
f00cd14f17 Basic accessibility support for picture-in-picture
Exposing actions from the PIP InputConsumer to accessibility,
stripping all actions from a covered PIP app, and adding the
InputConsumer's actions on the PIP app's root view.

We were also using an "undefined" accessibility ID to mean
three different things: a root view, a host view of a virtual
view hierarchy, and a truly undefined view. I've introduced
new values for cases where the id could be defined.

Also gathering all window IDs into one place to reduce the
chance of collisions.

Bug: 34773134
Test: In progress. Current cts passes.
Change-Id: I97269741a292cf406272bf02359c76c396f84640
2017-03-10 15:35:30 -08:00
Paul Duffin
bed6682755 Merge "Refactor code incompatible with Mockito 2.7.13" 2017-03-10 18:31:33 +00:00
Daniel Nishi
7219795ffb Merge "Don't look up storage for uninstalled apps." 2017-03-10 16:46:24 +00:00
Paul Duffin
192bb0bc54 Refactor code incompatible with Mockito 2.7.13
(cherry picked from 76e319f015c2b43498ce3ce610a253d63e76cbf3)

Some additional internal only refactorings were done as well.

Bug: 32912773
Test: make checkbuild
Change-Id: I96e3da967fad731fc8f39bde9db95f50ab7353fb
2017-03-10 14:18:53 +00:00
Wale Ogunwale
8e44f6c468 Revert "Have WM use token info. from IMMS to determine IME target window"
This reverts commit daab865344fcfa45fe2789e43462f730a44fba64.

IMMS is currently sending wrong target candidates, so we need to revert
this until we figure-out what is going on there :(

Bug: 31559891
Bug: 35903813
Test: DisplayContentTests
Change-Id: I5c5beff4bac1b0781fa6663b13ff0dfe83a7806b
2017-03-09 15:27:06 -08:00
Daniel Nishi
579e5581d5 Don't look up storage for uninstalled apps.
This also catches any potential state exceptions which may
occur when errors occur during storage queries on a package.
This should stop the crashes.

Change-Id: Idab92434f74eaf44ba7b3fdbbc6c2c1ac9b10ee2
Fixes: 36075582
Test: FrameworkServicesTest & manually verified file is populated
2017-03-09 13:19:05 -08:00
Lei Yu
18f805e73d Merge "Hook up screen brightness knob to DisplayPowerController." 2017-03-09 04:05:25 +00:00
jackqdyulei
92681e8cfb Hook up screen brightness knob to DisplayPowerController.
This knob is designed to effectively tune the battery saver.

Bug: 34693888
Test: FrameworksServicesTests
Change-Id: I9fd7896f59fabd9baf649cdb12f01b1baaf4c34b
2017-03-08 13:15:19 -08:00
Lei Yu
30d69eaf86 Merge "Add BatterySaverPolicy for power save mode" 2017-03-08 20:02:46 +00:00
jackqdyulei
455e90add2 Add BatterySaverPolicy for power save mode
The BatterySaverPolicy is designed to consolidate all battery saver
knobs into a central location. Usually it is consistent to
mLowPowerModeEnabled unless it gets different data for specific
service. By adding these knobs, we can effectively tune the battery
saver.

This cl sets up the framework for BatterySaverPolicy and updates
following service to get battery saver data from BatterySaverPolicy

1. GnssLocationProvider
2. VibratorService
3. WindowManagerService
4. BackupManagerService
5. SoundTriggerService
6. NetworkPolicyManagerService

Screen brightness will come in a following cl.

Bug: 34693888
Test: FrameworksServicesTests

Change-Id: I6b040e93391614b44d136a485faa4a332c396e51
2017-03-08 09:20:36 -08:00
TreeHugger Robot
1966cccd32 Merge "Keep Settings.Global.NETWORK_RECOMMENDATIONS_ENABLED updated." 2017-03-07 23:01:50 +00:00
Daniel Nishi
8603ad42df Merge "Use the fast track for the AppCollector." 2017-03-07 22:55:20 +00:00
Jeremy Joslin
9925c6a7e7 Keep Settings.Global.NETWORK_RECOMMENDATIONS_ENABLED updated.
Make sure Settings.Global.NETWORK_RECOMMENDATIONS_ENABLED reflects
the current active scorer state. When valid the setting will have a
value of 1, when invalid it will be 0 (or more
accurately not 1, see below).

Introduced a new valid setting value, -1, which indicates the feature
has been forced off.

Test: runtest frameworks-services -c com.android.server.NetworkScorerAppManagerTest
Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
Bug: 35896421
Change-Id: I271725f798e5d0acc7c08c79678dba5115f8faad
2017-03-07 10:13:41 -08:00
Julia Reynolds
d373d78d15 Log notification channels and groups.
Test: manual, runtest systemui-notification
Change-Id: I326a35ae87e7a3dc4b2587271056b7dd5cd11f8d
2017-03-07 15:25:27 +00:00
TreeHugger Robot
7b0a72236c Merge "Prevent creation of default channel." 2017-03-07 01:54:14 +00:00
Julia Reynolds
03fa85ddcc Prevent creation of default channel.
Test: runtest systemui-notification
Change-Id: Id56debdca2a11bdac5ae11832eaaa04842f0a9be
2017-03-07 00:17:19 +00:00
Sudheer Shanka
4c9afa87d0 Add tests for ActivityManagerService.dispatchUidsChanged.
Bug: 27803922
Test: runtest -c com.android.server.am.ActivityManagerServiceTest frameworks-services
Change-Id: Iefab4b8beab710108ba55fde8edeb578ef70349d
2017-03-06 11:44:58 -08:00
Bartosz Fabianowski
172f7801c7 Rename DPM.isDefaultInputMethodSetByOwner()
Settings.Secure.DEFAULT_INPUT_METHOD is a misnomer. It does not really
record a permanent default of any sort - it just indicates the currently
chosen IME. Thus, isDefaultInputMethodSetByOwner() should more
appropriately be called isCurrentInputMethodSetByOwner().

Furthermore, it turns out that setting a different IME for a user and
the user's work profile is unsupported. Thus, it is sufficient for the
intended use case to just retrieve the calling user's default IME.
There is no need for a |user| parameter.

Bug: 32692748
Test: unit tests (see DevicePolicyManagerTest.java for invocation)
Test: cts-tradefed run cts-dev --module CtsDevicePolicyManagerTestCases

Change-Id: Ia0846d38a1361042429dae7430a8b055575ef2e0
2017-03-06 14:24:12 +01:00
TreeHugger Robot
e096df0063 Merge "Adding support for passing arbitrary extras when requesting to pin a widget. Also defining an extra constant for widget preview which can be used by developers to provide a snapshot of the widget with the pin request" 2017-03-03 22:26:49 +00:00
TreeHugger Robot
8b5ca97a6c Merge "Add API for checking which CA certs were installed by the DO/PO" 2017-03-03 20:28:37 +00:00