Commit Graph

5759 Commits

Author SHA1 Message Date
David James
3bd6d2e4bd Mark AppStandbyControllerTests#testEnabledState as Flaky.
This test is ~2% flaky on git_master. Mark as flaky temporarily.
It is not flaky on AOSP so we are leaving it enabled there.

Bug: b/119774928
Change-Id: I4d8365de4a4e2112848c9721836ca2289f7e2804
2019-01-13 21:09:38 +00:00
Shubang Lu
9af8f281d0 Merge changes I7bfdcbaf,I260b354b,I42ca55eb,If38d5443,I3fbc3368, ...
* changes:
  Atom: initPortInfo when receive hotplug from tx for audiosystem device[1/3]
  handle manual port switching
  Claim Active Source during System Audio Mode init by AVR when the device also has playback type and can't get Active Source.
  Switch away from ARC input when ARC is terminated.
  Request Active Source when ARC is enabled in ArcInitiationActionFromAvr.
  Refactor the Active Source updating logic in CEC devices.
  Fix tests failure on com.android.server.hdmi
  Making functions visible for testing com.android.server.hdmi
  Back out unneeded ag/4808863. Standby has been handled in ag/4881453.
2019-01-12 07:55:38 +00:00
Nataniel Borges
994bf9f577 Merge "Isolate WMTrace buffer and limit it by size not number of elements" 2019-01-11 21:20:15 +00:00
TreeHugger Robot
58b0f127f6 Merge "Adding some unit tests to presubmit" 2019-01-11 21:18:22 +00:00
Kweku Adams
21909c112b Merge "Moving BatterySaverPolicy into batterysaver directory." 2019-01-11 19:41:14 +00:00
Amy
70415eb373 Claim Active Source during System Audio Mode init by AVR
when the device also has playback type and can't get Active Source.

ag/5141907

Bug:112365691
Test: local tested.
Change-Id: I42ca55eb6787e4cbb3eea267fc8f6e387961e98c
2019-01-11 11:29:58 -08:00
Amy
03afe48a4d Switch away from ARC input when ARC is terminated.
ag/5056172

This is helpful when TV turns on/off system audio mode but
Active Source does not change. We will always switch away from
ARC input when system audio mode/arc is off

Bug: 115756006
Test: local tested
Change-Id: If38d544384d8ce2fac57de67e7164b5ffb7e19f6
2019-01-11 11:20:22 -08:00
Amy
25d5bf6ab1 Request Active Source when ARC is enabled in ArcInitiationActionFromAvr.
ag/5086550

This will trigger ARC input switch if users turn on System Audio Mode
when watching Active Source not under the current device.

Test: atest com.android.server.hdmi
Bug: 80296911
Change-Id: I3fbc336892131291ec3e67e5f75ff99f592e2f23
2019-01-11 11:12:43 -08:00
Chavi Weingarten
8c30fbae6d Merge "Fix drag and drop (3/3)" 2019-01-11 19:01:35 +00:00
Svetoslav Ganov
9a788837ef Merge "Historical app ops." 2019-01-11 18:48:55 +00:00
Amy
cd18d288fe Fix tests failure on com.android.server.hdmi
ag/5107856

Test: atest com.android.server.hdmi
Change-Id: I5b96b9d4f55294ce242ee166e8771c10c9eafffc
2019-01-11 10:46:34 -08:00
Amy
85bff85f2c Back out unneeded ag/4808863.
Standby has been handled in ag/4881453.

ag/5112445

Bug: 113288856

Test: local test.
Change-Id: I2dd4a8fe8478cc35f21de8a1890d6d92b8010455
2019-01-11 10:27:03 -08:00
Shubang Lu
0c891e8f4e Merge changes Ie889f696,Ie3d7189b,Ibeceb4c4,I08055c7e,I7b01513b, ...
* changes:
  playback device should handle the active source claiming when it exists.
  Set local active port to HOME when oneTouchPlay is triggered. Update local active source at the same time.
  Add ro.hdmi.property_hdmi_cec_never_assign_logical_addresses to skip the logical addresses that will not be assigned.
  Fix routing logic on handling routing change/info.
  Add routingChange and routingInformation handlers.
  Add setStreamPath handlers and do input switching according to the new active path.
  Add ActiveSouce handling logic to switch to ARC input when the new Active is not under the current device.
2019-01-11 17:38:44 +00:00
Garfield Tan
0c81667a08 Merge "Drop stale activity configuration updates." 2019-01-11 17:06:39 +00:00
Amy
8b4a4a9056 playback device should handle the active source claiming when it exists.
ag/5056160

Test: atest com.android.server.hdmi
Change-Id: Ie889f69656eb36ea4b5a40bec8eff2f8637c7bd8
2019-01-10 19:58:16 -08:00
Amy
79b54e9271 Add routingChange and routingInformation handlers.
ag/4997843

Test: com.android.server.hdmi

Bug: 112476122
Bug: 112476226
Change-Id: I7b01513bd23aeec2e96f48c5e9351ca70840226a
2019-01-10 19:53:36 -08:00
Yohei Yukawa
a878b9500e Support per-profile IME behind the flag
In order to support BYOD (Bring your own device) use cases, Android
phones can associate multiple users into a single profile group so
that other system components such as launcher can help users
seamlessly switch user identity without doing a heavy-weight
device-level user switching.

For instance, an Android device can be configured to work for two
different users Alice and Bob, while Alice also has two different
identities: one as her private account and the other for her
work-related account.

  Profile group X == Alice:
    Parent user X (user id: 0)
      for personal account, under her control.
    Child user 1 (user id: 10)
      for work-related account, partly under system-admin's control.
  Profile group Y == Bob:
    Parent user Y (user id: 11)
      private account, under his control.

The above configuration allows system-level data separation not only
between Alice (user 0) and Bob (user 11) but also between Alice's
personal account (user 0) and Alice's work-related account
(user 10). For instance, Calendar app that runs under user 0 cannot
see any data for other users including user 10.

IME is one of known exceptions in the above design. For instance, when
Alice is using the device, the system launches InputMethodService,
which is the code-level representation of IMEs, only for the user 0
then gives it a special ability to interact with all the applications
that run under the same profile group.

  Profile group X == Alice:
    IME works as user 0 but interacts with apps that run under
    user 0 and 10.
  Profile group Y == Bob:
    IME works as user 11 and interacts with apps that run under
    user 11.

Of course there are non-trivial imprications by sharing the same
instance of InputMethodService across profiles but this was basically
the only option when we initially introduced in Android 5.0 [1]
because of multiple challenges (schedule, complexity, performance
concerns, and so on). To to mitigate the risk, we also introduced APIs
that allow system administrators to whitelist what IMEs can be enabled
for the entire profile [2].  Even with such a whitelist feature, we
have received multiple feature requests to completely separate IME
instances by profile boundaries, like other applications behave.

This is why this CL was authored.

With this CL, a new runtime mode "per-profile IME" is introduced
behind the flag.  When the flag is enabled:

  * InputMethodManagerService (IMMS) may calls IMMS#switchUserLocked()
    from IMMS#startInputOrWindowGainedFocus() every time when a
    different profile's IME client gains IME focus.
  * SpellCheckerService also enables per-user mode, which has been
    temporarily disabled [3].
  * DevicePolicyManagerService no longer disable packages that contain
    system IMEs when creating a new profile user.
  * Following IME APIs start returning result based on the caller's
    user (profile) ID.
     * InputMethodManager#getInputMethodList()
     * InputMethodManager#getEnabledInputMethodList()
     * InputMethodManager#getEnabledInputMethodSubtypeList()

There are still multiple known issues though. Hopefully we can address
those issues in subsequent CLs.

 * Inline-reply from non-primary profiles is still dispatched to the
   main profile's IME because SysUI is always running under main
   profile (Bug 120744418).  This probably can be addressed by
   allowing the IME clients that have INTERACT_ACROSS_USERS_FULL to
   specify the target user ID in some @hide parameter.
 * IMMS#switchUserLocked() is not yet fully optimized (Bug 28750507).
   New client app's UI thread can be blocked more than 100ms,
   depending on the number of installed IMEs and the number of IME
   subtypes implemented by those IMEs.
 * Even after IMMS#switchUserLocked() is fully optimized, IMEs'
   cold-startups are known to be slow.  One way to optimize this is
   keeping binding to those IMEs, but doing so would require 1)
   non-trivial amount of code changes and 2) doubles RAM consumption.
 * Virtual keyboard settings page for profile users are not yet
   available (Bug 120748696).
 * Migration from shared-profile IME mode to per-profile IME mode is
   not yet supported (Bug 121348796).  By default, IME packages will
   be automatically disabled when a profile user is created.  This
   means if the device switches from shared-profile IME mode to
   per-profile IME mode, IME packages continue to be disabled hence
   the user cannot type anything for those profiles.

Anyway, there should be no behavior change unless the debug flag is
explicitly flipped.

 [1]: I3bd87b32aec69c3f8d470c8b29b144f4e849c808
      734983fff3
 [2]: I921888660d29a5370395db87adf75d4d106660c9
      9c9cbac5b71a23ed0dbab0f44cb78a820514cfc6
 [3]: Ic046f832f203115106409a53418a5746eb6d4939
      3f8c568883

Fix: 120709962
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Test: Made sure that there is no behavior change if the debug flag is
      not set as follows.
  1. Install Test DPC
  2. Enable managed profile with Test DPC
  3. make -j EditTextVariations
  4. adb install -r $ANDROID_TARGET_OUT_TESTCASES/EditTextVariations/EditTextVariations.apk
  5. Open two EditTextVariations instances in split-screen mode
   5.1. One is for the main profile
   5.2. The other is for the managed profile
  6. Make sure that main profile's instance of AOSP Keyboard is used
     for both applications.
  7. Make sure that main profile's instance of Android Spell Checker
     is used for both applications.
  8. adb shell ime list -a -s --user all
      -> Only "com.android.inputmethod.latin/.LatinIME" is shown.
  9. adb shell dumpsys textservices
      -> Only result for user #0 is shown.
Test: Made sure that basic text input can be done with
      "per-profile IME" mode enabled as follows.
  1. adb root
  2. adb shell setprop persist.debug.per_profile_ime 1
  3. adb reboot
  4. Install Test DPC
  5. Enable managed profile with Test DPC
  6. make -j EditTextVariations
  7. adb install -r $ANDROID_TARGET_OUT_TESTCASES/EditTextVariations/EditTextVariations.apk
  8. Open two EditTextVariations instances in split-screen mode
   8.1. One is for the main profile
   8.2. The other is for the managed profile
  9. Make sure that AOSP Keyboard will be re-launched to correspond to
     the focused IME client's user profile.
   9.1 When EditTextVariations for the main profile is focused,
       AOSP Keyboard for the main profile is shown.
   9.2 When EditTextVariations for the work profile is focused,
       AOSP Keyboard for the work profile is shown.
 10. Make sure that different instances of Android Spell Checker are
     used based on target application's profile
 11. adb shell ime list -a -s --user all
      -> "com.android.inputmethod.latin/.LatinIME" is shown for both
         user #0 and user #10.
 12. adb shell dumpsys textservices
      -> Both user #0 and user #10 have results.
Test: atest DevicePolicyManagerTest#testSetPermittedInputMethods_failIfNotProfileOwner
Test: atest com.android.server.devicepolicy.OverlayPackagesProviderTest
Change-Id: Ied99664d3dc61b97c919b220c601f90b29761b96
2019-01-10 19:36:24 -08:00
Svet Ganov
8455ba2341 Historical app ops.
This change is the main check in for the historical app op feature.
The idea is to store a historical data about past app op rejections,
accesses, and durations per op for any UID state indefinitely.

Keeping all operations on record is not practical as app ops are
very frequently performed. To address this we are storing aggregated
data as snapshots where we store for every UID and its packages
how many times each op was accessed, rejected, lasted as an aggregate.

To allow history scaling indefinitely we are taking a logarithmic
approach with only the most recent state stored in memory and all
preceding state stored on disk. State on disk is stored in separate
files where each preceding file, i.e. for an older period, would
cover X times longer period with X number of snapshots covering
X times longer period. Initially X is ten but can be tweaked. For
example, the first file could contain data for ten days with daily
snapshots, while the file for older period would have data
for a hundred days with snapshots every ten days, etc.

The implementation is optimized for fast history update and no impact
on system runtime performance and minimizing memory footprint. We
are lazily persisting state to disk on a dedicated thread as this is
slow. We are also reading the relevant historical files on a query
as this is very rare as opposed to state updates.

The base snapshot interval, i.e. snapshot time span, in the initial
iteration and the logarithmic step are configurable. These can be
changed dynamically and the history would be rewriten to take this
into account.

Test: atest CtsAppOpsTestCases

bug:111061782

Change-Id: I55c32c79911ba12b2ace58d2a782b8df1e6bff60
2019-01-10 19:31:31 -08:00
Amy
225d55a429 Add ActiveSouce handling logic to switch to ARC input
when the new Active is not under the current device.

ag/4958795

Note that this CL only handles automatically switching to ARC.
Switching back to HOME should be handled by SetStreamPath or RoutingChange.

Test: local test.

Bug: 112476228
Change-Id: I211130c9483be7fcfe55b6a57f43d82bcf319737
2019-01-10 18:58:10 -08:00
Suprabh Shukla
ab99fe1be5 Adding some unit tests to presubmit
Adding a test mapping file to run some unit tests when files are changed
under com/android/server. Starting off by putting
AlarmManagerServiceTest which has been stably passing for a while now.

Test: atest --test-mapping

Change-Id: I059ca4cba35202862137285352e03008d8321da8
2019-01-10 18:15:10 -08:00
Garfield Tan
0443b37c71 Drop stale activity configuration updates.
This CL introduces sequence number to activity configurations and use
that to compare their staleness. Always use the last reported activity
configs for Activity#onConfigurationChanged() and drop all requests
that are older than the processed one.

Fixes: 120189873
Test: Manually verify that number of configuration changes drops during
drag-resizing with a crafted app that needs 250ms to perform one
configuration change. go/wm-smoke too.
atest FrameworksCoreTests:ActivityThreadTest
atest WmTests:ActivityRecordTests

Change-Id: Ie0fd15458517470542a689b51283f4d1ed2ad4cc
2019-01-10 15:33:07 -08:00
Amy
d76888aa03 Add RoutingInformation CEC message builder.
ag/4918461

Test: atest com.android.server.hdmi
Change-Id: I945c23cf213986b2b26f2c233931c703f6303e8d
2019-01-10 23:04:15 +00:00
Nataniel Borges
5a38bad677 Isolate WMTrace buffer and limit it by size not number of elements
Currently the buffer is a BlockingQueue with fixed capacity for 200
elements. This implementation changes it to use up to 512KB of
memory, instead of a fixed number of elements.

It also encapsulates the buffer in a separate class to support a ring
buffer for continuous monitoring (future implementation)

Test: Flash a device. Enable window manager tracing. Use the device.
Stop the trace and pull the logged trace. Open the trace in Winscope and
check if the data is correctly stored. Unit tests:
atest WmTests:WindowTraceBufferTest

Change-Id: Ia515d350d82520d378ae7339a6486ca6a43e62c3
2019-01-10 15:01:26 -08:00
Shubang Lu
736cbcd83d Merge changes I59ce940b,I0292b221,I6fbeb748
* changes:
  Add HdmiCecLOcalDeviceSource to extract shareable handlers of all the Hdmi CEC source devices into a parent class.
  Moving routing logic to playback device.
  Add SystemAudioModeRequest from non TV device logic.
2019-01-10 18:24:32 +00:00
chaviw
6262f22411 Fix drag and drop (3/3)
Remove reference to old transferTouchInput that was used from InputManager

Test: Builds
Bug: 120463595
Change-Id: Ia5b57cf881445c3aa67710665dcfb813004dc9ef
2019-01-10 16:45:06 +00:00
Amy
aefab64b7b Moving routing logic to playback device.
cherry-pick ag/4852475

Test: atest and local test.
Change-Id: I0292b221ce180ef3e3c1b82681ca5c8d9dee42ae
2019-01-09 17:41:56 -08:00
TreeHugger Robot
9fbf56aedc Merge "Fix creating new activity instance when launching alias activity" 2019-01-10 01:12:19 +00:00
Amy
06dc4cde47 Add SystemAudioModeRequest from non TV device logic.
cherry-pick ag/4735220

Test: atest com.android.server.hdmi
Change-Id: I6fbeb7480d83446a2a26b5703123dbb81eb4de19
2019-01-09 15:22:04 -08:00
Kweku Adams
7fb72a4a83 Moving BatterySaverPolicy into batterysaver directory.
This should make adding new methods that shouldn't be public easier.

Bug: 119261320
Test: atest com.android.server.power.PowerManagerServiceTest
and com.android.server.power.batterysaver.BatterySaverPolicyTest
and com.android.server.power.batterysaver.BatterySaverStateMachineTest

Change-Id: I8fdba4257be3d5602a738d2fffd55385775c3f81
2019-01-09 14:38:52 -08:00
Rob Carr
c9fd5fc46b Merge changes from topic "sf-remove-remove-layer"
* changes:
  SurfaceFlinger: Remove removeLayer
  Fix memory leak in SurfaceControl#copyFrom
2019-01-09 21:23:15 +00:00
TreeHugger Robot
1745585891 Merge "Adding system audio control muting logic." 2019-01-09 14:15:23 +00:00
Nicolas Geoffray
43c77abfa6 Merge "Remove notion of skip library check in framework." 2019-01-09 12:41:25 +00:00
Nicolas Geoffray
03dba3ba8c Remove notion of skip library check in framework.
bug: 111174995
Test: m
Change-Id: Id4d69258116696db3662ac7678f6d235fcccabc7
2019-01-09 08:48:38 +00:00
Louis Chang
23df1a6a25 Fix creating new activity instance when launching alias activity
New activity instance was being started on existing task while
starting alias activity because we used to correct the activity
intent for aliasing. Since the task record intent can now also
save alias activity component, they were evaluated as not using
the same intent filter.

Making sure they are evaluated as the same component as long as
they are having the same real activity.

Bug: 122550967
Test: atest TaskRecordTests
Change-Id: I4fd1f7310cf18645495532ffcf900f8113b69dd1
2019-01-09 15:19:33 +08:00
Tadashi G. Takaoka
a5f7c2c9e8 Cleanup pending Handler messages after test finished
Hopefully this mitigates the presubmit failure frequency.

This partially reverts commit 809cbc53e0 and
thus re-open issue 121229219.

Bug: 121229219
Test: Pass all presubmit tests for Window manager.
  $ atest --test-mapping frameworks/base/services/core/java/com/android/server/wm

Change-Id: I7033fc0a37e2900c5dfd991fc2ab4e840d0e0a38
2019-01-09 13:09:01 +09:00
Amy
cce55e0189 Adding system audio control muting logic.
cherry-pick ag/4823184

Test: atest com.android.server.hdmi
Change-Id: Ia6df1a4b3bce703e7d01956b539611732f2c5a86
2019-01-08 18:07:05 -08:00
Amy
6a6d618286 Add setStreamPath handler and change isPhysicalAddressMeOrBelow logic.
cherry-pick ag/4824661

Test: com.android.server.hdmi
Change-Id: I2af5cc35d15b2d304f76786d4b1114a81ea90b9c
2019-01-08 15:17:03 -08:00
Nick Chalko
90d4432baa Test for exact messages and detect extra messages.
cherry-pick ag/4647188

Change-Id: Idf09dc69c4222fc9f5371c4d8f92916f79f53f0a
Test: atest FrameworksServicesTests:com.android.server.hdmi
2019-01-08 12:01:11 -08:00
Kevin DuBois
df8fdf4e3f Merge "framework: fix setDisplayContentSamplingEnabled rc" 2019-01-08 16:57:03 +00:00
Michael Wachenschwanz
266dd3bfd7 Merge "Add Usage Reporting Api to UsageStatsManager" 2019-01-08 06:50:24 +00:00
TreeHugger Robot
0217050032 Merge "Use singleton WindowManagerService for testing" 2019-01-08 06:47:55 +00:00
TreeHugger Robot
a139abcfcc Merge "Fix restoring animator_duration_scale back to default" 2019-01-08 06:12:50 +00:00
TreeHugger Robot
2c7db5467d Merge "cec: support standby features for tx/rx [1/1]" 2019-01-08 03:18:00 +00:00
Robert Carr
8810b69fc4 SurfaceFlinger: Remove removeLayer
We remove explicit layer destruction and replace it
with reparent->null, completing the transition to
a reference counted model.

Test: Manual
Bug: 62536731
Bug: 111373437
Bug: 111297488
Change-Id: I6be5ae01218e566deb713ed9079b36e1135ff2ec
2019-01-07 18:36:36 -08:00
Evan Rosky
49c6eb47f9 Merge "Add FULLSCREEN policies to task level" 2019-01-08 02:29:09 +00:00
Tadashi G. Takaoka
5a108b83d8 Use singleton WindowManagerService for testing
This CL introduces a single WindowManagerService instance and uses it
for all tests that extend WindowTestBase. This way we can decrease the
number of object counts in the heap after running 526 presubmit tests
in WmTests.

Bug: 113239988
Test: Pass all presumit tests in WmTests.
  $ atest --test-mapping frameworks/base/services/core/java/com/android/server/wm

Change-Id: I8e5af477def6207bcc86cace6b240873516d075d
2019-01-08 10:55:52 +09:00
Tadashi G. Takaoka
809cbc53e0 Fix restoring animator_duration_scale back to default
WindowManagerService.setAnimationScale() sends an asynchronous message to
Handler to persist a setting value, but WindowManagerServiceRule cleans up
all remaining messages from Handler when a test finishes.  Thus there may be
a chance that global animator_duration_scale setting is left unchanged. This
CL eliminates removing pending messages and makes them finish instead.

Fixes: 121229219
Test: Pass all presubmit tests for Window manager.
  $ atest --test-mapping frameworks/base/services/core/java/com/android/server/wm
  $ adb shell settings get global animator_duration_scale
  1.0

Change-Id: I97a920cd221d9e0ed3f5cbf2172d9188b39d0ca6
2019-01-08 10:54:18 +09:00
Kevin DuBois
205a6809e1 framework: fix setDisplayContentSamplingEnabled rc
Return code was documented as true-as-success, but test
was implemented as false-for-success. Correct code so the
doc is correct.

Test: atest FrameworksServicesTests:DisplayManagerServiceTest
Change-Id: Ifc1ecda24735b64942090527866d19d6f75cda8b
Fixes: 122483211
2019-01-07 17:04:46 -08:00
Amy
93a97b9ba9 cec: support standby features for tx/rx [1/1]
cherrypick ag/4808863

Bug: 112553298

When press power key on soundbar, CEC type is 5(audio system),
it will send command to tx and rx devices to let them go to standby mode

Test: Tested with a TV
Change-Id: I242fb1028b5ae003e6054fe9b54e10d1f433374c
2019-01-07 16:53:09 -08:00
TreeHugger Robot
018edf2cb5 Merge changes I2e8f67e7,Ia5778bf4
* changes:
  Send DND broadcasts to approved DND apps
  Fix crash when disabling notification listeners
2019-01-07 23:15:17 +00:00