Commit Graph

5068 Commits

Author SHA1 Message Date
Chavi Weingarten
f8dd48e765 Merge "Removed global windowFrames from PWM" 2018-09-20 17:26:48 +00:00
Tadashi G. Takaoka
967b7f4f6e Merge "Add TEST_MAPPING and dummy tests to com.android.server.policy." 2018-09-20 08:20:50 +00:00
TreeHugger Robot
81e430324c Merge "Support non-resizeable activities on secondary displays" 2018-09-20 06:35:44 +00:00
Tadashi G. Takaoka
d9da0c8a9a Add TEST_MAPPING and dummy tests to com.android.server.policy.
Bug: 113800711
Bug: 111302567
Test: tradefed.sh run commandAndExit WmTests \
    --include-filter com.android.server.policy. \
    --include-annotation android.platform.test.annotations.Presubmit \
    --exclude-annotation androidx.test.filters.FlakyTest

Change-Id: I723c9da0c7c5284b3ab57cfd096f4a8428c17305
2018-09-20 13:33:26 +09:00
chaviw
1454b39b6a Removed global windowFrames from PWM
In PWM, use the specific WindowState's WindowFrame to
update the frame instead of using the global object in PWM
and passing it to WindowState

Test: go/wm-smoke
Bug: 111359087
Change-Id: I9c215bf2113f0ae5c89654a58ef93e7ed7620e84
2018-09-19 15:53:24 -07:00
Santos Cordon
64a6e61452 Add initial wakefulness state test.
Adds various changes to PowerManagerService to support mocking out
various managers and methods.

Adds a simple goToSleep() API test that verified it went to sleep.

Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java
Change-Id: Iae8d6fcec05c3fc8a48ed5808d6813f1fdd7c7ca
2018-09-19 17:44:19 +00:00
Julia Reynolds
63048fd8c5 Merge "Reduce errors for managed services" 2018-09-19 14:13:50 +00:00
Julia Reynolds
ca8e535c93 Reduce errors for managed services
Seen in on devices with work profiles.

- Only bind the the current started user(s)
- Wrap applyEnqueuedAdjustmentFromAssistant with a try/catch
since assistant services cannot recover from it on their own.

Additionally, while debugging this rebindServices hurt my brain,
so I've split it up a bit and added comments and tests.

Test: runtest systemui-notification, device restart and log queries
Bug: 113296846
Change-Id: I19b9044ff87712f9ef5401457217156ea9fb9f1f
2018-09-18 13:47:37 -04:00
TreeHugger Robot
3750d8d70c Merge "Check preferred display for matching existing activity" 2018-09-18 06:18:38 +00:00
Riddle Hsu
b70b36d880 Check preferred display for matching existing activity
Fix two conditions:
- If the reused activity is in the top focused stack, it is unable
  to reparent to preferred display because top task is the same as
  reused task.
- If the reused activity is in preferred display, it is unnecessary
  to get launch stack that may produce a dangling stack.

Also make TestActivityDisplay support real multiple display.
Originally it gets display from DisplayManager which restricts
to use default display only.

Bug: b/115277654
Test: atest FrameworksServicesTests:ActivityStarterTests# \
      testDeliverIntentToTopActivityOfNonTopDisplay
Test: atest FrameworksServicesTests:ActivityStarterTests# \
      testReparentTopFocusedActivityToSecondaryDisplay

Change-Id: Id24c235a8a4ffab2917d46fc287413f9bf28c58d
2018-09-18 12:51:52 +08:00
TreeHugger Robot
4c888c779c Merge "Notifs sent from suspended apps should reappear" 2018-09-17 18:33:39 +00:00
Beverly
3c707b4f05 Notifs sent from suspended apps should reappear
Notifications sent from suspended apps were being preemptively
blocked by isBlocked in NotificationMangerService. Instead, isBlocked
should only block notifications the user has specified to block. This
should not include suspended packages. (Notifications sent from
suspended apps are marked as hidden/suspended in the RankingMap in
PostNotificationRunnable so they can be resurfaced when the sending
app is unsuspended.)

Change-Id: I377eec04c9636e800bcd2709984c19610f2c524e
Bug: 113100262
Test: atest cts/tests/app/src/android/app/cts/NotificationManagerTest.java
Test: runtest -x cts/tests/tests/notificationlegacy/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java
Test: runtest -x frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
2018-09-17 11:49:54 -04:00
TreeHugger Robot
6c109c76c9 Merge "Break install up into phases" 2018-09-17 15:14:10 +00:00
Dieter Hsu
c3ad8bdb72 Merge "Fix accessibility services tests to work with atest" 2018-09-17 03:04:09 +00:00
TreeHugger Robot
134ffb0c25 Merge "Move 3 IMMS utility classes to services.jar" 2018-09-15 17:20:28 +00:00
TreeHugger Robot
ef25beb18a Merge "Extract getSuitableLocalesForSpellChecker()" 2018-09-15 16:40:23 +00:00
TreeHugger Robot
abcfcbbbfe Merge "Move LazyIntToIntMap to services.jar" 2018-09-15 01:07:59 +00:00
Patrick
4ccae9484b Break install up into phases
Install will be broken up into four phases:

1) Prepare - Analyzes any current install state, parses the package and
does initial validation on it.
2) Scan - Interrogates the parsed packages given the context collected
in prepare.
3) Reconcile - Validates scanned packages in the context of each other
and the current system state to ensure that the install will be
successful. Any failures to reconcile will fail the install.
4) Commit - Commits all scanned packages and updates system state. This
is the only place that system state may be modified in the install flow
and all predictable errors must be determined before this phase.

This change moves most low hanging fruit out of prepare and into one of
the phase that most makes sense to own it.

Bug: 109941548
Test: manual - install a few dozen apps from Play Store
Test: manual - install update to GMS Core
Change-Id: Ibd4acc15996d8621d16e1f94d0d5c07826f66e3d
2018-09-14 14:58:43 -07:00
TreeHugger Robot
611f2ac771 Merge "Fix stuck notifications" 2018-09-14 13:33:49 +00:00
Dieter Hsu
a7fa814e95 Fix accessibility services tests to work with atest
- Remove @BeforeClass `Looper.prepare()` that do not work with atest
- Fix TouchExplorerTest: mock AccessibilityGestureDetector to not create
  internal handler.
- Fix broken tests in MagnificationControllerTest
- Remove @FlakyTest annotation from MagnificationControllerTest &
  FingerprintGestureControllerTest

When using atest, timeout is applied to command `am instrument`. Then
@BeforeClass & @Before are both running on instrument thread, but test
cases are running on a seperate thread. It dispatch messages immediately
if the looper is associated to the same thread. When runniung tests with
atest, dispatching the message is not always done in the same thread. So
verifying the expectation on test thread would be flaky.

The solution to use a looper associated with test thread would be ugly.
Because the looper related stuff should set up without @Before or
@BeforeClass including preparing a looper on demand in a utility
function for every test case needed.

Here changing the handler behavior to enqueue but to dispatch messages
explictly from test could serialize the execution. This would use main
looper (no need to prepare) to create handler, but dispatch and clear
messages ourself. Not good enough but less ugly to run `am instrument`
with or without timeout.

Bug: 74748946
Test: atest -d FrameworksServicesTests:com.android.server.accessibility
Test: adb shell am instrument -w -e package com.android.server.accessibility \
      com.android.frameworks.servicestests/androidx.test.runner.AndroidJUnitRunner

Change-Id: Ib67d8b7305511d218b23f4b5ab0b0a12bea9ae10
2018-09-14 08:57:44 +00:00
TreeHugger Robot
068923f3de Merge "Fix z-order of displays when adjusting position of stack" 2018-09-14 08:05:41 +00:00
Riddle Hsu
2f6e174c4a Fix z-order of displays when adjusting position of stack
When moving a stack to top including its parent (display),
if the target position is adjusted to non-top because there
is other always-on-top stack in this container, the display
should also be moved to top for higher focus priority.

Z-order
Top          |----------------|
   Display 1 | [Normal stack] |
             |----------------|

             |----------------|
   Display 0 | [Pinned stack] |
             | [Normal stack] | <- Moving task in here
Bottom       |----------------|

Bug: 113099160
Test: atest TaskStackContainersTests#testDisplayPositionWithPinnedStack
Change-Id: I877fd2acddeeb6d68fe6f4336dd202b9db11d94e
2018-09-14 12:58:00 +08:00
Riddle Hsu
1656713b6f Support non-resizeable activities on secondary displays
When launching a non-resizeable activity to different display,
check if the new configuration should update to activities and
notify systemui to show a toast activity with message "App may
not work on a secondary display".

Bug: 112288258
Bug: 112963441
Test: atest ActivityManagerMultiDisplayTests
Test: atest FrameworksServicesTests:ActivityRecordTests
Change-Id: If86bb8593ecca382074583e6bb998fcba1ee96aa
2018-09-14 12:51:24 +08:00
Julia Reynolds
564273f6df Fix stuck notifications
Don't tell listeners about changes to enqueued notifications;
they'll pick up the changes in the post notification runnable.

Change-Id: I56c4ba79bcf42c30ad9a0da936eb0b774a6f3f08
Fixes: 74236718
Test: runtest systemui-notification
2018-09-13 15:54:53 -04:00
Beverly Tai
1f8f03b0b7 Merge "New: ZenPolicy for DND" 2018-09-13 18:39:02 +00:00
Beverly
174d741944 New: ZenPolicy for DND
Bug: 111474881
Test: atest frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/ZenModeConfigTest.java
Test: atest frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/ZenPolicyTest.java
Change-Id: I41809b30866ab7172dd80e0504694025f7fa3c50
2018-09-13 10:17:03 -04:00
TreeHugger Robot
071f28ded1 Merge "Revert the mandatory backups feature." 2018-09-13 08:45:35 +00:00
TreeHugger Robot
7a21a3128d Merge "Support IME Window to show in secondary display." 2018-09-13 07:54:47 +00:00
lumark
90120a8b5b Support IME Window to show in secondary display.
1) Moving WMS.setInputMethodWindowLocked to DisplayContent,
   each display can have its own IME window.
2) Add getDisplayIdFromWindow in WindowManagerInternal,
   used for InputMethodManagerService to know which display
   for given IME window token.
3) Support add / remove IME window according displayId.
4) Modify WMS.inputMethodClientHasFocus to traverse all active display
   if inputMethodClient focused.
5) Add displayId parameter for IInputMethod.initializeInternal to
   update context display then client can addView to right display.

Note: 1) There should be zero behavior difference as long as the target
         app is running on the default display.
      2) The current implementation is not final and there are still
         chances that the current IME may not work well or even crash
	 depending on how the IME is implemented.

Bug: 111364446
Test: manual, use ActivityView & launch Messages in VirtualDisplay,
      tap search icon to see if soft input keyboard shown &
      app window size is adjusted by soft input.
Change-Id: I8da315936caebdc8b2c16cff4e24192c06743251
2018-09-13 12:52:40 +08:00
Yohei Yukawa
e6b6e0e785 Move 3 IMMS utility classes to services.jar
Short summary:

There is no need to have these 3 utility classes in frameworks.jar,
because these classes are used only from InputMethodManagerService
(IMMS) and its utility classes. We should move them to services.jar.

Long summary:

 * InputMethodSubtypeSwitchingController

This class was mistakenly placed in the current Java package since its
beginning [1].  This class is purely a state machine that is designed
to be used only from IMMS hence there has been no way for app
processes to use this class in a meaningful way.

 * LocaleUtils

This class was also mistakenly placed in the current Java package
since its beginning [2].  This class is purely a state machine that is
designed to be used only from IMMS hence there has been no way for app
processes to use this class in a meaningful way.

 * InputMethodUtils

The situation of InputMethodUtils is a bit different.  It was
introduced in the right place actually [3], because the original
purpose of this class was to share some utility methods between IMMS
and the Settings application.  For that purpose, having this class
under frameworks/base/core/java instead of frameworks/base/services/
totally made sense.

What was unfortunate is that we have kept adding more and more utility
methods into InputMethodUtils since then, even though most of methods
have been used only from IMMS.  To make things worse, more and more
random components started depending on this utility class.  When we
realized it, we were in the situation where we could not even easily
refactor methods in InputMethodUtils without updating a bunch of
call-sites across repositories, including multiple platform-specific
Settings app and SetupWizards.

This is basically why I decided to stop allowing Settings apps and
SetupWizard to use InputMethodUtils, and decided to let them depend on
SettingsLib [4] instead.  After many cleanup CLs [5], we have finally
achieved the state where InputMethodUtils is used only from the system
server process.

 * A special bonus

With my previous CL [6], we can even make these 3 utility classes
package-private, which guarantees that only IMMS and its utility
classes directly depends on these utility classes.

 * Risk

Now that this is purely a mechanical refactoring of an implementation
detail within frameworks/base, there should be no observable behavior
difference.

 [1]: I11ed9a767588f8080753cd9bce011dac7db579ad
      d7443c83ce
 [2]: I315cf3722a06e00bdbfac284c4949578da8fe78d
      102ff0726d
 [3]: I0bc9954f163a3ec38d08b9ba842a8a31176eb6a6
      8e303cc5dd
 [4]: frameworks/base/packages/SettingsLib
 [5]: CLs that have Bug 77730201 in their commit messages
 [6]: I023d8f2863601ee54f304988117d8ea750770f70
      603f4d00c6

Bug: 77730201
Bug: 114660660
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Test: atest FrameworksCoreTests:com.android.internal.inputmethod
Test: atest FrameworksServicesTests:com.android.server.inputmethod
Change-Id: I37594096151d77adb6741a41d7985a4506f96ccb
2018-09-12 16:42:48 -07:00
Yohei Yukawa
3781ca8c64 Extract getSuitableLocalesForSpellChecker()
When I needed to introduced a new helper method for
TextServicesManagerService (TSMS) to fix Bug 22042994 [2] I was just
lazy and decided to put it into InputMethodUtils instead of creating a
new utility class for TSMS.

Now that InputMethodUtils is going to be moved to
com.android.server.inputmethod as a package-private utility class, it
is time to pay off my laziness.

With this CL, getSuitableLocalesForSpellChecker() will be extracted
out from InputMethodUtils to a new package-private utility class
com.android.server.textservices.

This is purely a mechanical refactoring.  There should be no
observable behavior difference.

 [1]: I094f1c33430f7904a1dac6167431d6df64a07212
      174843afb6

Bug: 77730201
Bug: 114660660
Bug: 115516399
Test: atest FrameworksCoreTests:com.android.internal.inputmethod
Test: atest FrameworksServicesTests:com.android.server.textservices
Change-Id: If6cd051aa0ae7780631d5bec5b7d01faac4a83a0
2018-09-12 15:36:03 -07:00
Yohei Yukawa
81e806a72a Move LazyIntToIntMap to services.jar
This class should have lived in services.jar.  When I introduced
LazyIntToIntMap [1] to re-enable cross-profile use of spell checker
APIs, I unnecessarily put this class in frameworks.jar despite the
fact that this utility class is used only in the system server
process.

This CL also makes this utility class package-private so that other
component will not accidentaly depend on it.

This is purely a mechanical refactoring.  There should be no
observable behavior difference.

 [1]: Ic046f832f203115106409a53418a5746eb6d4939
      3f8c568883

Bug: 115516399
Test: atest FrameworksServicesTests:com.android.server.textservices
Change-Id: I9390ba11687e1db66d02fe1cdfb9ed59adde3768
2018-09-12 15:33:25 -07:00
Sudheer Shanka
21a8afd055 Merge "Register NPMS$UidObserver to listen for only necessary procstate changes." 2018-09-12 17:29:43 +00:00
Kenny Guy
fb59cfa0ca Merge "Remove 0 param BrightnessConfiguration.Builder constructor" 2018-09-12 13:25:37 +00:00
Lenka Trochtova
3b6e08772e Revert the mandatory backups feature.
Bug: 79736299
Test: make RunFrameworksServicesRoboTests
Test: cts-tradefed run cts -m CtsBackupHostTestCase

Change-Id: I1209174c9f6aa794c7ca67f4a8737c0589d5fd69
2018-09-12 13:39:05 +02:00
Sudheer Shanka
6a3c07e2c5 Register NPMS$UidObserver to listen for only necessary procstate changes.
Right now, NPMS listens for all the procstate changes. This will slows
down processing of procstate changes which actually matter and also
fills up the netpolicy history pretty quick.

Bug: 112485285
Test: cts-tradefed run singleCommand cts-dev -m CtsHostsideNetworkTests -t \
      com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Test: atest services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java

Change-Id: Iaaef8ea4ee16f5b69cafc1e7e5908c6ff6fe1ed3
2018-09-11 19:14:50 -07:00
Evan Rosky
bf6977c4cb Merge "Let ActivityStacks inherit windowing mode from parent" 2018-09-11 21:23:03 +00:00
Kenny Guy
d62c3cfcc3 Remove 0 param BrightnessConfiguration.Builder constructor
Tidy up constructor that was hidden rather than removed
to allow pre-release versions of zebedee to work.

Test: atest BrightnessMappingStrategyTest
Test: atest android.display.cts.BrightnessTest
Test: atest BrightnessConfigurationTest
Change-Id: I89989d426ba84232843ddd45f614b837d47086a6
2018-09-11 17:57:46 +01:00
Evan Rosky
1047574907 Let ActivityStacks inherit windowing mode from parent
Create ActivityStacks with UNDEFINED override by default.

Added "memory" of previous override mode during transient modes
(split-screen/pip) and restore that instead of hard-coding
fullscreen upon leaving one of those modes.

Added override mode to containers dump output.

Bug: 113900640
Test: go/wm-smoke
      relevant com.android.server.am tests (ActivityStack, TaskRecord,
      ActivityStarter, ActivityRecord, ActivityManagerService).
      Added test to explicitly check override mode.

Change-Id: I4ab51b4b14604b4953fdab6632cb507b8a39d45a
2018-09-10 19:30:05 -07:00
Julia Reynolds
a7ba45acb1 Allow apps to proxy notifications for other apps
This will allow apps to delegate posting to persistently
running apps, to decrease the numbers of times apps need to wake up
just to post a notification.

Bug: 111452544
Test: runtest systemui-notification
Change-Id: I1ead239747f2871f222d0ce6a971d1448a0766ad
2018-09-10 15:00:59 -04:00
Wei Sheng Shih
b93800a9dd Merge "Fix flaky test FrameworksServicesTests:ScreenDecorWindowTests." 2018-09-10 02:56:48 +00:00
TreeHugger Robot
82aca2a41d Merge "Add dummy WmTests" 2018-09-07 13:54:10 +00:00
TreeHugger Robot
c399c27c0f Merge "Separate servicestests/utils" 2018-09-07 13:52:33 +00:00
Tadashi G. Takaoka
bc7bc12fee Add dummy WmTests
Test: atest WmTests
Bug: 113800711

Change-Id: I1e29cc9116adf2d08c00d035ecad48e4ef604106
2018-09-07 18:09:22 +09:00
Eric Sandness
a521deb920 Merge "Block Policies From Device Admin Targetting Q" 2018-09-07 09:07:21 +00:00
wilsonshih
e1cd47e935 Fix flaky test FrameworksServicesTests:ScreenDecorWindowTests.
Use showWhenLocked attribute to prevent TestActivity goes to
Paused/Stopped.

Bug:111708089
Test: atest FrameworksServicesTests:com.android.server.wm.ScreenDecorWindowTests
Change-Id: I3ae1963f376caa3fba6c3694b8265bedb55e54b4
2018-09-07 16:35:31 +08:00
Tadashi G. Takaoka
77439ba9b3 Separate servicestests/utils
The test utility classes under com.android.server.testutils are moved
to servicestests/utils directory in order to easily be shared between
FrameworksServiceTests and upcomming WmTests.

Test: tradefed.sh runAndExitTest FrameworksServicesTests \
    --include-annotation android.platform.test.annotations.Presubmit \
    --exclude-annotation androidx.test.filters.FlakyTest
Bug: 113800711
Change-Id: I39c623a286df1067fffadc25c8a49c12cc05c82c
2018-09-07 16:41:56 +09:00
Louis Chang
4b719a7cad Merge "Find task on preferred display first" 2018-09-07 03:38:59 +00:00
TreeHugger Robot
dfdc67d9cf Merge "Injecting system calls into alarm manager" 2018-09-07 02:19:37 +00:00
Suprabh Shukla
6226c2ff3c Injecting system calls into alarm manager
Injecting and mocking dependencies to make the service unit testable.
Shuffled around initialization to make that possible.

Also added the first batch of unit tests. The idea is to have extensive
coverage of minute pieces of alarm manager logic, which should help us
catch any regressions caused by future changes to the code.

Test: atest com.android.server.AlarmManagerServiceTest
atest CtsAlarmManagerTestCases

Bug: 111454659
Change-Id: Ifa1c09646f688cf5c41abe17d98dbc19978eac70
2018-09-06 16:20:30 -07:00