Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f18b2a0 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Migrate ringtone picking out of MediaProvider.

Some OEMs have requested the ability to customize the ringtone
picker logic, and that's already supported by the existing
"config_defaultRingtonePickerEnabled" parameter today.

This change is a clean refactoring of the AOSP ringtone picker out
of MediaProvider and into a new "SoundPicker" module, which is
consistent with how some OEMs have already defined their own
"SoundPickerPrebuilt" module.

Bug: 134542205
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: Iadc60e731e6dcfce651f89bc7598e65541ab0ddf
parent 570926da
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
android_app {
    name: "SoundPicker",
    manifest: "AndroidManifest.xml",

    static_libs: [
        "androidx.appcompat_appcompat",
    ],
    resource_dirs: [
        "res",
    ],
    srcs: [
        "src/**/*.java",
    ],

    platform_apis: true,
    certificate: "media",
    privileged: true,
}
+33 −0
Original line number Diff line number Diff line
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.android.soundpicker"
        android:sharedUserId="android.media">

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.RECEIVE_DEVICE_CUSTOMIZATION_READY" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />

    <application
            android:allowBackup="false"
            android:supportsRtl="true">
        <receiver android:name="RingtoneReceiver">
            <intent-filter>
                <action android:name="android.intent.action.DEVICE_CUSTOMIZATION_READY"/>
            </intent-filter>
        </receiver>

        <service android:name="RingtoneOverlayService" />

        <activity android:name="RingtonePickerActivity"
                android:theme="@style/PickerDialogTheme"
                android:enabled="@*android:bool/config_defaultRingtonePickerEnabled"
                android:excludeFromRecents="true">
            <intent-filter>
                <action android:name="android.intent.action.RINGTONE_PICKER" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>
</manifest>
+24 −0
Original line number Diff line number Diff line
<!--
    Copyright (C) 2016 The Android Open Source Project

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24.0dp"
        android:height="24.0dp"
        android:viewportWidth="48.0"
        android:viewportHeight="48.0">
    <path
        android:fillColor="?android:attr/colorAccent"
        android:pathData="M38.0,26.0L26.0,26.0l0.0,12.0l-4.0,0.0L22.0,26.0L10.0,26.0l0.0,-4.0l12.0,0.0L22.0,10.0l4.0,0.0l0.0,12.0l12.0,0.0l0.0,4.0z"/>
</vector>
 No newline at end of file
+22 −0
Original line number Diff line number Diff line
<!--
    Copyright (C) 2017 The Android Open Source Project

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->

<inset xmlns:android="http://schemas.android.com/apk/res/android"
        android:drawable="@drawable/ic_add"
        android:insetTop="4dp"
        android:insetRight="4dp"
        android:insetBottom="4dp"
        android:insetLeft="4dp"/>
+35 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2017 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!--
     Currently, no file manager app on watch could handle ACTION_GET_CONTENT intent.
     Make the visibility to "gone" to prevent failures.
 -->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="?android:attr/listPreferredItemHeightSmall"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="@null"
        android:textColor="?android:attr/colorAccent"
        android:gravity="center_vertical"
        android:paddingStart="?android:attr/listPreferredItemPaddingStart"
        android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
        android:drawableStart="@drawable/ic_add_padded"
        android:drawablePadding="8dp"
        android:ellipsize="marquee"
        android:visibility="gone" />
Loading