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

Commit da807724 authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

Extracting ViewCapture into common Library

The ViewCapture functionality is extracted into a common Library accessible to the Launcher and SystemUi modules. I have changed a few things:
1. protobuf-nano is used instead of protobuf-lite mainly due to compatibility problems. The main difference is, that protobuf-nano does not have Builders. Therefore all Builders from the old ViewCapture.java class are replaced with constructors and direct field writes.
2. To avoid copying the Launcher internal MainThreadInitializedObject, the main thread initialization of ViewCapture is now implemented within the getInstance() function.
3. Context is not passed to the constructor anymore but only to the functions that depend on it as a parameter.
4. Added getDumpTask function.

Test: None
Change-Id: I1fdd73e17b4967bd71aed400bf39f7706c498d6d
parent 331da01d
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
*.iml
.project
.classpath
.project.properties
gen/
bin/
.idea/
.gradle/
local.properties
gradle/
build/
gradlew*
.DS_Store
+48 −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 {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

java_library {
    name: "view_capture_proto",
    srcs: ["src/com/android/app/viewcapture/proto/*.proto"],
    proto: {
        type: "nano",
        local_include_dirs:[
            "src/com/android/app/viewcapture/proto"
        ],
    },
    static_libs: ["libprotobuf-java-nano"],
    java_version: "1.8",
}

android_library {
    name: "view_capture",
    manifest: "AndroidManifest.xml",
    platform_apis: true,
    min_sdk_version: "26",

    static_libs: [
        "androidx.core_core",
        "view_capture_proto",
    ],

    srcs: [
        "src/**/*.java",
        "src/**/*.kt"
    ],
}
+20 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     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.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.app.viewcapture">
</manifest>

viewcapturelib/OWNERS

0 → 100644
+2 −0
Original line number Diff line number Diff line
sunnygoyal@google.com
andonian@google.com
+51 −0
Original line number Diff line number Diff line
plugins {
    id 'com.android.library'
    id 'org.jetbrains.kotlin.android'
    id 'com.google.protobuf'
}

final String PROTOS_DIR = "${ANDROID_TOP}/frameworks/libs/systemui/viewcapturelib/src/com/android/app/viewcapture/proto"

android {
    compileSdk TARGET_SDK.toInteger()
    buildToolsVersion = BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion TARGET_SDK.toInteger()
        targetSdkVersion TARGET_SDK.toInteger()
    }

    sourceSets {
        main {
            java.srcDirs = ['src']
            manifest.srcFile 'AndroidManifest.xml'
            proto.srcDirs = ["${PROTOS_DIR}"]
        }
    }

    lintOptions {
        abortOnError false
    }
}

dependencies {
    implementation "androidx.core:core:1.9.0"
    implementation PROTOBUF_DEPENDENCY
}

protobuf {
    // Configure the protoc executable
    protoc {
        artifact = "com.google.protobuf:protoc:3.0.0${PROTO_ARCH_SUFFIX}"
        generateProtoTasks {
            all().each { task ->
                task.builtins {
                    remove java
                    javanano {
                        option "enum_style=c"
                    }
                }
            }
        }
    }
}
Loading