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

Commit 4e5beac4 authored by Zekan Qian's avatar Zekan Qian
Browse files

Add SpaEnvironmentFactory

To support different config for different Settings App.
Set SpaEnvironment instance in application.onCreate
Get SpaEnvironment instance from SpaEnvironmentFactory, rather than pass through parameter.

Bug: 244122804
Test: manual - build Gallery & Settings
Change-Id: I15600a085c1b7c63d37399e85aa8c71659cccc4e
parent a52eb3af
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -18,12 +18,13 @@
    package="com.android.settingslib.spa.gallery">

    <application
        android:name=".GalleryApplication"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_label"
        android:supportsRtl="true"
        android:enableOnBackInvokedCallback="true">
        <activity
            android:name=".MainActivity"
            android:name=".GalleryMainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
+27 −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.
 */

package com.android.settingslib.spa.gallery

import android.app.Application
import com.android.settingslib.spa.framework.common.SpaEnvironmentFactory

class GalleryApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        SpaEnvironmentFactory.instance = GallerySpaEnvironment
    }
}
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -18,4 +18,4 @@ package com.android.settingslib.spa.gallery

import com.android.settingslib.spa.framework.DebugActivity

class GalleryDebugActivity : DebugActivity(GallerySpaEnvironment)
class GalleryDebugActivity : DebugActivity()
+1 −1
Original line number Diff line number Diff line
@@ -18,4 +18,4 @@ package com.android.settingslib.spa.gallery

import com.android.settingslib.spa.framework.EntryProvider

class GalleryEntryProvider : EntryProvider(GallerySpaEnvironment)
class GalleryEntryProvider : EntryProvider()
+1 −1
Original line number Diff line number Diff line
@@ -18,4 +18,4 @@ package com.android.settingslib.spa.gallery

import com.android.settingslib.spa.framework.BrowseActivity

class MainActivity : BrowseActivity(GallerySpaEnvironment)
class GalleryMainActivity : BrowseActivity()
Loading