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

Commit b91b8b84 authored by Chaohui Wang's avatar Chaohui Wang Committed by Android (Google) Code Review
Browse files

Merge "[Expressive design] Check system property" into main

parents 3be2c51f 0a868bd3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ val androidTop: String = File(rootDir, "../../../../..").canonicalPath

allprojects {
    extra["androidTop"] = androidTop
    extra["jetpackComposeVersion"] = "1.7.0-rc01"
    extra["jetpackComposeVersion"] = "1.7.0"
}

subprojects {
+2 −2
Original line number Diff line number Diff line
@@ -54,13 +54,13 @@ android {
dependencies {
    api(project(":SettingsLibColor"))
    api("androidx.appcompat:appcompat:1.7.0")
    api("androidx.compose.material3:material3:1.3.0-rc01")
    api("androidx.compose.material3:material3:1.3.0")
    api("androidx.compose.material:material-icons-extended:$jetpackComposeVersion")
    api("androidx.compose.runtime:runtime-livedata:$jetpackComposeVersion")
    api("androidx.compose.ui:ui-tooling-preview:$jetpackComposeVersion")
    api("androidx.lifecycle:lifecycle-livedata-ktx")
    api("androidx.lifecycle:lifecycle-runtime-compose")
    api("androidx.navigation:navigation-compose:2.8.0-rc01")
    api("androidx.navigation:navigation-compose:2.8.1")
    api("com.github.PhilJay:MPAndroidChart:v3.1.0-alpha")
    api("com.google.android.material:material:1.11.0")
    api("androidx.graphics:graphics-shapes-android:1.0.1")
+3 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import com.android.settingslib.spa.framework.util.SystemProperties

/**
 * The Material 3 Theme for Settings.
@@ -41,4 +42,5 @@ fun SettingsTheme(content: @Composable () -> Unit) {
    }
}

const val isSpaExpressiveEnabled = false
 No newline at end of file
val isSpaExpressiveEnabled
    by lazy { SystemProperties.getBoolean("is_expressive_design_enabled", false) }
+35 −0
Original line number Diff line number Diff line
/*
 * 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.
 */

package com.android.settingslib.spa.framework.util

import android.annotation.SuppressLint
import android.util.Log

@SuppressLint("PrivateApi")
object SystemProperties {
    private const val TAG = "SystemProperties"

    fun getBoolean(key: String, default: Boolean): Boolean = try {
        val systemProperties = Class.forName("android.os.SystemProperties")
        systemProperties
            .getMethod("getBoolean", String::class.java, Boolean::class.java)
            .invoke(systemProperties, key, default) as Boolean
    } catch (e: Exception) {
        Log.e(TAG, "getBoolean: $key", e)
        default
    }
}
+30 −0
Original line number Diff line number Diff line
/*
 * 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.
 */

package com.android.settingslib.spa.framework.util

import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class SystemPropertiesTest {

    @Test
    fun getBoolean_noCrash() {
        SystemProperties.getBoolean("is_expressive_design_enabled", false)
    }
}