1acad183238ad13774dba38c403ed553c2427027eChristopher Tate/*
2acad183238ad13774dba38c403ed553c2427027eChristopher Tate * Copyright (C) 2012 The Android Open Source Project
3acad183238ad13774dba38c403ed553c2427027eChristopher Tate *
4acad183238ad13774dba38c403ed553c2427027eChristopher Tate * Licensed under the Apache License, Version 2.0 (the "License");
5acad183238ad13774dba38c403ed553c2427027eChristopher Tate * you may not use this file except in compliance with the License.
6acad183238ad13774dba38c403ed553c2427027eChristopher Tate * You may obtain a copy of the License at
7acad183238ad13774dba38c403ed553c2427027eChristopher Tate *
8acad183238ad13774dba38c403ed553c2427027eChristopher Tate *      http://www.apache.org/licenses/LICENSE-2.0
9acad183238ad13774dba38c403ed553c2427027eChristopher Tate *
10acad183238ad13774dba38c403ed553c2427027eChristopher Tate * Unless required by applicable law or agreed to in writing, software
11acad183238ad13774dba38c403ed553c2427027eChristopher Tate * distributed under the License is distributed on an "AS IS" BASIS,
12acad183238ad13774dba38c403ed553c2427027eChristopher Tate * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13acad183238ad13774dba38c403ed553c2427027eChristopher Tate * See the License for the specific language governing permissions and
14acad183238ad13774dba38c403ed553c2427027eChristopher Tate * limitations under the License.
15acad183238ad13774dba38c403ed553c2427027eChristopher Tate */
16acad183238ad13774dba38c403ed553c2427027eChristopher Tate
17acad183238ad13774dba38c403ed553c2427027eChristopher Tatepackage com.android.systemui.statusbar.tv;
18acad183238ad13774dba38c403ed553c2427027eChristopher Tate
192a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monkimport android.content.Context;
2086905582411c5c77a3e7641589cf206c6e5770f5Jorim Jaggiimport android.graphics.Rect;
21acad183238ad13774dba38c403ed553c2427027eChristopher Tateimport android.os.IBinder;
222a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monkimport android.os.RemoteException;
232a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monkimport android.os.ServiceManager;
24acad183238ad13774dba38c403ed553c2427027eChristopher Tate
252a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monkimport com.android.internal.statusbar.IStatusBarService;
26de84f0e77ea2bf713d15c290264059a413c2486aJohn Spurlockimport com.android.internal.statusbar.StatusBarIcon;
272a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monkimport com.android.systemui.SystemUI;
28bf8c2c0f99e70514a37da85b1f31d91964daa0c4Winsonimport com.android.systemui.pip.tv.PipManager;
292a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monkimport com.android.systemui.statusbar.CommandQueue;
302a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monkimport com.android.systemui.statusbar.CommandQueue.Callbacks;
312a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk
322a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monkimport java.util.ArrayList;
33de84f0e77ea2bf713d15c290264059a413c2486aJohn Spurlock
3467ed54a724df258738062e60d7f702f396502b49Sid Soundararajan/**
35acad183238ad13774dba38c403ed553c2427027eChristopher Tate * Status bar implementation for "large screen" products that mostly present no on-screen nav
36acad183238ad13774dba38c403ed553c2427027eChristopher Tate */
37acad183238ad13774dba38c403ed553c2427027eChristopher Tate
382a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monkpublic class TvStatusBar extends SystemUI implements Callbacks {
392a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk
402a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk    private IStatusBarService mBarService;
41acad183238ad13774dba38c403ed553c2427027eChristopher Tate
42acad183238ad13774dba38c403ed553c2427027eChristopher Tate    @Override
4367ed54a724df258738062e60d7f702f396502b49Sid Soundararajan    public void start() {
4467ed54a724df258738062e60d7f702f396502b49Sid Soundararajan        putComponent(TvStatusBar.class, this);
452a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk        CommandQueue commandQueue = getComponent(CommandQueue.class);
462a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk        commandQueue.addCallbacks(this);
472a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk        int[] switches = new int[9];
482a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk        ArrayList<IBinder> binders = new ArrayList<>();
492a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk        ArrayList<String> iconSlots = new ArrayList<>();
502a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk        ArrayList<StatusBarIcon> icons = new ArrayList<>();
512a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk        Rect fullscreenStackBounds = new Rect();
522a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk        Rect dockedStackBounds = new Rect();
532a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk        mBarService = IStatusBarService.Stub.asInterface(
542a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk                ServiceManager.getService(Context.STATUS_BAR_SERVICE));
552a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk        try {
562a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk            mBarService.registerStatusBar(commandQueue, iconSlots, icons, switches, binders,
572a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk                    fullscreenStackBounds, dockedStackBounds);
582a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk        } catch (RemoteException ex) {
592a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk            // If the system process isn't there we're doomed anyway.
602a6ea9c2a1b52b0386270ec73e1e6d6a9b614a34Jason Monk        }
6167ed54a724df258738062e60d7f702f396502b49Sid Soundararajan    }
6267ed54a724df258738062e60d7f702f396502b49Sid Soundararajan
63acad183238ad13774dba38c403ed553c2427027eChristopher Tate}
64