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

Commit 80362f24 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Revert "Partial Screen Sharing - Use new app chooser base class"" into udc-qpr-dev

parents 62e6b210 0ecc1064
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -87,6 +87,5 @@
        <permission name="android.permission.SET_UNRESTRICTED_KEEP_CLEAR_AREAS" />
        <permission name="android.permission.READ_SEARCH_INDEXABLES" />
        <permission name="android.permission.ACCESS_AMBIENT_CONTEXT_EVENT"/>
        <permission name="android.permission.QUERY_CLONED_APPS"/>
    </privapp-permissions>
</permissions>
+0 −2
Original line number Diff line number Diff line
@@ -200,7 +200,6 @@ android_library {
        "lottie",
        "LowLightDreamLib",
        "motion_tool_lib",
        "IntentResolver-core",
    ],
    manifest: "AndroidManifest.xml",

@@ -384,7 +383,6 @@ android_library {
        "motion_tool_lib",
        "androidx.core_core-animation-testing-nodeps",
        "androidx.compose.ui_ui",
        "IntentResolver-core",
    ],
}

+3 −3
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<com.android.intentresolver.widget.ResolverDrawerLayout
<com.android.internal.widget.ResolverDrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:layout_width="match_parent"
@@ -84,7 +84,7 @@
                android:id="@*android:id/tabcontent"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <com.android.intentresolver.ResolverViewPager
                <com.android.internal.app.ResolverViewPager
                    android:id="@*android:id/profile_pager"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"/>
@@ -92,4 +92,4 @@
        </LinearLayout>
    </TabHost>

</com.android.intentresolver.widget.ResolverDrawerLayout>
</com.android.internal.widget.ResolverDrawerLayout>
+41 −8
Original line number Diff line number Diff line
@@ -30,11 +30,16 @@ import android.os.IBinder
import android.os.ResultReceiver
import android.os.UserHandle
import android.view.ViewGroup
import com.android.intentresolver.AbstractMultiProfilePagerAdapter.EmptyStateProvider
import com.android.intentresolver.AbstractMultiProfilePagerAdapter.MyUserIdProvider
import com.android.intentresolver.ChooserActivity
import com.android.intentresolver.chooser.TargetInfo
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.app.AbstractMultiProfilePagerAdapter.EmptyStateProvider
import com.android.internal.app.AbstractMultiProfilePagerAdapter.MyUserIdProvider
import com.android.internal.app.ChooserActivity
import com.android.internal.app.ResolverListController
import com.android.internal.app.chooser.NotSelectableTargetInfo
import com.android.internal.app.chooser.TargetInfo
import com.android.systemui.R
import com.android.systemui.mediaprojection.appselector.MediaProjectionAppSelectorComponent
import com.android.systemui.mediaprojection.appselector.MediaProjectionAppSelectorController
@@ -51,8 +56,12 @@ class MediaProjectionAppSelectorActivity(
    private val activityLauncher: AsyncActivityLauncher,
    /** This is used to override the dependency in a screenshot test */
    @VisibleForTesting
    private val listControllerFactory: ((userHandle: UserHandle) -> ChooserListController)?
) : ChooserActivity(), MediaProjectionAppSelectorView, MediaProjectionAppSelectorResultHandler {
    private val listControllerFactory: ((userHandle: UserHandle) -> ResolverListController)?
) :
    ChooserActivity(),
    MediaProjectionAppSelectorView,
    MediaProjectionAppSelectorResultHandler,
    LifecycleOwner {

    @Inject
    constructor(
@@ -60,6 +69,8 @@ class MediaProjectionAppSelectorActivity(
        activityLauncher: AsyncActivityLauncher
    ) : this(componentFactory, activityLauncher, listControllerFactory = null)

    private val lifecycleRegistry = LifecycleRegistry(this)
    override val lifecycle = lifecycleRegistry
    private lateinit var configurationController: ConfigurationController
    private lateinit var controller: MediaProjectionAppSelectorController
    private lateinit var recentsViewController: MediaProjectionRecentsViewController
@@ -73,6 +84,7 @@ class MediaProjectionAppSelectorActivity(
    override fun getLayoutResource() = R.layout.media_projection_app_selector

    public override fun onCreate(bundle: Bundle?) {
        lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE)
        component = componentFactory.create(activity = this, view = this, resultHandler = this)
        component.lifecycleObservers.forEach { lifecycle.addObserver(it) }

@@ -95,6 +107,26 @@ class MediaProjectionAppSelectorActivity(
        controller.init()
    }

    override fun onStart() {
        super.onStart()
        lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_START)
    }

    override fun onResume() {
        super.onResume()
        lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_RESUME)
    }

    override fun onPause() {
        lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_PAUSE)
        super.onPause()
    }

    override fun onStop() {
        lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_STOP)
        super.onStop()
    }

    override fun onConfigurationChanged(newConfig: Configuration) {
        super.onConfigurationChanged(newConfig)
        configurationController.onConfigurationChanged(newConfig)
@@ -105,13 +137,13 @@ class MediaProjectionAppSelectorActivity(
    override fun createBlockerEmptyStateProvider(): EmptyStateProvider =
        component.emptyStateProvider

    override fun createListController(userHandle: UserHandle): ChooserListController =
    override fun createListController(userHandle: UserHandle): ResolverListController =
        listControllerFactory?.invoke(userHandle) ?: super.createListController(userHandle)

    override fun startSelected(which: Int, always: Boolean, filtered: Boolean) {
        val currentListAdapter = mChooserMultiProfilePagerAdapter.activeListAdapter
        val targetInfo = currentListAdapter.targetInfoForPosition(which, filtered) ?: return
        if (targetInfo.isNotSelectableTargetInfo) return
        if (targetInfo is NotSelectableTargetInfo) return

        val intent = createIntent(targetInfo)

@@ -151,6 +183,7 @@ class MediaProjectionAppSelectorActivity(
    }

    override fun onDestroy() {
        lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY)
        component.lifecycleObservers.forEach { lifecycle.removeObserver(it) }
        // onDestroy is also called when an app is selected, in that case we only want to send
        // RECORD_CONTENT_TASK but not RECORD_CANCEL
+3 −3
Original line number Diff line number Diff line
@@ -17,10 +17,10 @@ package com.android.systemui.mediaprojection.appselector

import android.content.Context
import android.os.UserHandle
import com.android.intentresolver.AbstractMultiProfilePagerAdapter.EmptyState
import com.android.intentresolver.AbstractMultiProfilePagerAdapter.EmptyStateProvider
import com.android.intentresolver.ResolverListAdapter
import com.android.internal.R as AndroidR
import com.android.internal.app.AbstractMultiProfilePagerAdapter.EmptyState
import com.android.internal.app.AbstractMultiProfilePagerAdapter.EmptyStateProvider
import com.android.internal.app.ResolverListAdapter
import com.android.systemui.R
import com.android.systemui.mediaprojection.devicepolicy.PersonalProfile
import com.android.systemui.mediaprojection.devicepolicy.ScreenCaptureDevicePolicyResolver