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

Commit ef342cf3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Implement StatusBar notification panel APIs for TV"

parents f786c7fa dc82879d
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -17,8 +17,12 @@
package com.android.systemui.statusbar.tv;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;

import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.SystemUI;
@@ -40,6 +44,9 @@ import javax.inject.Singleton;
@Singleton
public class TvStatusBar extends SystemUI implements CommandQueue.Callbacks {

    private static final String ACTION_OPEN_TV_NOTIFICATIONS_PANEL =
            "com.android.tv.action.OPEN_NOTIFICATIONS_PANEL";

    private final CommandQueue mCommandQueue;

    @Inject
@@ -61,4 +68,23 @@ public class TvStatusBar extends SystemUI implements CommandQueue.Callbacks {

        new AudioRecordingDisclosureBar(mContext).start();
    }

    @Override
    public void animateExpandNotificationsPanel() {
        startSystemActivity(new Intent(ACTION_OPEN_TV_NOTIFICATIONS_PANEL));
    }

    @Override
    public void animateCollapsePanels(int flags, boolean force) {
        startSystemActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME));
    }

    private void startSystemActivity(Intent intent) {
        PackageManager pm = mContext.getPackageManager();
        ResolveInfo ri = pm.resolveActivity(intent, PackageManager.MATCH_SYSTEM_ONLY);
        if (ri != null && ri.activityInfo != null) {
            intent.setPackage(ri.activityInfo.packageName);
            mContext.startActivityAsUser(intent, UserHandle.CURRENT);
        }
    }
}