767 Commits

Author SHA1 Message Date
Chris Wren
4e4d325b56 Merge "use an observer for the default sound" into nyc-mr1-dev 2016-06-27 15:08:03 +00:00
Chris Wren
d405431bc9 use an observer for the default sound
matches other settings use, and also improves testability of buzzbeepblink

Change-Id: I9445448c4c4f24f4f49f7cb1fdcd2f5362944606
2016-06-24 17:21:51 -04:00
Makoto Onuki
b08790c3b2 Shortcut: Only "main" activities can have shortcuts.
- Don't publish shortcuts when their target activities are not main.
- Only scan manifest shortcuts for main activities.
- When an app is updated, remove shortcuts that no longer belong to
valid main activities.

- Also re-publish manifest shortcuts after 'clear data'
- Also listen to PACKAGE_CHANGED and disable/re-publish shortcuts
properly.

Bug 29355786
Bug 29582255
Bug 29601844

Change-Id: I6c701ce669cf30a227bc2af4aa01de467ef73e3a
2016-06-24 13:07:17 -07:00
Makoto Onuki
3bdbf985e1 Make "cmd package set-home-activity" more CTS friendly
- Print "Success" when it went well.
- Catch all exceptions and print error message, not just
RemoteExceptions

- Update the shortcut manger test utility to match the new behavior

Bug 29612099

Change-Id: If6a80241ea5e8ef0b2d3f961d1442e730b908764
2016-06-23 17:01:02 -07:00
Lorenzo Colitti
5719a7f478 Merge \"Don\'t loop forever on 0-length options.\" into nyc-dev
am: 7aac630f8e

Change-Id: Icd3c0265ffb30232642f581a7c0031ed55ee6d21
2016-06-23 08:23:18 +00:00
Lorenzo Colitti
8995d85b94 Don't loop forever on 0-length options.
A malformed RA could cause the Ra constructor in ApfFilter to
enter an infinite loop while holding the class lock. This blocks
IpManager until reboot and drains the battery.

Bug: 29586253
Change-Id: Idaa46b3bc50371db076630881883807c2fa21674
2016-06-23 15:43:34 +09:00
Guang Zhu
3394a8e523 temporarily disable FakeSettingsProviderTest
Bug: 29281167
Change-Id: I463d7707c197bd114de762c86e3b3e574d456e3b
2016-06-22 16:30:09 -07:00
Makoto Onuki
b5a012fd6f Shortcut Manager: Address API council feedback and fix TODOs
Bug 29515722
Bug 29516909
Bug 29515090
Bug 29516954
Bug 29515088

Change-Id: Ibe1d27033cbd0fd50d37e3d9945b47551211c568
2016-06-21 14:42:48 -07:00
Makoto Onuki
901c03faba Merge "Launcher shortcut callback should deliver manifest shortcuts too" into nyc-mr1-dev 2016-06-20 21:06:42 +00:00
Chris Wren
5e27227b68 Merge \"assume a generous prior in the rate estimator\" into nyc-dev
am: fddf5df01f

Change-Id: I73dc1cb6a2a13bac21ff576319e7b9123aee09b3
2016-06-20 17:33:15 +00:00
Makoto Onuki
4d6b87ffdf Launcher shortcut callback should deliver manifest shortcuts too
- Also include "activity" in the key fields, as this is now an
important field.

- Also optimize ShortcutInfo parceling for the "key field only" case.

Bug 29394043
Bug 29451629

Change-Id: I61b2bc2f61ad6ebdcbaf6d02f1bd88777c45a7f0
2016-06-20 09:28:05 -07:00
Chris Wren
888b7a8faf assume a generous prior in the rate estimator
currently with one data point the estimator is biased high. If we don't
have any data we want to be biased low to allow the first interaction
to be an isolated burst.

Also add metrics for enqueue rate to make it easier to debug this
code in the future (currently we only have metrics after the
rate limiter).

Bug: 29379789
Change-Id: I7b1d379290a55f120d039fd29d1bc0abbc6d4932
2016-06-17 15:50:30 -04:00
Makoto Onuki
df6da040e0 Update manifest shortcut XML schema
Use the standard <intent> tag instead of custom tags.

- Also fix setDynamicShortcuts(), which was broken in the previous CL.
- Also tolerate runtime exceptions while parsing XMLs
- Also fix b/29422018 while I'm at it

Bug 29390156
Bug 29077932
Bug 29422018

Change-Id: I2756c9d66c6d7b2962a982d9e57a7d84a5755b28
2016-06-17 11:51:20 -07:00
Gustav Sennton
939f8caec2 Merge \"Support using uninstalled WebView packages as WebView implementation.\" into nyc-dev
am: e25c8532b6

Change-Id: Ie9f405765c146d21f1399037dd236d440902f0f9
2016-06-16 17:46:53 +00:00
Gustav Sennton
e25c8532b6 Merge "Support using uninstalled WebView packages as WebView implementation." into nyc-dev 2016-06-16 17:40:10 +00:00
Makoto Onuki
489bafbb4b Merge "Shortcut: Reset throttling upon inline reply" into nyc-mr1-dev 2016-06-16 17:05:55 +00:00
Gustav Sennton
0df2c5566a Support using uninstalled WebView packages as WebView implementation.
A package can be uninstalled for the system user but still be installed
on the device. Currently, we do not use such a package as WebView
implementation which means we fall back to using the fallback WebView
package.
However, if the fallback package is not valid (because it needs to be
updated first) loading WebView will fail.

With this change we fetch allow the fetching of information from
packages that are uninstalled for the system user so that we can still
load WebView when the only valid WebView provider is uninstalled for the
system user.

Also listen to package additions/changes/removals for all users -
otherwise we won't notice when a package becomes replaced if it was
already uninstalled for the system user.

Bug: 29321185
Change-Id: Ia23c4493844877aea1b4eab7e666fd37540c4f97
2016-06-16 15:45:45 +01:00
Makoto Onuki
70a91541e9 Merge "ShortcutManger: Auto-adjust ranks." into nyc-mr1-dev 2016-06-15 21:44:58 +00:00
Makoto Onuki
9e1f5595bd ShortcutManger: Auto-adjust ranks.
Spec: go/shortcutmanager-spec-ranks

Bug 28984376
Bug 28536066

Change-Id: Ibffb92233c62792af06eeadc5a9a6379d0506a3c
2016-06-15 14:24:44 -07:00
Kevin Gabayan
68dd6233bd Compute AnyMotionDetector angle using atan2. Bug: 29232136 am: db843c913f
am: e46d4fd7ad

Change-Id: I666fc7432cf6140c938423ec4370ca7727996bd6
2016-06-15 20:49:49 +00:00
Makoto Onuki
d6e1f3bec1 Shortcut: Reset throttling upon inline reply
When the user does an "inline reply", we consider the notification
publisher app is "activated" and reset the shortcut throttling.

Bug 28705275

Change-Id: Ic9ffa13635274ead7e9d1e832cd31dea997830aa
2016-06-14 14:12:07 -07:00
Makoto Onuki
78f16950c6 Merge \"Push DO/PO package names from DPMS to PM\" into nyc-dev
am: f419bd9e03

Change-Id: Ic3071f3a712da72fd141ef37ac6aabe6dbd09355
2016-06-13 21:23:18 +00:00
Makoto Onuki
5b8f5fd38b Merge "Fix some exception messages and enhance unit tets" into nyc-mr1-dev 2016-06-13 16:28:32 +00:00
Kevin Gabayan
db843c913f Compute AnyMotionDetector angle using atan2.
Bug: 29232136

Change-Id: Ie57d0228eb42246c4ac1d7a01e2782a621b7e78f
(cherry picked from commit b070577d35436ca0f5463e6ed19a28ae431cfbfb)
2016-06-11 00:43:11 +00:00
Kevin Gabayan
21f47bcf8c Merge "Compute AnyMotionDetector angle using atan2. Bug: 29232136" into nyc-mr1-dev 2016-06-11 00:20:42 +00:00
Kevin Gabayan
b070577d35 Compute AnyMotionDetector angle using atan2.
Bug: 29232136

Change-Id: Ie57d0228eb42246c4ac1d7a01e2782a621b7e78f
2016-06-10 16:07:52 -07:00
Makoto Onuki
a1d38b3c95 Fix some exception messages and enhance unit tets
Bug 29275393

Change-Id: Idaa8564d41f86de2a2cbefa4ff3c08b89a3a6dd2
2016-06-10 15:32:26 -07:00
Christopher Wiley
d985dde8cc Fix race conditions between Tethering and TetherInterfaceStateMachine
( cherry-pick of de4819dc82b734036b22416228327d2712e01884 )

Previously, Tethering would answer requests for current tethering state
by calling methods on instances of TetherInterfaceStateMachine to build
up that state. This is incorrect, since state queries can come in on an
arbitrary thread, independent of updates to the state machines
instances.

Fix this by:
  - Altering TetherInterfaceStateMachine to push consistent state
    snapshots to Tethering via notifyInterfaceStateChange()
  - Storing the last state snapshot in Tethering.mTetherStates
  - Removing public methods to query TetherInterfaceStateMachine state.
  - Consistently synchronizing access to Tethering.mTetherStates

Bug: 29009601
Test: WiFi Tethering continues to work, unittests continue to pass

Change-Id: Ied334f5e8739bc3aff1b08a1079095b9cc2a7958
2016-06-09 11:43:14 -07:00
Christopher Wiley
281ec3272f Merge changes from topic 'tethering-ownership' into nyc-mr1-dev
* changes:
  Tethering: Own WiFi tethering state and lifetime
  Use an ArrayMap instead of HashMap to track tether interfaces
  Consolidate cleanup logic in TetherInterfaceSM.TetheredState
  Annotate TetherInterfaceStateMachineTest for APCT
  Rely on Tethering mutex for TetherInterfaceSM
  Rename TetherInterfaceSM to TetherInterfaceStateMachine
  Remove dead code from TetherInterfaceSM
  Remove transient StartingState from TetherInterfaceSM
  Expand test coverage of TetherInterfaceSM
  Add demonstration unittest for TetherInterfaceSM
  Extract TetherInterfaceSM to its own class.
  Make Tethering.TetherInterfaceSM more self contained
  Clean up class members in Tethering.TetherInterfaceSM
  Fix trivial warnings in Tethering.java
2016-06-08 20:55:13 +00:00
Makoto Onuki
c29f62c738 Push DO/PO package names from DPMS to PM
Bug 29126573

Change-Id: I95ea1559f6acf5d2f0e1b0953568cdfc938e83b9
2016-06-08 11:52:13 -07:00
Makoto Onuki
3bb4366006 Merge "ShortcutManager: deal with changing resource IDs on app update" into nyc-mr1-dev 2016-06-08 17:00:00 +00:00
Makoto Onuki
3e27d1254b Merge "ShortcutManager: Optimize package scanning" into nyc-mr1-dev 2016-06-08 16:16:40 +00:00
TreeHugger Robot
3e2bfbd135 Merge changes Ic98e3bcb,Idb0c55fc,Ia8649061,I5e7e5a87 into nyc-mr1-dev
* changes:
  Give WakeupMessage the ability to transport an object as well.
  Don't treat the lingerExpired broadcast specially.
  Add a test for mobile data always on.
  Add a FakeSettingsProvider and use it in ConnectivityServiceTest.
2016-06-08 06:35:32 +00:00
Lorenzo Colitti
9acda9c825 Don't treat the lingerExpired broadcast specially.
NetworkMonitor no longer uses the broadcast for lingering, it
uses WakeupMessage instead.

Bug: 23113288
Change-Id: Idb0c55fc68cb8f45b3213c7134213904f227852e
2016-06-08 14:09:07 +09:00
Lorenzo Colitti
762ea7aab7 Add a test for mobile data always on.
Bug: 23113288
Change-Id: Ia8649061a797367d135bb5576600a7cdc85a822e
2016-06-08 14:08:59 +09:00
Lorenzo Colitti
6d553f6dfd Add a FakeSettingsProvider and use it in ConnectivityServiceTest.
This class makes it easier to test code that uses Settings:

1. Real device or emulator settings don't affect the code under
   test; all settings always start off empty.
2. It's possible to change settings from the test without
   affecting system settings.
3. No changes are needed to the code under test. The changes to
   the tests are simple: just add a fake ContentResolver to
   whatever mock Context is already used by the test, and make
   that ContentResolver use the fake provider.

Bug: 23113288
Change-Id: I5e7e5a87571444ae49ccf551705620675a36cd17
2016-06-08 14:05:55 +09:00
Makoto Onuki
157b1628fd ShortcutManager: deal with changing resource IDs on app update
- When an app is upgraded, all the resource IDs may change.  So
if a shortcut is previously published with an icon for res ID 100
and the publisher is upgraded, resource #100 may refer to something
different.

- So now the service also remembers resource names for icon resources,
as wells as string resources.  When an app is updated, the service
fetch the updated resource IDs by name.

- Also extract all string resources when a shortcut is published
and persist them, so that even when the original string resources are
removed from the app, the launcher can still show the extracted strings.

- When the system locale changes, re-extract all string resources.

- Also really hide the constants in ShortcutInfo that were
accidentally made public.

Change-Id: I23c29b45c1de5d76175229190a1533c9c62c5960
2016-06-07 16:11:30 -07:00
Makoto Onuki
6dd9fb7004 ShortcutManager: Optimize package scanning
SM needs to check all packages when a user is unlocked in case
any apps have been upgraded while the user was not running,
in which case it'll publish the manifest shortcuts.

Currently it actually scans all apps' manifests.

This CL optimizes it by remembering the last scan time (for each user)
and checks only the packages that have been updated since then.

Bug 29069154

Change-Id: Id10b6be8915fe7c1e26daccde7951ddbd01ea452
2016-06-07 10:32:19 -07:00
Christopher Wiley
5c0b10a4a9 Tethering: Own WiFi tethering state and lifetime
( cherry-pick of f1315c3cd6d77e812ae32fe038b4e8bf2e70d5bf )

- Add logic to Tethering to track whether the user has requested
  tethering via WiFi.
- Subscribe to intents regarding soft AP state to enable and
  disable tethering when the AP comes up or goes down.
- Refactor IP configuration logic to do configuration for WiFi
  as well as USB.

Bug: 29054780
Test: WiFi tethering continues to work on angler
      Tethering related unittests continue to pass.

Change-Id: I6eff2573ca3fd11fabcf138c468ba517ff2daf65
2016-06-07 09:33:12 -07:00
Christopher Wiley
e10bfc0ee6 Consolidate cleanup logic in TetherInterfaceSM.TetheredState
( cherry-pick of f54c5a932a9ac4a491ce775b21ff8288e40b5bad )

This pushes all TetheredState cleanup logic into a single place.
All new unittests fail without the changes to TetherInterfaceSM.

Bug: 28915272
Test: Compiles, unittests pass, WiFi tethering continues to work.

Change-Id: Ia7bf210e00e9a54f2797baebc2e5333ce314c947
2016-06-07 09:32:11 -07:00
Christopher Wiley
0ab0dd317f Annotate TetherInterfaceStateMachineTest for APCT
( cherry-pick of d905add4747d6060355c44dac1dce0eccd8014fb )

APCT needs a little additional magic to pick up JUnit4 tests.

Bug: 28958508
Test: Tests continue to pass

Change-Id: Ia45d91bb3b06e60e3a46ffe738d4468356e066b3
2016-06-07 09:31:41 -07:00
Christopher Wiley
4312a4c433 Rely on Tethering mutex for TetherInterfaceSM
( cherry-pick of 4bc8d6b1ac0cb7d4192c829a44d988516f0adbdb )

Stop passing Tethering's mutex into TetherInterfaceSM, and instead
simply rely on Tethering to acquire its own mutex when accessing
instances of TetherInterfaceSM.

While here, remove some boolean fields (previously guarded by the mutex)
which duplicate state information.

Change-Id: Ie6b2128970981786a5d64fbf700c9f3d0a6721fb
Test: Compiles, unittests pass, WiFi tethering continues to work.
Bug: 28910007
2016-06-07 09:31:10 -07:00
Mitchell Wills
7040b4ebdf Rename TetherInterfaceSM to TetherInterfaceStateMachine
( cherry-pick of c5baad02503d17a812ee1b44cc817c7e18935ff1 )

Change-Id: I324690b20f37cef6d58872e21b126a87d16f7ec8
2016-06-07 09:30:27 -07:00
Christopher Wiley
9ad83ab607 Remove dead code from TetherInterfaceSM
( cherry-pick of 2ea4166c74e70d3796b06c91f37eb03eecdf4773 )

Because no code outside of unittests ever issued these commands
to TetherInterfaceSM, we never executed any of the removed codepaths.

Change-Id: Id54f6e4eaeff8b3486cd78ddcc8c2a31011e6436
Test: Compiles.  Unittests continue to pass.
Bug: 28798823
2016-06-07 09:29:53 -07:00
Christopher Wiley
3b1d922503 Remove transient StartingState from TetherInterfaceSM
( cherry-pick of 79e7fde00d74c2b6d329f7341029ea6b04ac2d97 )

This state immediately switched into the TetheredState.
We can safely remove it at only the expense of a misleading state
broadcast.

Bug: 28798823
Test: runtest frameworks-services -c
    com.android.server.connectivity.tethering.TetherInterfaceSMTest

Change-Id: I295d830dbdb11717d6e05161d97787ffe871beb3
2016-06-07 09:29:09 -07:00
Christopher Wiley
7b61d71760 Expand test coverage of TetherInterfaceSM
( cherry-pick of 1b3830a2afab565a38572ac5c3238a171b2d56d4 )

Add tests for most normal case operations:
  - State machine startup.
  - Entering a tethered state (as USB interface and not)
  - Handling the first notification of an upstream interface
  - Handle changes in upstream interface
  - Handle unrequested teardown correctly

Bug: 28833951
Test: These tests pass

Change-Id: I2c0c9141bab9eaa92faec8de10fa653fb6236a74
2016-06-07 09:28:41 -07:00
Christopher Wiley
1ff75bde48 Add demonstration unittest for TetherInterfaceSM
( cherry-pick of 1cc6ffd2b32846996520fdf43125da3ec2bbdf49 )

Prove that the concept works by writing a trivial test.

Bug: 28833951
Test: `runtest frameworks-services -c
  com.android.server.connectivity.tethering.TetherInterfaceSMTest`

Change-Id: I51911cef7f0d5165221845070befd085497c21a6
2016-06-07 09:28:13 -07:00
Makoto Onuki
ac042501c8 ShortcutManager: Implement usage report API
Bug 28536054

Change-Id: I293e8eaad523e3b0d76d562fc381601633451ed3
2016-06-02 15:57:40 -07:00
Makoto Onuki
51ab2b3fd0 ShortcutManager: Break down unit tests
The test file is getting too big and making the IDE very slow.
Now it's split into multiple files

Change-Id: I50ed89f19defd3809f327bc21e7d9ea790dcde4e
2016-06-02 14:00:34 -07:00
Makoto Onuki
7001a61540 ShortcutManager: Implement max # of shortcuts
- Each activity (launcher icon) can have at most 5 dynamic +
manifest shortcuts.

Bug 28536066

Change-Id: Id34371d51c4a1c5e3df7debe3b71b535eb157b6c
2016-06-02 10:47:37 -07:00