Merge "Hide navigation bar on Keyguard."
This commit is contained in:
34
packages/SystemUI/res/layout/keyguard_bottom_area.xml
Normal file
34
packages/SystemUI/res/layout/keyguard_bottom_area.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2014 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License
|
||||
-->
|
||||
|
||||
<com.android.systemui.statusbar.phone.KeyguardBottomAreaView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
||||
android:id="@+id/keyguard_bottom_area"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
>
|
||||
<com.android.systemui.statusbar.policy.KeyButtonView
|
||||
android:id="@+id/camera_button"
|
||||
android:layout_height="80dp"
|
||||
android:layout_width="80dp"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:src="@drawable/ic_sysbar_camera"
|
||||
android:scaleType="center"
|
||||
android:contentDescription="@string/accessibility_camera_button"
|
||||
systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
|
||||
</com.android.systemui.statusbar.phone.KeyguardBottomAreaView>
|
||||
@@ -159,18 +159,6 @@
|
||||
android:visibility="gone"
|
||||
android:contentDescription="@string/accessibility_search_light"
|
||||
/>
|
||||
|
||||
<com.android.systemui.statusbar.policy.KeyButtonView
|
||||
android:id="@+id/camera_button"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="80dp"
|
||||
android:layout_gravity="center_vertical|right"
|
||||
android:src="@drawable/ic_sysbar_camera"
|
||||
android:scaleType="center"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="@string/accessibility_camera_button"
|
||||
systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
<com.android.systemui.statusbar.policy.DeadZone
|
||||
|
||||
@@ -90,4 +90,8 @@
|
||||
/>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
layout="@layout/keyguard_bottom_area"
|
||||
android:visibility="gone" />
|
||||
</com.android.systemui.statusbar.phone.NotificationPanelView><!-- end of sliding panel -->
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:focusable="true"
|
||||
android:fitsSystemWindows="true"
|
||||
android:descendantFocusability="afterDescendants">
|
||||
|
||||
<include layout="@layout/status_bar"
|
||||
@@ -33,8 +34,7 @@
|
||||
android:id="@+id/panel_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/panel_holder_padding_top"
|
||||
android:layout_marginBottom="@dimen/navigation_bar_height">
|
||||
android:layout_marginTop="@dimen/panel_holder_padding_top">
|
||||
<include layout="@layout/status_bar_expanded"
|
||||
android:layout_width="@dimen/notification_panel_width"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -1271,11 +1271,6 @@ public class KeyguardViewMediator extends SystemUI {
|
||||
// (like recents). Temporary enable/disable (e.g. the "back" button) are
|
||||
// done in KeyguardHostView.
|
||||
flags |= StatusBarManager.DISABLE_RECENT;
|
||||
if ((isSecure() && !mAllowNotificationsWhenSecure)
|
||||
|| !ENABLE_INSECURE_STATUS_BAR_EXPAND) {
|
||||
// showing secure lockscreen; disable expanding.
|
||||
flags |= StatusBarManager.DISABLE_EXPAND;
|
||||
}
|
||||
if (isSecure()) {
|
||||
// showing secure lockscreen; disable ticker and switch private notifications
|
||||
// to show their public versions, if available.
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License
|
||||
*/
|
||||
|
||||
package com.android.systemui.statusbar.phone;
|
||||
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.PowerManager;
|
||||
import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.android.systemui.R;
|
||||
|
||||
/**
|
||||
* Implementation for the bottom area of the Keyguard, including camera/phone affordance and status
|
||||
* text.
|
||||
*/
|
||||
public class KeyguardBottomAreaView extends FrameLayout {
|
||||
|
||||
final static String TAG = "PhoneStatusBar/KeyguardBottomAreaView";
|
||||
|
||||
private View mCameraButton;
|
||||
private float mCameraDragDistance;
|
||||
private PowerManager mPowerManager;
|
||||
private int mScaledTouchSlop;
|
||||
|
||||
public KeyguardBottomAreaView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public KeyguardBottomAreaView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public KeyguardBottomAreaView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public KeyguardBottomAreaView(Context context, AttributeSet attrs, int defStyleAttr,
|
||||
int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mCameraButton = findViewById(R.id.camera_button);
|
||||
watchForDevicePolicyChanges();
|
||||
watchForAccessibilityChanges();
|
||||
updateCameraVisibility();
|
||||
mCameraDragDistance = getResources().getDimension(R.dimen.camera_drag_distance);
|
||||
mScaledTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop();
|
||||
mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
|
||||
}
|
||||
|
||||
private void updateCameraVisibility() {
|
||||
boolean visible = !isCameraDisabledByDpm();
|
||||
mCameraButton.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private boolean isCameraDisabledByDpm() {
|
||||
final DevicePolicyManager dpm =
|
||||
(DevicePolicyManager) getContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||
if (dpm != null) {
|
||||
try {
|
||||
final int userId = ActivityManagerNative.getDefault().getCurrentUser().id;
|
||||
final int disabledFlags = dpm.getKeyguardDisabledFeatures(null, userId);
|
||||
final boolean disabledBecauseKeyguardSecure =
|
||||
(disabledFlags & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0
|
||||
&& KeyguardTouchDelegate.getInstance(getContext()).isSecure();
|
||||
return dpm.getCameraDisabled(null) || disabledBecauseKeyguardSecure;
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Can't get userId", e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void watchForDevicePolicyChanges() {
|
||||
final IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
|
||||
getContext().registerReceiver(new BroadcastReceiver() {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateCameraVisibility();
|
||||
}
|
||||
});
|
||||
}
|
||||
}, filter);
|
||||
}
|
||||
|
||||
private void watchForAccessibilityChanges() {
|
||||
final AccessibilityManager am =
|
||||
(AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||
|
||||
// Set the initial state
|
||||
enableAccessibility(am.isTouchExplorationEnabled());
|
||||
|
||||
// Watch for changes
|
||||
am.addTouchExplorationStateChangeListener(
|
||||
new AccessibilityManager.TouchExplorationStateChangeListener() {
|
||||
@Override
|
||||
public void onTouchExplorationStateChanged(boolean enabled) {
|
||||
enableAccessibility(enabled);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void enableAccessibility(boolean touchExplorationEnabled) {
|
||||
|
||||
// Add a touch handler or accessibility click listener for camera button.
|
||||
if (touchExplorationEnabled) {
|
||||
mCameraButton.setOnTouchListener(null);
|
||||
mCameraButton.setOnClickListener(mCameraClickListener);
|
||||
} else {
|
||||
mCameraButton.setOnTouchListener(mCameraTouchListener);
|
||||
mCameraButton.setOnClickListener(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void launchCamera() {
|
||||
mContext.startActivityAsUser(
|
||||
new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE),
|
||||
UserHandle.CURRENT);
|
||||
}
|
||||
|
||||
private final OnClickListener mCameraClickListener = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
launchCamera();
|
||||
}
|
||||
};
|
||||
|
||||
private final OnTouchListener mCameraTouchListener = new OnTouchListener() {
|
||||
private float mStartX;
|
||||
private boolean mTouchSlopReached;
|
||||
private boolean mSkipCancelAnimation;
|
||||
|
||||
@Override
|
||||
public boolean onTouch(final View cameraButtonView, MotionEvent event) {
|
||||
float realX = event.getRawX();
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
mStartX = realX;
|
||||
mTouchSlopReached = false;
|
||||
mSkipCancelAnimation = false;
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (realX > mStartX) {
|
||||
realX = mStartX;
|
||||
}
|
||||
if (realX < mStartX - mCameraDragDistance) {
|
||||
cameraButtonView.setPressed(true);
|
||||
mPowerManager.userActivity(event.getEventTime(), false);
|
||||
} else {
|
||||
cameraButtonView.setPressed(false);
|
||||
}
|
||||
if (realX < mStartX - mScaledTouchSlop) {
|
||||
mTouchSlopReached = true;
|
||||
}
|
||||
cameraButtonView.setTranslationX(Math.max(realX - mStartX,
|
||||
-mCameraDragDistance));
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
if (realX < mStartX - mCameraDragDistance) {
|
||||
launchCamera();
|
||||
cameraButtonView.animate().x(-cameraButtonView.getWidth())
|
||||
.setInterpolator(new AccelerateInterpolator(2f)).withEndAction(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
cameraButtonView.setTranslationX(0);
|
||||
}
|
||||
});
|
||||
mSkipCancelAnimation = true;
|
||||
}
|
||||
if (realX < mStartX - mScaledTouchSlop) {
|
||||
mTouchSlopReached = true;
|
||||
}
|
||||
if (!mTouchSlopReached) {
|
||||
mSkipCancelAnimation = true;
|
||||
cameraButtonView.animate().translationX(-mCameraDragDistance / 2).
|
||||
setInterpolator(new DecelerateInterpolator()).withEndAction(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
cameraButtonView.animate().translationX(0).
|
||||
setInterpolator(new AccelerateInterpolator());
|
||||
}
|
||||
});
|
||||
}
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
cameraButtonView.setPressed(false);
|
||||
if (!mSkipCancelAnimation) {
|
||||
cameraButtonView.animate().translationX(0)
|
||||
.setInterpolator(new AccelerateInterpolator(2f));
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -82,7 +82,6 @@ public final class NavigationBarTransitions extends BarTransitions {
|
||||
setKeyButtonViewQuiescentAlpha(mView.getMenuButton(), alpha, animate);
|
||||
|
||||
setKeyButtonViewQuiescentAlpha(mView.getSearchLight(), KEYGUARD_QUIESCENT_ALPHA, animate);
|
||||
setKeyButtonViewQuiescentAlpha(mView.getCameraButton(), KEYGUARD_QUIESCENT_ALPHA, animate);
|
||||
|
||||
applyBackButtonQuiescentAlpha(mode, animate);
|
||||
|
||||
@@ -98,7 +97,6 @@ public final class NavigationBarTransitions extends BarTransitions {
|
||||
public void applyBackButtonQuiescentAlpha(int mode, boolean animate) {
|
||||
float backAlpha = 0;
|
||||
backAlpha = maxVisibleQuiescentAlpha(backAlpha, mView.getSearchLight());
|
||||
backAlpha = maxVisibleQuiescentAlpha(backAlpha, mView.getCameraButton());
|
||||
backAlpha = maxVisibleQuiescentAlpha(backAlpha, mView.getHomeButton());
|
||||
backAlpha = maxVisibleQuiescentAlpha(backAlpha, mView.getRecentsButton());
|
||||
backAlpha = maxVisibleQuiescentAlpha(backAlpha, mView.getMenuButton());
|
||||
|
||||
@@ -21,36 +21,24 @@ import android.animation.LayoutTransition.TransitionListener;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.TimeInterpolator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.StatusBarManager;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.PowerManager;
|
||||
import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
@@ -63,8 +51,6 @@ import com.android.systemui.statusbar.policy.KeyButtonView;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import static com.android.systemui.statusbar.phone.KeyguardTouchDelegate.OnKeyguardConnectionListener;
|
||||
|
||||
public class NavigationBarView extends LinearLayout {
|
||||
final static boolean DEBUG = false;
|
||||
final static String TAG = "PhoneStatusBar/NavigationBarView";
|
||||
@@ -98,16 +84,9 @@ public class NavigationBarView extends LinearLayout {
|
||||
final static boolean WORKAROUND_INVALID_LAYOUT = true;
|
||||
final static int MSG_CHECK_INVALID_LAYOUT = 8686;
|
||||
|
||||
private final float mCameraDragDistance;
|
||||
|
||||
// used to disable the camera icon in navbar when disabled by DPM
|
||||
private boolean mCameraDisabledByDpm;
|
||||
|
||||
// performs manual animation in sync with layout transitions
|
||||
private final NavTransitionListener mTransitionListener = new NavTransitionListener();
|
||||
|
||||
private final PowerManager mPowerManager;
|
||||
|
||||
private class NavTransitionListener implements TransitionListener {
|
||||
private boolean mBackTransitioning;
|
||||
private boolean mHomeAppearing;
|
||||
@@ -157,112 +136,12 @@ public class NavigationBarView extends LinearLayout {
|
||||
private final OnClickListener mAccessibilityClickListener = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.camera_button) {
|
||||
KeyguardTouchDelegate.getInstance(getContext()).launchCamera();
|
||||
} else if (v.getId() == R.id.search_light) {
|
||||
if (v.getId() == R.id.search_light) {
|
||||
KeyguardTouchDelegate.getInstance(getContext()).showAssistant();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final int mScaledTouchSlop;
|
||||
|
||||
private final OnTouchListener mCameraTouchListener = new OnTouchListener() {
|
||||
private float mStartX;
|
||||
private boolean mTouchSlopReached;
|
||||
private boolean mSkipCancelAnimation;
|
||||
|
||||
@Override
|
||||
public boolean onTouch(final View cameraButtonView, MotionEvent event) {
|
||||
float realX = event.getRawX();
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
// disable search gesture while interacting with camera
|
||||
mDelegateHelper.setDisabled(true);
|
||||
mBarTransitions.setContentVisible(false);
|
||||
mStartX = realX;
|
||||
mTouchSlopReached = false;
|
||||
mSkipCancelAnimation = false;
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (realX > mStartX) {
|
||||
realX = mStartX;
|
||||
}
|
||||
if (realX < mStartX - mCameraDragDistance) {
|
||||
((KeyButtonView) cameraButtonView).setPressed(true);
|
||||
mPowerManager.userActivity(event.getEventTime(), false);
|
||||
} else {
|
||||
((KeyButtonView) cameraButtonView).setPressed(false);
|
||||
}
|
||||
if (realX < mStartX - mScaledTouchSlop) {
|
||||
mTouchSlopReached = true;
|
||||
}
|
||||
cameraButtonView.setTranslationX(Math.max(realX - mStartX,
|
||||
-mCameraDragDistance));
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
if (realX < mStartX - mCameraDragDistance) {
|
||||
mContext.startActivityAsUser(
|
||||
new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE),
|
||||
UserHandle.CURRENT);
|
||||
cameraButtonView.animate().x(-cameraButtonView.getWidth())
|
||||
.setInterpolator(new AccelerateInterpolator(2f)).withEndAction(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
cameraButtonView.setTranslationX(0);
|
||||
}
|
||||
});
|
||||
mSkipCancelAnimation = true;
|
||||
}
|
||||
if (realX < mStartX - mScaledTouchSlop) {
|
||||
mTouchSlopReached = true;
|
||||
}
|
||||
if (!mTouchSlopReached) {
|
||||
mSkipCancelAnimation = true;
|
||||
cameraButtonView.animate().translationX(-mCameraDragDistance / 2).
|
||||
setInterpolator(new DecelerateInterpolator()).withEndAction(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
cameraButtonView.animate().translationX(0).
|
||||
setInterpolator(new AccelerateInterpolator());
|
||||
}
|
||||
});
|
||||
}
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
((KeyButtonView) cameraButtonView).setPressed(false);
|
||||
mDelegateHelper.setDisabled(false);
|
||||
mBarTransitions.setContentVisible(true);
|
||||
if (!mSkipCancelAnimation) {
|
||||
cameraButtonView.animate().translationX(0)
|
||||
.setInterpolator(new AccelerateInterpolator(2f));
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
private final OnKeyguardConnectionListener mKeyguardConnectionListener =
|
||||
new OnKeyguardConnectionListener() {
|
||||
@Override
|
||||
public void onKeyguardServiceConnected(
|
||||
KeyguardTouchDelegate keyguardTouchDelegate) {
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mCameraDisabledByDpm = isCameraDisabledByDpm();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyguardServiceDisconnected(
|
||||
KeyguardTouchDelegate keyguardTouchDelegate) {
|
||||
}
|
||||
};
|
||||
|
||||
private class H extends Handler {
|
||||
public void handleMessage(Message m) {
|
||||
switch (m.what) {
|
||||
@@ -301,28 +180,6 @@ public class NavigationBarView extends LinearLayout {
|
||||
getIcons(res);
|
||||
|
||||
mBarTransitions = new NavigationBarTransitions(this);
|
||||
|
||||
KeyguardTouchDelegate.addListener(mKeyguardConnectionListener);
|
||||
mCameraDisabledByDpm = isCameraDisabledByDpm();
|
||||
watchForDevicePolicyChanges();
|
||||
mCameraDragDistance = res.getDimension(R.dimen.camera_drag_distance);
|
||||
mScaledTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop();
|
||||
mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
|
||||
}
|
||||
|
||||
private void watchForDevicePolicyChanges() {
|
||||
final IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
|
||||
getContext().registerReceiver(new BroadcastReceiver() {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mCameraDisabledByDpm = isCameraDisabledByDpm();
|
||||
}
|
||||
});
|
||||
}
|
||||
}, filter);
|
||||
}
|
||||
|
||||
public BarTransitions getBarTransitions() {
|
||||
@@ -381,11 +238,6 @@ public class NavigationBarView extends LinearLayout {
|
||||
return mCurrentView.findViewById(R.id.search_light);
|
||||
}
|
||||
|
||||
// shown when keyguard is visible and camera is available
|
||||
public View getCameraButton() {
|
||||
return mCurrentView.findViewById(R.id.camera_button);
|
||||
}
|
||||
|
||||
private void getIcons(Resources res) {
|
||||
mBackIcon = res.getDrawable(R.drawable.ic_sysbar_back);
|
||||
mBackLandIcon = res.getDrawable(R.drawable.ic_sysbar_back_land);
|
||||
@@ -475,9 +327,7 @@ public class NavigationBarView extends LinearLayout {
|
||||
getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
|
||||
|
||||
final boolean showSearch = disableHome && !disableSearch;
|
||||
final boolean showCamera = showSearch && !mCameraDisabledByDpm;
|
||||
setVisibleOrGone(getSearchLight(), showSearch);
|
||||
setVisibleOrGone(getCameraButton(), showCamera);
|
||||
|
||||
mBarTransitions.applyBackButtonQuiescentAlpha(mBarTransitions.getMode(), true /*animate*/);
|
||||
}
|
||||
@@ -488,24 +338,6 @@ public class NavigationBarView extends LinearLayout {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isCameraDisabledByDpm() {
|
||||
final DevicePolicyManager dpm =
|
||||
(DevicePolicyManager) getContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||
if (dpm != null) {
|
||||
try {
|
||||
final int userId = ActivityManagerNative.getDefault().getCurrentUser().id;
|
||||
final int disabledFlags = dpm.getKeyguardDisabledFeatures(null, userId);
|
||||
final boolean disabledBecauseKeyguardSecure =
|
||||
(disabledFlags & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0
|
||||
&& KeyguardTouchDelegate.getInstance(getContext()).isSecure();
|
||||
return dpm.getCameraDisabled(null) || disabledBecauseKeyguardSecure;
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Can't get userId", e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setSlippery(boolean newSlippery) {
|
||||
WindowManager.LayoutParams lp = (WindowManager.LayoutParams) getLayoutParams();
|
||||
if (lp != null) {
|
||||
@@ -572,25 +404,12 @@ public class NavigationBarView extends LinearLayout {
|
||||
// Add a touch handler or accessibility click listener for camera and search buttons
|
||||
// for all view orientations.
|
||||
final OnClickListener onClickListener = touchEnabled ? mAccessibilityClickListener : null;
|
||||
final OnTouchListener onTouchListener = touchEnabled ? null : mCameraTouchListener;
|
||||
boolean hasCamera = false;
|
||||
for (int i = 0; i < mRotatedViews.length; i++) {
|
||||
final View cameraButton = mRotatedViews[i].findViewById(R.id.camera_button);
|
||||
final View searchLight = mRotatedViews[i].findViewById(R.id.search_light);
|
||||
if (cameraButton != null) {
|
||||
hasCamera = true;
|
||||
cameraButton.setOnTouchListener(onTouchListener);
|
||||
cameraButton.setOnClickListener(onClickListener);
|
||||
}
|
||||
if (searchLight != null) {
|
||||
searchLight.setOnClickListener(onClickListener);
|
||||
}
|
||||
}
|
||||
if (hasCamera) {
|
||||
// Warm up KeyguardTouchDelegate so it's ready by the time the camera button is touched.
|
||||
// This will connect to KeyguardService so that touch events are processed.
|
||||
KeyguardTouchDelegate.getInstance(getContext());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isVertical() {
|
||||
@@ -727,7 +546,6 @@ public class NavigationBarView extends LinearLayout {
|
||||
dumpButton(pw, "rcnt", getRecentsButton());
|
||||
dumpButton(pw, "menu", getMenuButton());
|
||||
dumpButton(pw, "srch", getSearchLight());
|
||||
dumpButton(pw, "cmra", getCameraButton());
|
||||
|
||||
pw.println(" }");
|
||||
}
|
||||
|
||||
@@ -221,6 +221,7 @@ public class PanelView extends FrameLayout {
|
||||
protected int mMaxPanelHeight = 0;
|
||||
private String mViewName;
|
||||
protected float mInitialTouchY;
|
||||
protected float mInitialTouchX;
|
||||
protected float mFinalTouchY;
|
||||
|
||||
protected void onExpandingFinished() {
|
||||
@@ -375,12 +376,14 @@ public class PanelView extends FrameLayout {
|
||||
mTrackingPointer = event.getPointerId(pointerIndex);
|
||||
}
|
||||
final float y = event.getY(pointerIndex);
|
||||
final float x = event.getX(pointerIndex);
|
||||
|
||||
switch (event.getActionMasked()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
mTracking = true;
|
||||
|
||||
mInitialTouchY = y;
|
||||
mInitialTouchX = x;
|
||||
initVelocityTracker();
|
||||
trackMovement(event);
|
||||
mTimeAnimator.cancel(); // end any outstanding animations
|
||||
@@ -398,9 +401,11 @@ public class PanelView extends FrameLayout {
|
||||
// gesture is ongoing, find a new pointer to track
|
||||
final int newIndex = event.getPointerId(0) != upPointer ? 0 : 1;
|
||||
final float newY = event.getY(newIndex);
|
||||
final float newX = event.getX(newIndex);
|
||||
mTrackingPointer = event.getPointerId(newIndex);
|
||||
mInitialOffsetOnTouch = mExpandedHeight;
|
||||
mInitialTouchY = newY;
|
||||
mInitialTouchX = newX;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -515,18 +520,17 @@ public class PanelView extends FrameLayout {
|
||||
pointerIndex = 0;
|
||||
mTrackingPointer = event.getPointerId(pointerIndex);
|
||||
}
|
||||
final float x = event.getX(pointerIndex);
|
||||
final float y = event.getY(pointerIndex);
|
||||
boolean scrolledToBottom = isScrolledToBottom();
|
||||
|
||||
switch (event.getActionMasked()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
mInitialTouchY = y;
|
||||
mInitialTouchX = x;
|
||||
initVelocityTracker();
|
||||
trackMovement(event);
|
||||
mTimeAnimator.cancel(); // end any outstanding animations
|
||||
if (mExpandedHeight == 0 || y > getContentHeight()) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_POINTER_UP:
|
||||
final int upPointer = event.getPointerId(event.getActionIndex());
|
||||
@@ -534,8 +538,8 @@ public class PanelView extends FrameLayout {
|
||||
// gesture is ongoing, find a new pointer to track
|
||||
final int newIndex = event.getPointerId(0) != upPointer ? 0 : 1;
|
||||
mTrackingPointer = event.getPointerId(newIndex);
|
||||
final float newY = event.getY(newIndex);
|
||||
mInitialTouchY = newY;
|
||||
mInitialTouchX = event.getX(newIndex);
|
||||
mInitialTouchY = event.getY(newIndex);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -543,9 +547,10 @@ public class PanelView extends FrameLayout {
|
||||
final float h = y - mInitialTouchY;
|
||||
trackMovement(event);
|
||||
if (scrolledToBottom) {
|
||||
if (h < -mTouchSlop) {
|
||||
if (h < -mTouchSlop && h < -Math.abs(x - mInitialTouchX)) {
|
||||
mInitialOffsetOnTouch = mExpandedHeight;
|
||||
mInitialTouchY = y;
|
||||
mInitialTouchX = x;
|
||||
mTracking = true;
|
||||
onTrackingStarted();
|
||||
return true;
|
||||
@@ -619,7 +624,7 @@ public class PanelView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
heightMeasureSpec = MeasureSpec.makeMeasureSpec(
|
||||
getDesiredMeasureHeight(), MeasureSpec.AT_MOST);
|
||||
getDesiredMeasureHeight(), MeasureSpec.AT_MOST);
|
||||
setMeasuredDimension(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.ViewPropertyAnimator;
|
||||
import android.view.ViewStub;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.Animation;
|
||||
@@ -227,6 +228,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
||||
// top bar
|
||||
View mNotificationPanelHeader;
|
||||
View mKeyguardStatusView;
|
||||
View mKeyguardBottomArea;
|
||||
int mKeyguardMaxNotificationCount;
|
||||
View mDateTimeView;
|
||||
View mClearButton;
|
||||
@@ -612,6 +614,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
||||
|
||||
mNotificationPanelHeader = mStatusBarWindow.findViewById(R.id.header);
|
||||
mKeyguardStatusView = mStatusBarWindow.findViewById(R.id.keyguard_status_view);
|
||||
mKeyguardBottomArea = mStatusBarWindow.findViewById(R.id.keyguard_bottom_area);
|
||||
|
||||
mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button);
|
||||
mClearButton.setOnClickListener(mClearButtonListener);
|
||||
@@ -2068,7 +2071,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
||||
private void checkBarModes() {
|
||||
if (mDemoMode) return;
|
||||
int sbMode = mStatusBarMode;
|
||||
if (panelsEnabled() && (mInteractingWindows & StatusBarManager.WINDOW_STATUS_BAR) != 0) {
|
||||
if (panelsEnabled() && (mInteractingWindows & StatusBarManager.WINDOW_STATUS_BAR) != 0
|
||||
&& !mOnKeyguard) {
|
||||
// if panels are expandable, force the status bar opaque on any interaction
|
||||
sbMode = MODE_OPAQUE;
|
||||
}
|
||||
@@ -2911,22 +2915,26 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
||||
flipToNotifications();
|
||||
}
|
||||
mKeyguardStatusView.setVisibility(View.VISIBLE);
|
||||
mKeyguardBottomArea.setVisibility(View.VISIBLE);
|
||||
mNotificationPanelHeader.setVisibility(View.GONE);
|
||||
|
||||
mKeyguardFlipper.setVisibility(View.VISIBLE);
|
||||
mSettingsContainer.setKeyguardShowing(true);
|
||||
updateRowStates();
|
||||
checkBarModes();
|
||||
}
|
||||
|
||||
public void hideKeyguard() {
|
||||
mOnKeyguard = false;
|
||||
mKeyguardStatusView.setVisibility(View.GONE);
|
||||
mKeyguardBottomArea.setVisibility(View.GONE);
|
||||
mNotificationPanelHeader.setVisibility(View.VISIBLE);
|
||||
|
||||
mKeyguardFlipper.setVisibility(View.GONE);
|
||||
mSettingsContainer.setKeyguardShowing(false);
|
||||
updateRowStates();
|
||||
instantCollapseNotificationPanel();
|
||||
checkBarModes();
|
||||
}
|
||||
|
||||
public void userActivity() {
|
||||
@@ -2955,8 +2963,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
||||
}
|
||||
|
||||
private void instantExpandNotificationsPanel() {
|
||||
mExpandedVisible = true;
|
||||
mNotificationPanel.setExpandedFraction(1);
|
||||
mNotificationPanel.getViewTreeObserver().addOnGlobalLayoutListener(
|
||||
new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
mNotificationPanel.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
mNotificationPanel.setExpandedFraction(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void instantCollapseNotificationPanel() {
|
||||
@@ -2974,6 +2988,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
||||
return mKeyguardMaxNotificationCount;
|
||||
}
|
||||
|
||||
public NavigationBarView getNavigationBarView() {
|
||||
return mNavigationBarView;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a ViewGroup that spans the entire panel which contains the quick settings
|
||||
*/
|
||||
|
||||
@@ -56,6 +56,7 @@ public class StatusBarKeyguardViewManager {
|
||||
private boolean mScreenOn = false;
|
||||
private KeyguardBouncer mBouncer;
|
||||
private boolean mShowing;
|
||||
private boolean mOccluded;
|
||||
|
||||
public StatusBarKeyguardViewManager(Context context, ViewMediatorCallback callback,
|
||||
LockPatternUtils lockPatternUtils) {
|
||||
@@ -152,7 +153,9 @@ public class StatusBarKeyguardViewManager {
|
||||
}
|
||||
|
||||
public void setOccluded(boolean occluded) {
|
||||
mOccluded = occluded;
|
||||
mStatusBarWindowManager.setKeyguardOccluded(occluded);
|
||||
updateBackButtonState();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,6 +167,7 @@ public class StatusBarKeyguardViewManager {
|
||||
mStatusBarWindowManager.setKeyguardShowing(false);
|
||||
mBouncer.hide();
|
||||
mViewMediatorCallback.keyguardGone();
|
||||
updateBackButtonState();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,6 +209,11 @@ public class StatusBarKeyguardViewManager {
|
||||
} else {
|
||||
mContainer.setSystemUiVisibility(vis | View.STATUS_BAR_DISABLE_BACK);
|
||||
}
|
||||
if (!(mShowing && !mOccluded) || mBouncer.isShowing()) {
|
||||
mPhoneStatusBar.getNavigationBarView().setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mPhoneStatusBar.getNavigationBarView().setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onMenuPressed() {
|
||||
|
||||
Reference in New Issue
Block a user