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

Commit 2bdda8f7 authored by Shivangi Dubey's avatar Shivangi Dubey
Browse files

Move RotationPolicyWrapper to SystemUI's rotation pod

Move RotationPolicyWrapper to SystemUI's rotation pod, so that it could be reused in Launcher for better testability.
This CL has no behaviour change, but just a package change.

Bug: 430756509
Flag: EXEMPT Refactor only
Test: No behaviour change, flash and check if device boots and rotation works as per usual
Change-Id: I6a38ae2ee2cb39592c4f4f763579411bb7dad17f
parent 9eb93cbb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ import com.android.systemui.statusbar.policy.RotationLockControllerImpl;
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.settings.FakeSettings;
import com.android.systemui.util.time.FakeSystemClock;
import com.android.systemui.util.wrapper.RotationPolicyWrapper;
import com.android.systemui.rotation.RotationPolicyWrapper;

import org.junit.After;
import org.junit.Before;
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import com.android.internal.view.RotationPolicy;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.time.FakeSystemClock;
import com.android.systemui.util.wrapper.RotationPolicyWrapper;
import com.android.systemui.rotation.RotationPolicyWrapper;

import org.junit.Before;
import org.junit.Test;
+2 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ java_library {
        "com.android.systemui.log.table-api",
        "com.android.systemui.retail.data-api",
        "com.android.systemui.retail.domain-api",
        "com.android.systemui.rotation-api",
        "com.android.systemui.statusbar.pipeline.airplane.data.repository-api",
        "com.android.systemui.statusbar.pipeline.airplane.shared-api",
        "com.android.systemui.util.kotlin",
@@ -88,6 +89,7 @@ java_library {
    static_libs: [
        "com.android.systemui.pods-api-aosp-handheld",
        "com.android.systemui.retail-impl",
        "com.android.systemui.rotation-impl",
        "com.android.systemui.statusbar.pipeline.airplane.data.repository-impl",
        "com.android.systemui.statusbar.pipeline.airplane.shared-impl",
        "com.android.systemui.util.time-impl",
+50 −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: ["frameworks_base_packages_SystemUI_license"],
}

java_library {
    name: "com.android.systemui.rotation-api",
    srcs: [
        "*.java",
        "*.kt",
    ],
    defaults: [
        "SystemUI_pod_defaults_api",
    ],
}

java_library {
    name: "com.android.systemui.rotation-impl",
    srcs: [
        "impl/*.java",
        "impl/*.kt",
    ],
    libs: [
        "com.android.systemui.dagger-api",
        "dagger2",
    ],
    static_libs: [
        "//frameworks/libs/systemui:tracinglib-platform",
        "com.android.systemui.rotation-api",
        "com.android.systemui.util.settings-api",
    ],
    defaults: [
        "SystemUI_pod_defaults_impl",
    ],
}
+35 −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.systemui.rotation

import com.android.internal.view.RotationPolicy
import com.android.internal.view.RotationPolicy.RotationPolicyListener

/**
 * Testable wrapper interface around RotationPolicy {link com.android.internal.view.RotationPolicy}
 */
public interface RotationPolicyWrapper {
    public fun setRotationLock(enabled: Boolean, caller: String)
    public fun setRotationLockAtAngle(enabled: Boolean, rotation: Int, caller: String)
    public fun setRotationAtAngleIfAllowed(rotation: Int, caller: String)
    public fun getRotationLockOrientation(): Int
    public fun isRotationLockToggleVisible(): Boolean
    public fun isRotationLocked(): Boolean
    public fun isCameraRotationEnabled(): Boolean
    public fun registerRotationPolicyListener(listener: RotationPolicyListener, userHandle: Int)
    public fun unregisterRotationPolicyListener(listener: RotationPolicyListener)
}
 No newline at end of file
Loading