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

Commit a2737b13 authored by Michal Brzezinski's avatar Michal Brzezinski Committed by Michał Brzeziński
Browse files

Extracting classes from touchpad package and introducing activity for OOBE

Moving generic parts of tutorial to inputdevice.tutorial package
Moving keyboard part of tutorial to inputdevce.tutorial package (maybe should be moved to keyboard later?)
To avoid introducing touchpad dependency for all sysui variants, touchpad screens are injected as optional.

Also to make sure all dependencies work I added KeyboardTouchpadTutorialActivity (no UI for now) with KeyboardTouchpadTutorialViewModel - which is just copy of TouchpadTutorialViewModel (well, with optional dependency)  and will be modified a lot anyway so let’s not focus there too much.

Bug: 358105049
Flag: com.android.systemui.shared.new_touchpad_gestures_tutorial
Test: code compiles and KeyboardTouchpadTutorialActivity can be launched
Change-Id: Iabc9a785989ef704cf5f3cc075f69a290dc6fedc
parent 66f164b9
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -479,6 +479,15 @@
            android:noHistory="true" />

        <activity android:name=".touchpad.tutorial.ui.view.TouchpadTutorialActivity"
            android:exported="true"
            android:theme="@style/Theme.AppCompat.NoActionBar">
            <intent-filter>
                <action android:name="com.android.systemui.action.TOUCHPAD_TUTORIAL"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>

        <activity android:name=".inputdevice.tutorial.ui.view.KeyboardTouchpadTutorialActivity"
            android:exported="true"
            android:theme="@style/Theme.AppCompat.NoActionBar">
            <intent-filter>
+4 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import com.android.systemui.display.ui.viewmodel.ConnectingDisplayViewModel;
import com.android.systemui.dock.DockManager;
import com.android.systemui.dock.DockManagerImpl;
import com.android.systemui.doze.DozeHost;
import com.android.systemui.inputdevice.tutorial.KeyboardTouchpadTutorialModule;
import com.android.systemui.keyboard.shortcut.ShortcutHelperModule;
import com.android.systemui.keyguard.ui.composable.blueprint.DefaultBlueprintModule;
import com.android.systemui.keyguard.ui.view.layout.blueprints.KeyguardBlueprintModule;
@@ -77,7 +78,7 @@ import com.android.systemui.statusbar.policy.IndividualSensorPrivacyControllerIm
import com.android.systemui.statusbar.policy.SensorPrivacyController;
import com.android.systemui.statusbar.policy.SensorPrivacyControllerImpl;
import com.android.systemui.toast.ToastModule;
import com.android.systemui.touchpad.tutorial.TouchpadKeyboardTutorialModule;
import com.android.systemui.touchpad.tutorial.TouchpadTutorialModule;
import com.android.systemui.unfold.SysUIUnfoldStartableModule;
import com.android.systemui.unfold.UnfoldTransitionModule;
import com.android.systemui.util.kotlin.SysUICoroutinesModule;
@@ -122,6 +123,7 @@ import javax.inject.Named;
        KeyboardShortcutsModule.class,
        KeyguardBlueprintModule.class,
        KeyguardSectionsModule.class,
        KeyboardTouchpadTutorialModule.class,
        MediaModule.class,
        MediaMuteAwaitConnectionCli.StartableModule.class,
        MultiUserUtilsModule.class,
@@ -142,7 +144,7 @@ import javax.inject.Named;
        SysUIUnfoldStartableModule.class,
        UnfoldTransitionModule.Startables.class,
        ToastModule.class,
        TouchpadKeyboardTutorialModule.class,
        TouchpadTutorialModule.class,
        VolumeModule.class,
        WallpaperModule.class,
        ShortcutHelperModule.class,
+0 −7
Original line number Diff line number Diff line
@@ -256,13 +256,6 @@ abstract class SystemUICoreStartableModule {
    @ClassKey(StylusUsiPowerStartable::class)
    abstract fun bindStylusUsiPowerStartable(sysui: StylusUsiPowerStartable): CoreStartable

    @Binds
    @IntoMap
    @ClassKey(KeyboardTouchpadTutorialCoreStartable::class)
    abstract fun bindKeyboardTouchpadTutorialCoreStartable(
        listener: KeyboardTouchpadTutorialCoreStartable
    ): CoreStartable

    @Binds
    @IntoMap
    @ClassKey(PhysicalKeyboardCoreStartable::class)
+50 −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.systemui.inputdevice.tutorial

import android.app.Activity
import com.android.systemui.CoreStartable
import com.android.systemui.inputdevice.tutorial.ui.view.KeyboardTouchpadTutorialActivity
import com.android.systemui.touchpad.tutorial.domain.interactor.TouchpadGesturesInteractor
import dagger.Binds
import dagger.BindsOptionalOf
import dagger.Module
import dagger.multibindings.ClassKey
import dagger.multibindings.IntoMap

@Module
interface KeyboardTouchpadTutorialModule {

    @Binds
    @IntoMap
    @ClassKey(KeyboardTouchpadTutorialCoreStartable::class)
    fun bindKeyboardTouchpadTutorialCoreStartable(
        listener: KeyboardTouchpadTutorialCoreStartable
    ): CoreStartable

    @Binds
    @IntoMap
    @ClassKey(KeyboardTouchpadTutorialActivity::class)
    fun activity(impl: KeyboardTouchpadTutorialActivity): Activity

    // TouchpadModule dependencies below
    // all should be optional to not introduce touchpad dependency in all sysui variants

    @BindsOptionalOf fun touchpadScreensProvider(): TouchpadTutorialScreensProvider

    @BindsOptionalOf fun touchpadGesturesInteractor(): TouchpadGesturesInteractor
}
+6 −13
Original line number Diff line number Diff line
@@ -14,20 +14,13 @@
 * limitations under the License.
 */

package com.android.systemui.touchpad.tutorial
package com.android.systemui.inputdevice.tutorial

import android.app.Activity
import com.android.systemui.touchpad.tutorial.ui.view.TouchpadTutorialActivity
import dagger.Binds
import dagger.Module
import dagger.multibindings.ClassKey
import dagger.multibindings.IntoMap
import androidx.compose.runtime.Composable

@Module
interface TouchpadKeyboardTutorialModule {
interface TouchpadTutorialScreensProvider {

    @Binds
    @IntoMap
    @ClassKey(TouchpadTutorialActivity::class)
    fun activity(impl: TouchpadTutorialActivity): Activity
    @Composable fun BackGesture(onDoneButtonClicked: () -> Unit, onBack: () -> Unit)

    @Composable fun HomeGesture(onDoneButtonClicked: () -> Unit, onBack: () -> Unit)
}
Loading