/*
* Copyright (C) 2010 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.zheng.systemui.statusbar.phone;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.ActivityManager;
import android.app.ActivityManagerNative;
import android.app.Dialog;
import android.app.KeyguardManager;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.StatusBarManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.NinePatchDrawable;
import android.inputmethodservice.InputMethodService;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Slog;
import android.view.Choreographer;
import android.view.Display;
import android.view.Gravity;
import android.view.IWindowManager;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.view.WindowManagerImpl;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.StatusBarNotification;
import com.zheng.systemui.R;
import com.zheng.systemui.recent.RecentTasksLoader;
import com.zheng.systemui.statusbar.BaseStatusBar;
import com.zheng.systemui.statusbar.NotificationData;
import com.zheng.systemui.statusbar.NotificationData.Entry;
import com.zheng.systemui.statusbar.CommandQueue;
import com.zheng.systemui.statusbar.RotationToggle;
import com.zheng.systemui.statusbar.SignalClusterView;
import com.zheng.systemui.statusbar.StatusBarIconView;
import com.zheng.systemui.statusbar.policy.BatteryController;
import com.zheng.systemui.statusbar.policy.DateView;
import com.zheng.systemui.statusbar.policy.IntruderAlertView;
import com.zheng.systemui.statusbar.policy.LocationController;
import com.zheng.systemui.statusbar.policy.OnSizeChangedListener;
import com.zheng.systemui.statusbar.policy.NetworkController;
import com.zheng.systemui.statusbar.policy.NotificationRowLayout;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
public class PhoneStatusBar extends BaseStatusBar {
static final String TAG = "PhoneStatusBar";
public static final boolean DEBUG = false;
public static final boolean SPEW = DEBUG;
public static final boolean DUMPTRUCK = true; // extra dumpsys info
// additional instrumentation for testing purposes; intended to be left on during development
public static final boolean CHATTY = DEBUG;
public static final String ACTION_STATUSBAR_START
= "com.android.internal.policy.statusbar.START";
private static final boolean DIM_BEHIND_EXPANDED_PANEL = true;
private static final boolean SHOW_CARRIER_LABEL = true;
private static final int MSG_OPEN_NOTIFICATION_PANEL = 1000;
private static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001;
// 1020-1030 reserved for BaseStatusBar
// will likely move to a resource or other tunable param at some point
private static final int INTRUDER_ALERT_DECAY_MS = 0; // disabled, was 10000;
private static final boolean CLOSE_PANEL_WHEN_EMPTIED = true;
private static final int NOTIFICATION_PRIORITY_MULTIPLIER = 10; // see NotificationManagerService
private static final int HIDE_ICONS_BELOW_SCORE = Notification.PRIORITY_LOW * NOTIFICATION_PRIORITY_MULTIPLIER;
// fling gesture tuning parameters, scaled to display density
private float mSelfExpandVelocityPx; // classic value: 2000px/s
private float mSelfCollapseVelocityPx; // classic value: 2000px/s (will be negated to collapse "up")
private float mFlingExpandMinVelocityPx; // classic value: 200px/s
private float mFlingCollapseMinVelocityPx; // classic value: 200px/s
private float mCollapseMinDisplayFraction; // classic value: 0.08 (25px/min(320px,480px) on G1)
private float mExpandMinDisplayFraction; // classic value: 0.5 (drag open halfway to expand)
private float mFlingGestureMaxXVelocityPx; // classic value: 150px/s
private float mExpandAccelPx; // classic value: 2000px/s/s
private float mCollapseAccelPx; // classic value: 2000px/s/s (will be negated to collapse "up")
private float mFlingGestureMaxOutputVelocityPx; // how fast can it really go? (should be a little
// faster than mSelfCollapseVelocityPx)
PhoneStatusBarPolicy mIconPolicy;
// These are no longer handled by the policy, because we need custom strategies for them
BatteryController mBatteryController;
LocationController mLocationController;
NetworkController mNetworkController;
int mNaturalBarHeight = -1;
int mIconSize = -1;
int mIconHPadding = -1;
Display mDisplay;
IWindowManager mWindowManager;
StatusBarWindowView mStatusBarWindow;
PhoneStatusBarView mStatusBarView;
int mPixelFormat;
Object mQueueLock = new Object();
// icons
LinearLayout mIcons;
IconMerger mNotificationIcons;
View mMoreIcon;
LinearLayout mStatusIcons;
// expanded notifications
View mNotificationPanel; // the sliding/resizing panel within the notification window
ScrollView mScrollView;
View mExpandedContents;
int mNotificationPanelMarginBottomPx, mNotificationPanelMarginLeftPx;
final Rect mNotificationPanelBackgroundPadding = new Rect();
int mNotificationPanelGravity;
int mNotificationPanelMinHeight;
boolean mNotificationPanelIsFullScreenWidth;
// top bar
View mClearButton;
View mSettingsButton;
RotationToggle mRotationButton;
// carrier/wifi label
private TextView mCarrierLabel;
private boolean mCarrierLabelVisible = false;
private int mCarrierLabelHeight;
// drag bar
CloseDragHandle mCloseView;
private int mCloseViewHeight;
// position
int[] mPositionTmp = new int[2];
boolean mExpanded;
boolean mExpandedVisible;
// the date view
DateView mDateView;
// for immersive activities
private IntruderAlertView mIntruderAlertView;
// on-screen navigation buttons
private NavigationBarView mNavigationBarView = null;
// the tracker view
int mTrackingPosition; // the position of the top of the tracking view.
private boolean mPanelSl
- 1
- 2
- 3
- 4
前往页