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

Commit e95044ad authored by Anna Bauza's avatar Anna Bauza
Browse files

Refactor SettingsLib to remove redundant resources conditionally

Bug: 320878675
Test: manual
Change-Id: I77b3eb4cc2edbbfa6788e53004e370d49da0c0c0
parent c79b5379
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ android_library {
    name: "SettingsLib",
    defaults: [
        "SettingsLintDefaults",
        "SettingsLibAvatarPickerDefaults",
    ],

    static_libs: [
@@ -109,3 +110,32 @@ java_aconfig_library {
    name: "settingslib_flags_lib",
    aconfig_declarations: "settingslib_flags",
}

soong_config_module_type {
    name: "avatar_picker_java_defaults",
    module_type: "java_defaults",
    config_namespace: "SettingsLib",
    bool_variables: [
        "legacy_avatar_picker_app_enabled",
    ],
    properties: [
        "static_libs",
        "manifest",
    ],
}

soong_config_bool_variable {
    name: "legacy_avatar_picker_app_enabled",
}

avatar_picker_java_defaults {
    name: "SettingsLibAvatarPickerDefaults",
    soong_config_variables: {
        // If flag is enabled, add the library
        legacy_avatar_picker_app_enabled: {
            static_libs: [
                "SettingsLibAvatarPicker",
            ],
        },
    },
}
+0 −3
Original line number Diff line number Diff line
@@ -21,9 +21,6 @@
    <uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />

    <application>
        <activity
            android:name="com.android.settingslib.users.AvatarPickerActivity"
            android:theme="@style/SudThemeGlifV2.DayNight"/>
    </application>

</manifest>
+31 −0
Original line number Diff line number Diff line
package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "frameworks_base_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["frameworks_base_license"],
}

android_library {
    name: "SettingsLibAvatarPicker",
    manifest: "AndroidManifest.xml",
    use_resource_processor: true,
    platform_apis: true,

    defaults: [
        "SettingsLintDefaults",
    ],

    static_libs: [
        "SettingsLibSettingsTheme",
        "setupdesign",
        "guava",
    ],

    resource_dirs: ["res"],
    srcs: [
        "src/**/*.java",
        "src/**/*.kt",
    ],
}
+32 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2024 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.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.android.settingslib.avatarpicker">

    <uses-sdk android:minSdkVersion="23" />
    <application>
        <activity
            android:name=".AvatarPickerActivity"
            android:theme="@style/SudThemeGlifV2.DayNight"
            android:exported="true">
            <intent-filter>
                <action android:name="com.android.avatarpicker.FULL_SCREEN_ACTIVITY" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>
</manifest>
+30 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2022 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.
    Copyright (C) 2024 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.
  -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
@@ -22,9 +22,9 @@
        </shape>
    </item>
    <item
        android:bottom="@dimen/avatar_picker_icon_inset"
        android:drawable="@drawable/ic_avatar_choose_photo"
        android:left="@dimen/avatar_picker_icon_inset"
        android:right="@dimen/avatar_picker_icon_inset"
        android:top="@dimen/avatar_picker_icon_inset"
        android:bottom="@dimen/avatar_picker_icon_inset"
        android:drawable="@drawable/ic_avatar_choose_photo"/>
        android:top="@dimen/avatar_picker_icon_inset" />
</layer-list>
Loading