Merge "Implement StatusBar notification panel APIs for TV"
This commit is contained in:
committed by
Android (Google) Code Review
commit
ef342cf392
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user