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

Commit e7560c62 authored by Nicolo' Mazzucato's avatar Nicolo' Mazzucato
Browse files

Create skeleton for DisplayLib

This lib will contain all SysUI utilities used for supporting multiple displays best practices.

Bug: 362719719
Bug: 401305290
Test: DisplayRepositoryTest.kt
Flag: NONE - creating new lib skeleton, not using it anywhere
Change-Id: Ie0fb41a45e66a0bdc0584557dd56424bba5439ed
parent cf3ea899
Loading
Loading
Loading
Loading

displaylib/Android.bp

0 → 100644
+29 −0
Original line number Diff line number Diff line
// Copyright (C) 2025 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 {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

java_library {
    name: "displaylib",
    manifest: "AndroidManifest.xml",
    static_libs: [
        "kotlinx_coroutines_android",
        "dagger2",
        "jsr330",
    ],
    plugins: ["dagger2-compiler"],
    srcs: ["src/**/*.kt"],
}
+20 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright 2025 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.app.displaylib">
</manifest>

displaylib/README.MD

0 → 100644
+4 −0
Original line number Diff line number Diff line
# displaylib

This library contains utilities that make the management of multiple displays easier, more
performant and elegant.
 No newline at end of file
+7 −0
Original line number Diff line number Diff line
{
  "presubmit": [
    {
      "name": "displaylib_tests"
    }
  ]
}
+54 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.app.displaylib

import dagger.Binds
import dagger.Component
import dagger.Module
import javax.inject.Singleton

/**
 * Component that creates all classes in displaylib.
 *
 * Each user of this library will bind the required element in the factory constructor. It's advised
 * to use this component through [createDisplayLibComponent], which wraps the dagger generated
 * method.
 */
@Component(modules = [DisplayLibModule::class])
@Singleton
interface DisplayLibComponent {

    @Component.Factory
    interface Factory {
        fun create(): DisplayLibComponent
    }

    val displayRepository: DisplayRepository
}

@Module
interface DisplayLibModule {
    @Binds fun bindDisplayManagerImpl(impl: DisplayRepositoryImpl): DisplayRepository
}

/**
 * Just a wrapper to make the generated code to create the component more explicit.
 *
 * This should be called only once per process.
 */
fun createDisplayLibComponent(): DisplayLibComponent {
    return DaggerDisplayLibComponent.factory().create()
}
Loading