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

Commit 289747ce authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Refactoring several TaskView callbacks."

parents f66560d6 2536c7ed
Loading
Loading
Loading
Loading
+33 −5
Original line number Diff line number Diff line
@@ -19,15 +19,18 @@ package com.android.systemui.recents;
import android.app.Activity;
import android.app.ActivityOptions;
import android.app.SearchManager;
import android.app.TaskStackBuilder;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewStub;
@@ -35,6 +38,9 @@ import com.android.internal.logging.MetricsLogger;
import com.android.systemui.R;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.AppWidgetProviderChangedEvent;
import com.android.systemui.recents.events.ui.DismissTaskEvent;
import com.android.systemui.recents.events.ui.ResizeTaskEvent;
import com.android.systemui.recents.events.ui.ShowApplicationInfoEvent;
import com.android.systemui.recents.misc.Console;
import com.android.systemui.recents.misc.ReferenceCountedTrigger;
import com.android.systemui.recents.misc.SystemServicesProxy;
@@ -536,11 +542,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        return mResizeTaskDebugDialog;
    }

    @Override
    public void onTaskResize(Task t) {
        getResizeTaskDebugDialog().showResizeTaskDialog(t, mRecentsView);
    }

    /**** RecentsView.RecentsViewCallbacks Implementation ****/

    @Override
@@ -584,6 +585,33 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        refreshSearchWidgetView();
    }

    public final void onBusEvent(ShowApplicationInfoEvent event) {
        // Create a new task stack with the application info details activity
        Intent baseIntent = event.task.key.baseIntent;
        Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
                Uri.fromParts("package", baseIntent.getComponent().getPackageName(), null));
        intent.setComponent(intent.resolveActivity(getPackageManager()));
        TaskStackBuilder.create(this)
                .addNextIntentWithParentStack(intent).startActivities(null,
                new UserHandle(event.task.key.userId));

        // Keep track of app-info invocations
        MetricsLogger.count(this, "overview_app_info", 1);
    }

    public final void onBusEvent(DismissTaskEvent event) {
        // Remove any stored data from the loader
        RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
        loader.deleteTaskData(event.task, false);

        // Remove the task from activity manager
        loader.getSystemServicesProxy().removeTask(event.task.key.id);
    }

    public final void onBusEvent(ResizeTaskEvent event) {
        getResizeTaskDebugDialog().showResizeTaskDialog(event.task, mRecentsView);
    }

    private void refreshSearchWidgetView() {
        if (mSearchWidgetInfo != null) {
            SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy();
+1 −1
Original line number Diff line number Diff line
@@ -635,7 +635,7 @@ public class EventBus extends BroadcastReceiver {

        // Find all the valid event bus handler methods of the subscriber
        MutableBoolean isInterprocessEvent = new MutableBoolean(false);
        Method[] methods = subscriberType.getMethods();
        Method[] methods = subscriberType.getDeclaredMethods();
        for (Method m : methods) {
            Class<?>[] parameterTypes = m.getParameterTypes();
            isInterprocessEvent.value = false;
+35 −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.ui;

import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.views.TaskView;

/**
 * This is sent when a {@link TaskView} has been dismissed.
 */
public class DismissTaskEvent extends EventBus.Event {

    public final Task task;
    public final TaskView taskView;

    public DismissTaskEvent(Task task, TaskView taskView) {
        this.task = task;
        this.taskView = taskView;
    }
}
+32 −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.ui;

import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.model.Task;

/**
 * This is sent when a {@link Task} is resized.
 */
public class ResizeTaskEvent extends EventBus.Event {

    public final Task task;

    public ResizeTaskEvent(Task task) {
        this.task = task;
    }
}
+32 −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.ui;

import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.model.Task;

/**
 * This is sent when a user wants to show the application info for a {@link Task}.
 */
public class ShowApplicationInfoEvent extends EventBus.Event {

    public final Task task;

    public ShowApplicationInfoEvent(Task task) {
        this.task = task;
    }
}
Loading