Android tv 7.1添加自定义底部状态栏

添加定制按钮 音量加 音量减 截屏 隐藏

1. frameworks/base/packages/SystemUI/res/values/config.xml

space,capture,back;home;recent,volume_subtract,volume_add,hide,menu_ime

2.frameworks/base/packages/SystemUI/res/values/string.xml

    Capture
    VolumeSubtract
    VolumeAdd
    Hide

3.frameworks/base/packages/SystemUI/res/layout/custom_bar_hide.xml

    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:systemui="http://schemas.android.com/apk/res-auto"
    android:id="@+id/ff_bar_hide"
    android:layout_width="@dimen/navigation_key_width"
    android:layout_height="match_parent"
    android:layout_weight="0"
    android:src="@drawable/ic_sysbar_hide"
    android:scaleType="center"
    android:contentDescription="@string/accessibility_bar_hide"
    android:paddingStart="@dimen/navigation_key_padding"
    android:paddingEnd="@dimen/navigation_key_padding"

    />

4.frameworks/base/packages/SystemUI/res/layout/custom_capture.xml

    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:systemui="http://schemas.android.com/apk/res-auto"
    android:id="@+id/ff_capture"
    android:layout_width="@dimen/navigation_key_width"
    android:layout_height="match_parent"
    android:layout_weight="0"
    android:src="@drawable/ic_sysbar_screenshot"
    android:scaleType="center"
    android:contentDescription="@string/accessibility_capture"
    android:paddingStart="@dimen/navigation_key_padding"
    android:paddingEnd="@dimen/navigation_key_padding"

    />

5.frameworks/base/packages/SystemUI/res/layout/custom_volume_add.xml

    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:systemui="http://schemas.android.com/apk/res-auto"
    android:id="@+id/ff_volume_add"
    android:layout_width="@dimen/navigation_key_width"
    android:layout_height="match_parent"
    android:layout_weight="0"
    android:src="@drawable/add_normal"
    systemui:keyCode="24"
    android:scaleType="center"
    android:contentDescription="@string/accessibility_volume_add"
    android:paddingStart="@dimen/navigation_key_padding"
    android:paddingEnd="@dimen/navigation_key_padding"

    />

6.frameworks/base/packages/SystemUI/res/layout/custom_volume_subtract.xml

    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:systemui="http://schemas.android.com/apk/res-auto"
    android:id="@+id/ff_volume_subtract"
    android:layout_width="@dimen/navigation_key_width"
    android:layout_height="match_parent"
    android:layout_weight="0"
    android:src="@drawable/sub_normal"
    systemui:keyCode="25"
    android:scaleType="center"
    android:contentDescription="@string/accessibility_volume_subtract"
    android:paddingStart="@dimen/navigation_key_padding"
    android:paddingEnd="@dimen/navigation_key_padding"

    />

7.frameworks/base/packages/SystemUI/src/com/android/systemui/screenshot/TakeScreenshotService.java

--- a/packages/SystemUI/src/com/android/systemui/screenshot/TakeScreenshotService.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/TakeScreenshotService.java
@@ -67,6 +67,20 @@ public class TakeScreenshotService extends Service {
                 case WindowManager.TAKE_SCREENSHOT_SELECTED_REGION:
                     mScreenshot.takeScreenshotPartial(finisher, msg.arg1 > 0, msg.arg2 > 0);
                     break;
+               case 3:
+                    if (mScreenshot == null) {
+                        mScreenshot = new GlobalScreenshot(TakeScreenshotService.this);
+                    }
+                    mScreenshot.takeScreenshot(new Runnable() {
+                        @Override public void run() {
+                            Message reply = Message.obtain(null, 3);
+                            try {
+                                callback.send(reply);
+                            } catch (RemoteException e) {
+                            }
+                        }
+                    }, msg.arg1 > 0, msg.arg2 > 0);
+                   break;
             }
         }

     };

8.frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java

+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -77,6 +77,7 @@ public class CommandQueue extends IStatusBar.Stub {
     private static final int MSG_APP_TRANSITION_FINISHED       = 31 << MSG_SHIFT;
     private static final int MSG_DISMISS_KEYBOARD_SHORTCUTS    = 32 << MSG_SHIFT;
     private static final int MSG_HANDLE_SYSNAV_KEY             = 33 << MSG_SHIFT;
+    private static final int MSG_SHOW_NAVIGATIONBAR            = 34 << MSG_SHIFT;//add feifei


     public static final int FLAG_EXCLUDE_NONE = 0;
     public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
@@ -133,11 +134,20 @@ public class CommandQueue extends IStatusBar.Stub {
         void clickTile(ComponentName tile);


         void handleSystemNavigationKey(int arg1);
+       //add feifei
+       public void showNavigationBar();
     }


     public CommandQueue(Callbacks callbacks) {
         mCallbacks = callbacks;
     }
+    //add feifei
+    public void showNavigationBar(){
+        synchronized(mLock){
+            mHandler.removeMessages(MSG_SHOW_NAVIGATIONBAR);
+            mHandler.sendEmptyMessage(MSG_SHOW_NAVIGATIONBAR);
+        }
+    }


     public void setIcon(String slot, StatusBarIcon icon) {
         synchronized (mLock) {
@@ -453,6 +463,10 @@ public class CommandQueue extends IStatusBar.Stub {
                 case MSG_PRELOAD_RECENT_APPS:
                     mCallbacks.preloadRecentApps();
                     break;
+               case MSG_SHOW_NAVIGATIONBAR:
+                   //add feifei
+                   mCallbacks.showNavigationBar();
+                   break;

                 case MSG_CANCEL_PRELOAD_RECENT_APPS:

9. frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java

+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java
@@ -37,6 +37,7 @@ import com.android.systemui.tuner.TunerService;
 import static android.view.WindowManager.DOCKED_INVALID;
 import static android.view.WindowManager.DOCKED_LEFT;
 import static android.view.WindowManager.DOCKED_TOP;
+import com.android.systemui.statusbar.BaseStatusBar;


 /**
  * Class to detect gestures on the navigation bar.
@@ -79,6 +80,9 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL
     private boolean mDockWindowTouchSlopExceeded;
     private int mDragMode;


+    //add feifei
+    private BaseStatusBar mBar;
+
     public NavigationBarGestureHelper(Context context) {
         mContext = context;
         ViewConfiguration configuration = ViewConfiguration.get(context);
@@ -101,6 +105,10 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL
         mIsRTL = isRTL;
     }


+    public void setBar(BaseStatusBar phoneStatusBar) {
+        mBar = phoneStatusBar;
+    }
+
     public boolean onInterceptTouchEvent(MotionEvent event) {
         // If we move more than a fixed amount, then start capturing for the
         // task switcher detector
@@ -292,8 +300,10 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL
             }
             if (showNext) {
                 mRecentsComponent.showNextAffiliatedTask();
+               mBar.showNextAffiliatedTask();
             } else {
                 mRecentsComponent.showPrevAffiliatedTask();
+               mBar.showPreviousAffiliatedTask();
             }
         }

         return true;

10. frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java

diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java b/packages/SystemUI/src/
index 59d12ea..e45b789 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
@@ -34,6 +34,7 @@ import com.android.systemui.statusbar.policy.KeyButtonView;
 import com.android.systemui.tuner.TunerService;


 import java.util.Objects;
+import android.util.Log;


 public class NavigationBarInflaterView extends FrameLayout implements TunerService.Tunable {


@@ -47,6 +48,10 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
     public static final String RECENT = "recent";
     public static final String NAVSPACE = "space";
     public static final String CLIPBOARD = "clipboard";
+    public static final String VOLUME_ADD = "volume_add";
+    public static final String VOLUME_SUBTRACT = "volume_subtract";
+    public static final String CAPTURE = "capture";
+    public static final String HIDE = "hide";
     public static final String KEY = "key";


     public static final String GRAVITY_SEPARATOR = ";";
@@ -247,10 +252,19 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
         LayoutInflater inflater = landscape ? mLandscapeInflater : mLayoutInflater;
         float size = extractSize(buttonSpec);
         String button = extractButton(buttonSpec);
+       Log.d(TAG,"create------create"+button);
         View v = null;
         if (HOME.equals(button)) {
             v = inflater.inflate(R.layout.home, parent, false);
-        } else if (BACK.equals(button)) {
+        } else if (CAPTURE.equals(button)) {
+           v = inflater.inflate(R.layout.custom_capture, parent, false);
+       } else if (HIDE.equals(button)) {
+           v = inflater.inflate(R.layout.custom_bar_hide, parent, false);
+       } else if (VOLUME_ADD.equals(button)) {
+           v = inflater.inflate(R.layout.custom_volume_add, parent, false);
+       } else if (VOLUME_SUBTRACT.equals(button)) {
+           v = inflater.inflate(R.layout.custom_volume_subtract, parent, false);
+       } else if (BACK.equals(button)) {
             v = inflater.inflate(R.layout.back, parent, false);

         } else if (RECENT.equals(button)) {

11frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java

--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -86,6 +86,8 @@ public class NavigationBarView extends LinearLayout {
     private DeadZone mDeadZone;
     private final NavigationBarTransitions mBarTransitions;


+    private Drawable mVolumeDown,mVolumeUp,mCapture,mHide;
+
     // workaround for LayoutTransitions leaving the nav buttons in a weird state (bug 5549288)
     final static boolean WORKAROUND_INVALID_LAYOUT = true;
     final static int MSG_CHECK_INVALID_LAYOUT = 8686;
@@ -198,18 +200,26 @@ public class NavigationBarView extends LinearLayout {
         updateIcons(context, Configuration.EMPTY, mConfiguration);


         mBarTransitions = new NavigationBarTransitions(this);
-
+//samjiang loged
         mButtonDisatchers.put(R.id.back, new ButtonDispatcher(R.id.back));
         mButtonDisatchers.put(R.id.home, new ButtonDispatcher(R.id.home));
         mButtonDisatchers.put(R.id.recent_apps, new ButtonDispatcher(R.id.recent_apps));
         mButtonDisatchers.put(R.id.menu, new ButtonDispatcher(R.id.menu));
         mButtonDisatchers.put(R.id.ime_switcher, new ButtonDispatcher(R.id.ime_switcher));
+       mButtonDisatchers.put(R.id.ff_capture, new ButtonDispatcher(R.id.ff_capture));
+       mButtonDisatchers.put(R.id.ff_volume_subtract, new ButtonDispatcher(R.id.ff_volume_subtract));
+       mButtonDisatchers.put(R.id.ff_volume_add, new ButtonDispatcher(R.id.ff_volume_add));
+       mButtonDisatchers.put(R.id.ff_bar_hide, new ButtonDispatcher(R.id.ff_bar_hide));
     }


     public BarTransitions getBarTransitions() {
         return mBarTransitions;
     }


+    public void setBar(PhoneStatusBar phoneStatusBar) {
+        mGestureHelper.setBar(phoneStatusBar);
+    }
+
     public void setComponents(RecentsComponent recentsComponent, Divider divider) {
         mGestureHelper.setComponents(recentsComponent, divider, this);
     }
@@ -265,10 +275,26 @@ public class NavigationBarView extends LinearLayout {
         return mButtonDisatchers.get(R.id.home);
     }


+    public ButtonDispatcher getVolumeAdd() {
+       return mButtonDisatchers.get(R.id.ff_volume_add);
+    }
+
+    public ButtonDispatcher getVolumeSubtract() {
+       return mButtonDisatchers.get(R.id.ff_volume_subtract);
+    }
+
     public ButtonDispatcher getImeSwitchButton() {
         return mButtonDisatchers.get(R.id.ime_switcher);
     }


+    public ButtonDispatcher getCapture() {
+       return mButtonDisatchers.get(R.id.ff_capture);
+    }
+
+    public ButtonDispatcher getHide() {
+       return mButtonDisatchers.get(R.id.ff_bar_hide);
+    }
+
     private void updateCarModeIcons(Context ctx) {
         mBackCarModeIcon = ctx.getDrawable(R.drawable.ic_sysbar_back_carmode);
         mBackLandCarModeIcon = mBackCarModeIcon;
@@ -281,6 +307,10 @@ public class NavigationBarView extends LinearLayout {
         if (oldConfig.orientation != newConfig.orientation
                 || oldConfig.densityDpi != newConfig.densityDpi) {
             mDockedIcon = ctx.getDrawable(R.drawable.ic_sysbar_docked);
+           mVolumeDown = ctx.getDrawable(R.drawable.sub_normal);
+            mVolumeUp = ctx.getDrawable(R.drawable.add_normal);
+            mCapture = ctx.getDrawable(R.drawable.ic_sysbar_screenshot);
+            mHide = ctx.getDrawable(R.drawable.ic_sysbar_hide);
         }
         if (oldConfig.densityDpi != newConfig.densityDpi) {
             mBackIcon = ctx.getDrawable(R.drawable.ic_sysbar_back);
@@ -293,6 +323,10 @@ public class NavigationBarView extends LinearLayout {
             mMenuIcon = ctx.getDrawable(R.drawable.ic_sysbar_menu);
             mImeIcon = ctx.getDrawable(R.drawable.ic_ime_switcher_default);


+           mVolumeDown = ctx.getDrawable(R.drawable.sub_normal);
+           mVolumeUp = ctx.getDrawable(R.drawable.add_normal);
+           mCapture = ctx.getDrawable(R.drawable.ic_sysbar_screenshot);
+           mHide = ctx.getDrawable(R.drawable.ic_sysbar_hide);
             if (ALTERNATE_CAR_MODE_UI) {
                 updateCarModeIcons(ctx);
             }
@@ -350,7 +384,10 @@ public class NavigationBarView extends LinearLayout {
                 : getBackIcon(mUseCarModeUi, mVertical);


         getBackButton().setImageDrawable(backIcon);
-
+       getVolumeSubtract().setImageDrawable(mVolumeDown);
+       getVolumeAdd().setImageDrawable(mVolumeUp);
+       getCapture().setImageDrawable(mCapture);
+       getHide().setImageDrawable(mHide);
         updateRecentsIcon();


         if (mUseCarModeUi) {
@@ -406,6 +443,10 @@ public class NavigationBarView extends LinearLayout {
         getBackButton().setVisibility(disableBack      ? View.INVISIBLE : View.VISIBLE);
         getHomeButton().setVisibility(disableHome      ? View.INVISIBLE : View.VISIBLE);
         getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
+       getVolumeSubtract().setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
+       getVolumeAdd().setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
+       getCapture().setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
+       getHide().setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
     }


     private boolean inLockTask() {

12. frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -211,6 +211,9 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;


+import android.content.ServiceConnection;
+import android.os.Messenger;
+import android.content.SharedPreferences;
 public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
         DragDownHelper.DragDownCallback, ActivityStarter, OnUnlockMethodChangedListener,
         OnHeadsUpChangedListener, VisualStabilityManager.Callback {
@@ -350,6 +353,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
     private PointF mWakeUpTouchLocation;
     private boolean mScreenTurningOn;


+    private SharedPreferences custom_sp;
     int mPixelFormat;
     Object mQueueLock = new Object();


@@ -690,8 +694,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                 = (MediaSessionManager) mContext.getSystemService(Context.MEDIA_SESSION_SERVICE);
         // TODO: use MediaSessionManager.SessionListener to hook us up to future updates
         // in session state
-
-        addNavigationBar();
+       addNavigationBar();
+       custom_sp = mContext.getSharedPreferences("feifei_index", Context.MODE_PRIVATE);
+       if (custom_sp.getInt("index",0)==1) {
+           removeNavigationBar();
+       }
+       Log.d(TAG,"index--------index"+custom_sp.getInt("index",0));


         // Lastly, call to the icon policy to install/update all the icons.
         mIconPolicy = new PhoneStatusBarPolicy(mContext, mIconController, mCastController,
@@ -1143,6 +1151,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
     }


     protected void createNavigationBarView(Context context) {
+       Log.d(TAG,"createNavigationBarView---------------createNavigationBarView");
         inflateNavigationBarView(context);
         mNavigationBarView.setDisabledFlags(mDisabled1);
         mNavigationBarView.setComponents(mRecents, getComponent(Divider.class));
@@ -1261,6 +1270,29 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
         }
     }


+    @Override
+    public void showNavigationBar() {
+       custom_sp.edit().putInt("index",0).commit();
+       Log.d(TAG,"showNavigationBar---------------showNavigationBar");
+        if (mNavigationBarView != null) {
+           return;
+        }
+        mNavigationBarView = (NavigationBarView) View.inflate(mContext, R.layout.navigation_bar, null);
+        mNavigationBarView.setBar(this);
+        mNavigationBarView.setOnTouchListener(new
+             View.OnTouchListener() {
+                 @Override
+                 public boolean onTouch(View v, MotionEvent event) {
+                     checkUserAutohide(v, event);
+                     return false;
+                 }
+            }
+        );
+        addNavigationBar();
+       mStatusBarWindow.setVisibility(View.VISIBLE);
+       //Log.d("PhoneStatus!!!","addNaviGationBar!!!!!!!!");
+    }
+
     protected void startKeyguard() {
         Trace.beginSection("PhoneStatusBar#startKeyguard");
         KeyguardViewMediator keyguardViewMediator = getComponent(KeyguardViewMediator.class);
@@ -1330,6 +1362,93 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
         }
     };


+    private View.OnClickListener mCaptureClickListener = new View.OnClickListener() {
+        @Override
+        public void onClick(View v) {
+            takeScreenshot();
+        }
+    };
+    final Object mScreenshotLock = new Object();
+    ServiceConnection mScreenshotConnection = null;
+    final Runnable mScreenshotTimeout = new Runnable() {
+        @Override public void run() {
+            synchronized (mScreenshotLock) {
+                if (mScreenshotConnection != null) {
+                    mContext.unbindService(mScreenshotConnection);
+                    mScreenshotConnection = null;
+                }
+            }
+        }
+    };
+    private void takeScreenshot() {
+        synchronized (mScreenshotLock) {
+            if (mScreenshotConnection != null) {
+                return;
+            }
+            ComponentName cn = new ComponentName("com.android.systemui",
+                    "com.android.systemui.screenshot.TakeScreenshotService");
+            Intent intent = new Intent();
+            intent.setComponent(cn);
+            ServiceConnection conn = new ServiceConnection() {
+                @Override
+                public void onServiceConnected(ComponentName name, IBinder service) {
+                    synchronized (mScreenshotLock) {
+                        if (mScreenshotConnection != this) {
+                            return;
+                        }
+                        Messenger messenger = new Messenger(service);
+                        Message msg = Message.obtain(null, 1);
+                        final ServiceConnection myConn = this;
+                        Handler h = new Handler(mHandler.getLooper()) {
+                            @Override
+                            public void handleMessage(Message msg) {
+                                synchronized (mScreenshotLock) {
+                                    if (mScreenshotConnection == myConn) {
+                                        mContext.unbindService(mScreenshotConnection);
+                                        mScreenshotConnection = null;
+                                        mHandler.removeCallbacks(mScreenshotTimeout);
+                                    }
+                                }
+                            }
+                        };
+                        msg.replyTo = new Messenger(h);
+                        msg.arg1 = msg.arg2 = 0;
+                        msg.arg1 = 3;
+                        try {
+                            messenger.send(msg);
+                        } catch (RemoteException e) {
+                        }
+                    }
+                }
+               @Override
+                public void onServiceDisconnected(ComponentName name) {}
+            };
+            if (mContext.bindService(intent, conn, Context.BIND_AUTO_CREATE)) {
+                mScreenshotConnection = conn;
+                mHandler.postDelayed(mScreenshotTimeout, 10000);
+            }
+        }
+    }
+
+
+    private View.OnClickListener mHideClickListener = new View.OnClickListener() {
+        @Override
+        public void onClick(View v) {
+           removeNavigationBar();
+          custom_sp.edit().putInt("index",1).commit();
+        }
+    };
+
+    private void removeNavigationBar(){
+        if (DEBUG) Log.d(TAG, "removeNavigationBar: about to remove " + mNavigationBarView);
+        if ( mNavigationBarView != null) {
+            mWindowManager.removeView(mNavigationBarView);
+           mNavigationBarView = null;
+           mStatusBarWindow.setVisibility(View.GONE);
+        }
+                //Log.d("PhoneStatusBar================","removeNavigationBar+++++");
+    }
+
     @Override
     protected void toggleSplitScreenMode(int metricsDockAction, int metricsUndockAction) {
         if (mRecents == null) {
@@ -1424,11 +1543,18 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
         homeButton.setOnTouchListener(mHomeActionListener);
         homeButton.setOnLongClickListener(mLongPressHomeListener);


+       ButtonDispatcher capButton = mNavigationBarView.getCapture();
+       capButton.setOnClickListener(mCaptureClickListener);
+
+       ButtonDispatcher hideButton = mNavigationBarView.getHide();
+       hideButton.setOnClickListener(mHideClickListener);
+
         mAssistManager.onConfigurationChanged();
     }


     // For small-screen devices (read: phones) that lack hardware navigation buttons
     protected void addNavigationBar() {
+       Log.d(TAG,"addNavigationBar-------------------addNavigationBar");
         if (DEBUG) Log.v(TAG, "addNavigationBar: about to add " + mNavigationBarView);
         if (mNavigationBarView == null) return;


@@ -1460,9 +1586,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,


     protected void repositionNavigationBar() {
         if (mNavigationBarView == null || !mNavigationBarView.isAttachedToWindow()) return;
-
-        prepareNavigationBarView();
-
+       prepareNavigationBarView();
         mWindowManager.updateViewLayout(mNavigationBarView, mNavigationBarView.getLayoutParams());
     }


@@ -3469,6 +3593,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
         mRemoteInputController = new RemoteInputController(mStatusBarWindowManager,
                 mHeadsUpManager);
         mStatusBarWindowManager.add(mStatusBarWindow, getStatusBarHeight());
+       //mStatusBarWindow.setVisibility(View.GONE);
     }


     // called by makeStatusbar and also by PhoneStatusBarView

13. frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java

--- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
@@ -169,6 +169,11 @@ public class TvStatusBar extends BaseStatusBar {
     public void appTransitionStarting(long startTime, long duration) {
     }


+    //add feifei
+    @Override
+    public void showNavigationBar(){
+    }
+
     @Override
     public void appTransitionFinished() {

     }

14. frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java

                     public void onSwipeFromBottom() {
                         if (mNavigationBar != null && mNavigationBarPosition == NAV_BAR_BOTTOM) {
                             requestTransientBars(mNavigationBar);
-                        }
+                        }else {
+                           showNavigationBar();
+                           mShowNaBar = true;
+                           System.out.println("Display-----------hide");
+                       }

                     }

+    private void showNavigationBar(){
+             mHandler.post(new Runnable(){
+                 @Override
+                 public void run(){
+                     try{
+                         IStatusBarService statusbar=getStatusBarService();
+                         if(null!=statusbar){
+                             statusbar.showNavigationBar();
+                         //Log.d("PhoneWindowManager!!!!!!","showNavigationBar-----------------------");
+                         }
+                     }catch(Exception  e){
+                         mStatusBarService =null;
+                     }
+                 }
+             });

+         }

15. frameworks/base/services/core/java/com/android/server/statusbar/StatusBarManagerService.java

     @Override
+    public void showNavigationBar() {
+        enforceStatusBar();
+        synchronized(mLock) {
+            mHandler.post(new Runnable() {
+                public void run() {
+                    if(null!=mBar) {
+                        try {
+                            mBar.showNavigationBar();
+                        } catch (RemoteException ex) {
+
+                        }
+                    }
+                }
+            });
+        }

+    }


16. frameworks/base/core/java/com/android/internal/statusbar/IStatusBarService.aidl

+    void showNavigationBar();

17. frameworks/base/core/java/com/android/internal/statusbar/IStatusBar.aidl

+    void showNavigationBar();

你可能感兴趣的:(android开发)