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

Commit e6c9073d authored by Winson's avatar Winson
Browse files

Incorporating event bus to proxy recents events.

- Initial change to use the event bus by dispatching
  package events directly to the TaskStackViews instead
  of passing them down the view hierarchy manually.

Change-Id: Ic68df9eeefb79eab8ded84b74264a93719b40643
parent 9b316c12
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -13,3 +13,11 @@
-keep class com.android.systemui.statusbar.phone.PhoneStatusBar
-keep class com.android.systemui.statusbar.tv.TvStatusBar
-keep class com.android.systemui.recents.*

-keepclassmembers class ** {
    public void onBusEvent(**);
    public void onInterprocessBusEvent(**);
}
-keepclassmembers class ** extends **.EventBus$InterprocessEvent {
	public <init>(android.os.Bundle);
}
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -74,6 +74,8 @@ import java.util.ArrayList;
public class Recents extends SystemUI
        implements ActivityOptions.OnAnimationStartedListener, RecentsComponent {

    public final static int EVENT_BUS_PRIORITY = 1;

    final public static String EXTRA_TRIGGERED_FROM_ALT_TAB = "triggeredFromAltTab";
    final public static String EXTRA_TRIGGERED_FROM_HOME_KEY = "triggeredFromHomeKey";
    final public static String EXTRA_RECENTS_VISIBILITY = "recentsVisibility";
+7 −2
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.systemui.R;
import com.android.systemui.recents.misc.Console;
import com.android.systemui.recents.misc.ReferenceCountedTrigger;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.RecentsPackageMonitor;
import com.android.systemui.recents.model.RecentsTaskLoadPlan;
import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.recents.model.Task;
@@ -53,7 +54,10 @@ import java.util.ArrayList;
public class RecentsActivity extends Activity implements RecentsView.RecentsViewCallbacks,
        RecentsAppWidgetHost.RecentsAppWidgetHostCallbacks {

    public final static int EVENT_BUS_PRIORITY = Recents.EVENT_BUS_PRIORITY + 1;

    RecentsConfiguration mConfig;
    RecentsPackageMonitor mPackageMonitor;
    long mLastTabKeyEventTime;

    // Top level views
@@ -324,6 +328,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy();
        mConfig = RecentsConfiguration.initialize(this, ssp);
        mConfig.update(this, ssp, ssp.getWindowRect());
        mPackageMonitor = new RecentsPackageMonitor();

        // Initialize the widget host (the host id is static and does not change)
        mAppWidgetHost = new RecentsAppWidgetHost(this, Constants.Values.App.AppWidgetHostId);
@@ -371,7 +376,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        registerReceiver(mServiceBroadcastReceiver, filter);

        // Register any broadcast receivers for the task loader
        loader.registerReceivers(this, mRecentsView);
        mPackageMonitor.register(this);

        // Update the recent tasks
        updateRecentsTasks();
@@ -415,7 +420,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        unregisterReceiver(mServiceBroadcastReceiver);

        // Unregister any broadcast receivers for the task loader
        loader.unregisterReceivers();
        mPackageMonitor.unregister();

        // Workaround for b/22542869, if the RecentsActivity is started again, but without going
        // through SystemUI, we need to reset the config launch flags to ensure that we do not
+844 −0

File added.

Preview size limit exceeded, changes collapsed.

+39 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 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.recents.events.activity;

import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.model.RecentsPackageMonitor;
import com.android.systemui.recents.views.TaskStackView;

/**
 * This event is sent by {@link RecentsPackageMonitor} when a package on the the system changes.
 * {@link TaskStackView}s listen for this event, and remove the tasks associated with the removed
 * packages.
 */
public class PackagesChangedEvent extends EventBus.Event {

    public final RecentsPackageMonitor monitor;
    public final String packageName;
    public final int userId;

    public PackagesChangedEvent(RecentsPackageMonitor monitor, String packageName, int userId) {
        this.monitor = monitor;
        this.packageName = packageName;
        this.userId = userId;
    }
}
Loading