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

Commit dc82879d authored by Robin Lee's avatar Robin Lee
Browse files

Implement StatusBar notification panel APIs for TV

Test: atest GtsIncidentManagerTestCases
Bug: 138173483
Change-Id: Ib22aaec8be5744e74c6eb2e58a5383c75f8cb58b
parent 5dd61a39
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);
        }
    }
}