Commit Graph

336 Commits

Author SHA1 Message Date
Jean-Michel Trivi
16ab948c01 SeekBarVolumizer: fix media volume initialization for VolumeGroup
The VolumeGroup callback was initializing the sliders by querying
  the VolumeGroup API, which talks to APM. In AVCRP with a
  BT headset that supports absolute volume, the APM only sees the
  media volume at max, as no digital attenuation is applied then,
  which causes the VolumeGroup API to report max volume.
The fix consists in using the updateSlider() method instead, which
  will cause the volume query to go through AudioService (which
  maintains the actual volume setting independently of the digital
  attenuation that is applied).

Bug: 132287865
Test: connect BT headset with abs volume, go to Settings > Sound

Change-Id: I3d46af69d808169806c86cb543440f262097965b
2019-05-20 15:41:44 -07:00
Hayden Gomes
ebd6aaa4b0 Replacing AudioVolumeGroups with List
Bug: 129262395
Test: Built and ran on device
Change-Id: I838296ead584b85be50028c410b9a2d0ba3b0398
2019-04-11 17:07:19 -07:00
Hayden Gomes
3c562e2474 Cleaning up SeekBarVolumizer
Bug: 129265140
Test: Built with make and ran on device
Change-Id: Ifcd9a24cd768249f1b6ec5ad7e2361bcacfb9a4d
2019-04-11 16:56:34 -07:00
Hayden Gomes
6d69bde308 Replacing AudioProductStrategies with List
- Removed AudioProductStrategies and updated usages to work with
List<AudioProductStrategy>
- ditributed looping logic to the respective callers

Test: built successfully with make and ran on device
Bug: 129265140
Change-Id: If95ba9c2418a1fda29590ca1af2d04e7395c2130
2019-04-11 16:56:34 -07:00
François Gaffie
59f209da32 Use Volume Group core callback in volume preference rather than intent
In order to prevent misalignement between hard-coded stream aliases,
this CL allows to use the Volume Group cb to update the SeekBarVolume.

The ultimate step would be to remove stream aliases from audioserver.

Bug: 124767636
Test: dumpsys media.audio_policy
Change-Id: Ide99e9dd97669e880d0d253102533c72070012a1
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
2019-03-27 12:36:11 -07:00
TreeHugger Robot
91498b705c Merge "Revert "Disable preview on volume change" " 2019-03-26 18:19:26 +00:00
Beverly Tai
5808a8b30d Revert "Disable preview on volume change"
Fixes: 118534516
This reverts commit d7e9d35a44.

Reason for revert: Users can adjust volume from volume slice without preview sound, so re-enable preview sound in Settings > Sound 

Change-Id: I009d4a915a900e74bdcf14fb6dabad2e4a497a82
2019-03-26 14:14:05 +00:00
Andrei Onea
e30e3928f9 Add @UnsupportedAppUsage annotations
For packages:
  android.companion
  android.filterfw
  android.hardware.camera2.utils
  android.inputmethodservice
  android.net.nsd
  android.os
  android.preference
  android.security.keymaster
  android.service.dreams
  android.telecom
  android.telephony.ims.compat.feature
  android.telephony
  android.util
  android.view.accessibility
  android.media.effect

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: I9c2f8347952f3cc65759472b0e1a2717b285e44e
2019-03-21 14:04:57 +00:00
Siarhei Vishniakou
1e2c89087f Merge "Add Nullable annotation to getDecorView" am: a018254b45 am: b812cec859
am: 7f0cff2673

Change-Id: I7c607c47d057d08abf3c8dad30cf26a9dfba0caa
2019-03-13 09:49:57 -07:00
Siarhei Vishniakou
03887a9bed Merge "Add a null check for getWindow()" am: 3c69948e6a am: 71f52a6a0d
am: bee3e01c9b

Change-Id: Iee9698396354eb0e0cacff759cc0dcef621ff514
2019-03-08 06:13:49 -08:00
Siarhei Vishniakou
984d64d871 Add Nullable annotation to getDecorView
Since getDecorView may return null when dialog's window is no longer
present, annotate it as @Nullable.

Bug: 124327419
Test: none
Change-Id: I0d49b75b14f54cd8ba8304c900f6c8625f889aa8
2019-03-07 11:19:43 -08:00
Siarhei Vishniakou
d0de1cd170 Add a null check for getWindow()
Protect against crash surfaced by monkey, where it seems that the window
of the dialog is no longer present. If not present, don't need to post
dismiss runnable.

Bug: 124327419
Test: adb shell monkey -p com.google.android.GoogleCamera -s 999 -v 20000
Change-Id: Ic03b8501bb73725e04544fcb2397532be531988e
2019-03-06 11:07:22 -08:00
Jeff Sharkey
9e8f83db6d All Parcelable CREATOR fields are @NonNull.
If they were null, then the Parcelable would fail to work.

Bug: 126726802
Test: manual
Change-Id: I7929ffa2f20e5de1c8e68e8263cca99496e9d014
Exempt-From-Owner-Approval: Trivial API annotations
2019-02-28 23:29:04 -07:00
Beverly
1219670629 Users can change zen policy for system dnd rules
- Check consolidated zen policy in volume dialog, seek bar volumizer
and ZenModeControllerImpl instead of default notification policy
- Save ZenPolicy changes on restore

Test: atest ZenModeHelperTest
Test: atest ZenModeControllerImplTest
Bug: 111475013
Change-Id: I43b6dc8c6453739c50c874fe37415d425223d8c4
2018-12-21 10:57:54 -05:00
Xin Li
15b123ef45 DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into master
Bug: 120502534
Change-Id: Idc8bfb6d97a869b76cfb87ca1a494201baf9e8bd
2018-12-11 14:13:44 -08:00
Louis Pullen-Freilich
b9596fa128 Deprecates framework Preference classes
The AndroidX Preference Library is the recommended way to build settings
screens moving forward.

Bug: b/114357488
Test: n/a
Change-Id: I3b3bff2daf43d8239d8bf247a9c2acebbc6374eb
2018-11-19 18:58:44 +00:00
Mathew Inwood
45d2c252b1 Move some members to the "Q blacklist".
Based on some analysis, these fields/methods are likely false positives.
Set maxTargetSdk=P so that any apps using them are required to migrate off
them in future. See the bug for more details.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Merged-In: I719b5c94e5b1f4fa562dd5d655953422958ad37e
Change-Id: I719b5c94e5b1f4fa562dd5d655953422958ad37e
(cherry picked from commit 8c854f86a4)
2018-10-22 17:28:24 -07:00
Mathew Inwood
8c854f86a4 Move some members to the "Q blacklist".
Based on some analysis, these fields/methods are likely false positives.
Set maxTargetSdk=P so that any apps using them are required to migrate off
them in future. See the bug for more details.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: I719b5c94e5b1f4fa562dd5d655953422958ad37e
2018-09-14 13:18:34 +01:00
Julia Reynolds
d7e9d35a44 Disable preview on volume change
Test: manual
Change-Id: If6994c4f41f5c727b1589b14a6a6f89abb346f80
Fixes: 112169378
2018-09-07 17:35:19 +00:00
Andrew Zeng
2de4e50e94 Clarify constructor param in SeekBarVolumizer.
Bug: 78806021
Change-Id: Ice2c087976d0c34d85ef5c5c4660553a16502ba3
2018-08-22 01:24:22 +00:00
Siarhei Vishniakou
5692a8ba5f Dismiss Dialog in post instead of immediately
When ViewGroup is dispatching touch events to children, it can
happen that a child, upon receiving a touch event, may decide
to close the window. In this case, dispatchDetachedFromWindow will be
called, which would invalidate (=recycle) the TouchTargets. As the
ViewGroup would continue dispatching the event to other children, those
TouchTargets would already no longer be valid. This could cause an NPE.

In one particular example, there could be several views in a Dialog, and
one of the views would dismiss the Dialog in a click handler.
Since the click handler executes events immediately, this makes
ViewGroup.dispatchTouchEvent recurse on itself, and modify the internal
state. This would later cause the NPE.

Calling dismiss in a message avoids this issue by letting the event
handling finish before dispatching dispatchDetachedFromWindow, which
would cause another ACTION_CANCEL to be sent to the view.

Bug: 26611563
Test: created a sample app and recorded a sequence of touch events using
inputstudio in order to reproduce the crash. The repro rate was 100%.
Could no longer repro with this change.

Change-Id: Ia1d8070152c7ba2d14cddebcc5844994fe3ab5da
Merged-In: Ia1d8070152c7ba2d14cddebcc5844994fe3ab5da
2018-08-20 09:20:59 -07:00
TreeHugger Robot
87c94c5b19 Merge "Add option to not play sample in SeekBarVolumizer." 2018-08-20 11:30:38 +00:00
Mathew Inwood
eac8d0a362 Add @UnsupportedAppUsage annotations
For packages:
  android.preference

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: I6a39e2a1e1eb65cde9d200fb794c6592982f1272
Merged-In: I31a80552a66554d876edd01950df368c31239c2b
2018-08-17 13:51:26 +01:00
Mathew Inwood
f221713f87 Add @UnsupportedAppUsage annotations
For packages:
  android.preference

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: I31a80552a66554d876edd01950df368c31239c2b
2018-08-17 13:41:55 +01:00
Andrew Zeng
ca97fe0092 Add option to not play sample in SeekBarVolumizer.
Bug: 78806021
Change-Id: Ib4d760aa092c606bdc1340c18dead88d4b7ddaee
2018-08-16 16:09:48 -07:00
Joshua Baxter
1b745baa39 Merge "docs: fixed typo" into pi-dev am: d82da978c1
am: 5cf765bc71

Change-Id: I1c8d0f9cfb3016510108ead9925826df68572019
2018-08-13 16:49:58 -07:00
Andrew Zeng
f3df16c03a Use VOLUME_SETTINGS_INT instead of VOLUME_SETTINGS
The VOLUME_SETTINGS_INT contains more stream types, VOLUME_SETTINGS
also has the @removed tag.

Bug: 78806021
Change-Id: If01b3693e6507f1cd9c9f587b49f6a4e89a67439
2018-07-26 22:13:51 +00:00
Joshua Baxter
a9aa1be6c7 docs: fixed typo
Test: make ds-docs

Bug: 36944070
Change-Id: I47ee8cb59516495c9271308e1de84e0dc7265fb6
2018-06-04 13:25:13 -07:00
Aurimas Liutikas
7f6953369a Fix broken links in @see tags in framework docs.
doclava was accidentally suppressing all these broken links
in @see tags. This CL fixes issues so we can start enfocing
checks for broken @see links.

Test: make docs
Exempt-From-Owner-Approval: Fixing @see javadoc link issues that are currently completely broken
Change-Id: I767e9fb9842494e5eccef2a7bdeee3877c488b5d
2018-06-01 17:15:55 +00:00
Siarhei Vishniakou
c6442335be Dismiss Dialog in post instead of immediately
When ViewGroup is dispatching touch events to children, it can
happen that a child, upon receiving a touch event, may decide
to close the window. In this case, dispatchDetachedFromWindow will be
called, which would invalidate (=recycle) the TouchTargets. As the
ViewGroup would continue dispatching the event to other children, those
TouchTargets would already no longer be valid. This could cause an NPE.

In one particular example, there could be several views in a Dialog, and
one of the views would dismiss the Dialog in a click handler.
Since the click handler executes events immediately, this makes
ViewGroup.dispatchTouchEvent recurse on itself, and modify the internal
state. This would later cause the NPE.

Calling dismiss in a message avoids this issue by letting the event
handling finish before dispatching dispatchDetachedFromWindow, which
would cause another ACTION_CANCEL to be sent to the view.

Bug: 26611563
Test: created a sample app and recorded a sequence of touch events using
inputstudio in order to reproduce the crash. The repro rate was 100%.
Could no longer repro with this change.

Change-Id: Ia1d8070152c7ba2d14cddebcc5844994fe3ab5da
2018-04-04 14:22:13 -07:00
Beverly
d696476fb3 System sounds get its own dnd toggle
- Added logic for streams to be muted by dnd (unassociated with ringer)

Test: runtest -x frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java
Bug: 73362490
Change-Id: I1101e67282f7331497e91eb510d2bf4f1ea6b4b1
2018-03-06 09:08:29 -05:00
TreeHugger Robot
40ce09581d Merge "Add OWNERS for preferences" 2018-02-13 13:17:21 +00:00
Clara Bayarri
a137711868 Add OWNERS for preferences
Test: none
Change-Id: I1679ba3f10a89a4076888936aebf067c371bcf27
2018-02-13 11:28:02 +00:00
Beverly
925cde8f74 Alarms and Media visibly muted in PriorityOnly dnd
- if alarms and/or media cannot pass dnd and the phone is currently
in priority only dnd, then the alarm and/or media volume stream
will appear muted in the volume dialog and sound settings
(Settings > Sound)
- if all behavior for priority only dnd is not allowed to bypass dnd
(discluding alarms and media), then ringer is muted when priority-only
dnd mode is on. If a user clicks this ringer in the volume dialog, then
dnd ends
- Updated default zen config to version 3 (added alarms and media)
Test: manually toggle alarms + media in Settings > Sound > DND >
Behavior, toggle on/off dnd and then look at volume dialog and
volume bars in Settings > Sound
Test: runtest --path cts/tests/tests/media/src/android/media/cts/AudioManagerTest.java
Fixes: 72052742

Change-Id: Ia9e809ec2be93cb5a9ba6518dce04bf3ce45110b
2018-01-26 18:39:06 +00:00
Ian Lake
0a1feb8192 Deprecate framework Fragments and Loaders
Redirect developers to use the Support Library
versions of Fragments and Loaders to ensure that
they get consistent behavior across versions of
Android and all devices as well as access to
Lifecycle improvements.

Test: Confirmed APIs deprecated in current.txt
BUG: 68381801
Change-Id: I58ec599e557fc93c8547c45ba7c9ced96b0c8616
2017-11-13 10:55:59 -08:00
Jean-Michel Trivi
d51d398383 Fix alarm preview volume
SeekBarVolumizer: do not use FLAG_BYPASS_INTERRUPTION_POLICY as
 there is no need to bypass DnD modes in seek bar for volume
 since they are disabled according to the DnD mode.
AudioService (PlaybackActivityMonitor): check both
 AudioAttributes flags BYPASS_INTERRUPTION_POLICY and
 BYPASS_MUTE for forced alarm playback (see b/63617557).

Test: see bug
Bug: 67578783
Change-Id: Iaf43f16d96d1ad8a1eacc73a050db767004ba96b
2017-10-10 18:13:18 -07:00
Doris Ling
846234f399 Fix issue for Preference.setSingleLineTitle() has no effect.
The flag to check whether the single line title attribute is initialized
only when we processed the layout attributes. When the attribute is not
set in the layout, but set through the setter method, the flag is not
being updated properly, and hence the title view is not set correctly.
Need to update the flag as well when the setter method is called.

Bug: 62947301
Test: manual
Change-Id: If843663165a0f3348048aaf1d920f3b740af5bc3
2017-06-23 13:57:15 -07:00
Fan Zhang
c1caca1458 Set icon frame to invisible when iconSpaceReserved is set.
Bug: 37572025
Test: manual
Change-Id: I843bbf329a04964ddeccd17ed71e02f2264a5068
2017-04-24 10:05:12 -07:00
Doris Ling
ce58046673 Check if singleLineTitle attribute is set for the preference.
Only call setSingleLine() on the preference title if the attribute is
set.

Bug: 37328004
Test: manual
Change-Id: Ia95230cd08feaf8213cb5917c105d070eb30c11c
2017-04-14 14:04:32 -07:00
Doris Ling
9ed53e35ed Reserve space for preference icon.
Add an attribute to Preference to specify whether the space of the icon
view should be reserved when no preference icon is provided.

Bug: 36448695
Test: manual
Change-Id: I03b49fe93d54bb9106cf167a677a9ea544a3e3a1
2017-03-28 22:47:18 +00:00
Doris Ling
2cb4bab1a8 Allow multi line preference title.
Add an attribute to Preference to specify whether single line is to
be used for the preference

Change-Id: I578b496cdc4c5b0e3b3146183c6c30c4dee02eab
Fix: 36389770
Test: manual
2017-03-21 10:19:43 -07:00
TreeHugger Robot
3ee60614af Merge "Small cleanup or DataStore API javadoc." 2017-03-14 16:51:49 +00:00
Filip Pavlis
ee3bc34c3a Small cleanup or DataStore API javadoc.
There is also change in PreferenceManager.getSharedPreferences. The
original was not always returning null in case mPreferenceDataStore is
not null. That was contradictory with the java doc and conufing during
the runtime. Added tests for it.

Test: Separate CTS (2) being submitted along this one, see the topic.
Bug: b/34322039
Change-Id: I78a6758a674c3c8139bbe66ec17f2e29ca847828
2017-03-14 15:08:04 +00:00
Filip Pavlis
4186b344d8 Enable recycling of third party preference widgets
Until now we have been recycling only framework preference widgets since
there were no guarantees for third party preferences to support recycling.
This let to broken animations for preference widgets that are outside of
the framework.

This change makes recycling to be used always and in case the developers
need to turn it off they can explicitely use a new attribute that is
being added to the Preference called "recycleEnabled" and set it to false.

Bug: b/34334451
Test: Test are part of the same topic.

Change-Id: I324087841e1edddbf0d3eaad00b5895a196acff6
2017-03-10 19:19:47 +00:00
Filip Pavlis
e88fbbac12 Merge "Fix home/back buttons flow in PreferenceActivity." 2017-03-07 19:09:50 +00:00
Filip Pavlis
6af15ebcfe Fix home/back buttons flow in PreferenceActivity.
Bug: b/35977048
Test: Done manually. Automated test will be added later.

After recent changes in PreferenceActivity finishing the activity on
pressing back is not correct anymore. Instead onBackButton method should
be called to deal with it (we have fragments transactions for instance).

There can be multiple buttons:
1. The native default one - calls onBackPressed by default so no extra work
needed.
2. PreferenceActivity has buttons that can de displayed when settting
EXTRA_PREFS_SHOW_BUTTON_BAR to true. But it is a private API and I
didn't find any usage of it, so there is no need to change that. Also
it looks like something very specific used in WiFi wizards.
3. Apps often use a toolbar that has a home button which essentialy
emulates back button. The issue is that this Activity never had support
for this. So apps had to override onOptionsItemSelected and some of
those are unfortunately calling finish() which worked previously when
PreferenceActivity wasn't using fragments in single pane. This CL adds
support so app will no longer need to override that method and some
apps need to be instructed to use that override in O.

Change-Id: I94f557edb2e03f89fbf02e800beb390b2ad0544f
2017-03-07 19:05:57 +00:00
Filip Pavlis
0955793a45 Improve preferences for PreferenceDataStore.
I have done some important cleanup of java docs where it wasn't clear
enough that there is a PreferenceDataStore option.

I have fixed incorrect behavior when setting default value while data
store is assigned. Previsouly we looked into SharedPreferences which is
incorrect.

I have also changed behavior of methods getSharedPreferences and
getEditor. These methods now return null when custom data store is
assigned. The reason is that we definetly don't want to use
SharedPreferences if data store is assigned. So the original behavior
was a bit ambiguous. Also if we didn't enforce it, we would have
troubles to change that in the future.

Test: Tests are under the same topic.
Change-Id: Ib7303bae13648767c519edba74ef9a7143e703df
2017-03-03 18:20:01 +00:00
TreeHugger Robot
d1c7bb771c Merge "JavaDoc improvements as suggested by API council." 2017-03-02 16:38:56 +00:00
Filip Pavlis
fd59645ba7 JavaDoc improvements as suggested by API council.
Bug: b/35813554
Test: Not needed.
Change-Id: I009497bab66c9cc624f434f6d2dde0d80381d961
2017-03-02 14:26:58 +00:00
Jeff Sharkey
dd9bda81f6 Delete @removed APIs that never shipped.
These were never part of any public API level, so apps should never
have been using them.

Test: builds, boots
Bug: 31241513
Change-Id: I4fc8f5c325da56694a5db98acc995a22d4947805
2017-02-24 13:41:20 -07:00