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

Commit 4692793e authored by Yein Jo's avatar Yein Jo
Browse files

Separate out the render logic from WeatherEffects

We only need the rendering part of the WeatherEffects, thus the package
`graphics` is pulled out as a module. Made some changes so that the
`graphics` package does not depend on Torus.

Test: m WeatherEffectDebug, m WeatherEffectGraphicsLib, gradle
Bug: 290939683
Change-Id: Id1e716ab2c2cdabc7338c9f342493cea2f830ac2
parent 6bf95c50
Loading
Loading
Loading
Loading
+32 −32
Original line number Diff line number Diff line
@@ -16,47 +16,26 @@ package {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

// The weather effects library only contains rendering logic.
android_library {
    name: "WeatherEffectsLib",
    manifest: "AndroidManifest.xml",
    name: "WeatherEffectsGraphicsLib",
    sdk_version: "system_current",
    // min_sdk version must be specified to not compile against platform apis.
    // Using HardwareBufferRenderer requires minimum of 34.
    min_sdk_version: "34",
    static_libs: [
        "androidx.slice_slice-core",
        "androidx.slice_slice-builders",
        "dagger2",
        "jsr330", // Dagger inject annotations.
        "kotlinx_coroutines_android",
        "kotlinx_coroutines",
        "androidx.core_core-ktx",
        // Do not add Torus dependency here, since this package is only for rendering. The host app
        // will include Torus or Livewallpaper frameworks.
        "androidx.appcompat_appcompat",
        "androidx-constraintlayout_constraintlayout",
        "toruslib",
    ],
    srcs: [
        "src/**/*.java",
        "src/**/*.kt",
        // TODO(b/300991599): Split out debug source.
        "debug/src/**/*.java",
        "debug/src/**/*.kt"
    ],
    resource_dirs: [
        "res",
        // TODO(b/300991599): Split out debug resources.
        "debug/res"
    ],
    // TODO(b/300991599): Split out debug resources.
    asset_dirs: [
        "debug/assets"
        "graphics/src/**/*.java",
        "graphics/src/**/*.kt",
    ],
    javacflags: ["-Adagger.fastInit=enabled"],
    kotlincflags: ["-Xjvm-default=all"],
    plugins: ["dagger2-compiler"],
    dxflags: ["--multi-dex"],
    // This library is meant to access only public APIs, do not flip this flag to true.
    platform_apis: false
}

// Debug app.
@@ -64,11 +43,33 @@ android_app {
    name: "WeatherEffectsDebug",
    manifest: "debug/AndroidManifest.xml",
    owner: "google",
    privileged: false,
    sdk_version: "system_current",
    min_sdk_version: "34",
    srcs: [
        "src/**/*.java",
        "src/**/*.kt",
        "debug/src/**/*.java",
        "debug/src/**/*.kt",
    ],
    resource_dirs: [
        "res",
        "debug/res",
    ],
    asset_dirs: [
        "debug/assets",
    ],
    static_libs: [
        "WeatherEffectsLib"
        "androidx.slice_slice-core",
        "androidx.slice_slice-builders",
        "dagger2",
        "jsr330", // Dagger inject annotations.
        "kotlinx_coroutines_android",
        "kotlinx_coroutines",
        "androidx.core_core-ktx",
        "androidx.appcompat_appcompat",
        "androidx-constraintlayout_constraintlayout",
        "toruslib",
        "WeatherEffectsGraphicsLib",
    ],
    use_embedded_native_libs: true,
    plugins: ["dagger2-compiler"],
@@ -90,13 +91,12 @@ android_test {
        "tests/src/**/*.kt",
    ],
    static_libs: [
        "WeatherEffectsLib",
        "WeatherEffectsGraphicsLib",
        "androidx.test.rules",
        "androidx.test.ext.junit",
        "androidx.test.core",
        "androidx.test.runner",
        "kotlinx_coroutines_test",
        "truth"
        "truth",
    ],
}
+0 −34
Original line number Diff line number Diff line
@@ -16,38 +16,4 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.android.wallpaper.weathereffects">

    <!--TODO: Add privileged permission-->

    <uses-feature
        android:name="android.software.live_wallpaper"
        android:required="true" />

    <queries>
        <package android:name="com.google.android.apps.wallpaper" />
        <package android:name="com.android.wallpaper" />
    </queries>

    <application
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name">
        <provider
            android:name="com.google.android.wallpaper.weathereffects.provider.WeatherEffectsContentProvider"
            android:authorities="${applicationId}.effectprovider"
            android:exported="true" />
        <service android:name="com.google.android.wallpaper.weathereffects.WeatherWallpaperService"
            android:directBootAware="true"
            android:exported="true"
            android:label="@string/app_name"
            android:permission="android.permission.BIND_WALLPAPER">
            <intent-filter>
                <action android:name="android.service.wallpaper.WallpaperService" />
            </intent-filter>

            <meta-data
                android:name="android.service.wallpaper"
                android:resource="@xml/weather_wallpaper" />
        </service>

    </application>
</manifest>
+1 −0
Original line number Diff line number Diff line
@@ -128,6 +128,7 @@ android {

dependencies {
    implementation project(':toruslib')
    implementation project(':graphics')

    implementation "androidx.slice:slice-builders:$versions.androidXLib"
    implementation "androidx.slice:slice-core:$versions.androidXLib"
+28 −2
Original line number Diff line number Diff line
@@ -15,13 +15,39 @@
     limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.google.android.wallpaper.weathereffects">
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />

    <uses-feature
        android:name="android.software.live_wallpaper"
        android:required="true" />

    <queries>
        <package android:name="com.google.android.apps.wallpaper" />
        <package android:name="com.android.wallpaper" />
    </queries>

    <application
        android:name=".WallpaperEffectsDebugApplication"
        tools:replace="android:name">
        android:icon="@mipmap/ic_launcher">
        <provider
            android:name="com.google.android.wallpaper.weathereffects.provider.WeatherEffectsContentProvider"
            android:authorities="${applicationId}.effectprovider"
            android:exported="true" />
        <service android:name="com.google.android.wallpaper.weathereffects.WeatherWallpaperService"
            android:directBootAware="true"
            android:exported="true"
            android:label="@string/app_name"
            android:permission="android.permission.BIND_WALLPAPER">
            <intent-filter>
                <action android:name="android.service.wallpaper.WallpaperService" />
            </intent-filter>

            <meta-data
                android:name="android.service.wallpaper"
                android:resource="@xml/weather_wallpaper" />
        </service>

        <activity
            android:name=".WallpaperEffectsDebugActivity"
            android:configChanges="uiMode"
+50 −0
Original line number Diff line number Diff line
plugins {
    id 'com.android.library'
    id 'org.jetbrains.kotlin.android'
}

android {
    namespace 'com.google.android.wallpaper.weathereffects.graphics'
    compileSdk 34

    defaultConfig {
        minSdk 34

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles "consumer-rules.pro"
    }

    sourceSets {
        main {
            java.srcDirs = ["${rootDir}/graphics/src"]
        }
    }

    buildTypes {
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            testCoverageEnabled true
        }

        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            testCoverageEnabled true
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = '17'
    }
}

dependencies {
    implementation 'androidx.core:core-ktx:1.12.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.11.0'
}
 No newline at end of file
Loading