Baseline existing .java files, no excuses going forward.
Change-Id: I4bd0f25bbda6f2ec832e34ef5c70d4830bf07f99
private View mScrollView;
- private OnScaleGestureListener mScaleGestureListener
+ private OnScaleGestureListener mScaleGestureListener
= new ScaleGestureDetector.SimpleOnScaleGestureListener() {
@Override
public boolean onScaleBegin(ScaleGestureDetector detector) {
"\nvoid main(void) {\n" +
" gl_FragColor = texture2D(texture, outTexCoords);\n" +
"}\n\n";
-
+
private static final int FLOAT_SIZE_BYTES = 4;
private static final int TRIANGLE_VERTICES_DATA_STRIDE_BYTES = 5 * FLOAT_SIZE_BYTES;
private static final int TRIANGLE_VERTICES_DATA_POS_OFFSET = 0;
}
super.onCreate(surfaceHolder);
-
+
// TODO: Don't need this currently because the wallpaper service
// will restart the image wallpaper whenever the image changes.
//IntentFilter filter = new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED);
private int loadTexture(Bitmap bitmap) {
int[] textures = new int[1];
-
+
glActiveTexture(GL_TEXTURE0);
glGenTextures(1, textures, 0);
checkGlError();
-
+
int texture = textures[0];
glBindTexture(GL_TEXTURE_2D, texture);
checkGlError();
-
+
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
+
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
+
GLUtils.texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bitmap, GL_UNSIGNED_BYTE, 0);
checkGlError();
return texture;
}
-
+
private int buildProgram(String vertex, String fragment) {
int vertexShader = buildShader(vertex, GL_VERTEX_SHADER);
if (vertexShader == 0) return 0;
-
+
int fragmentShader = buildShader(fragment, GL_FRAGMENT_SHADER);
if (fragmentShader == 0) return 0;
-
+
int program = glCreateProgram();
glAttachShader(program, vertexShader);
checkGlError();
-
+
glAttachShader(program, fragmentShader);
checkGlError();
-
+
glLinkProgram(program);
checkGlError();
-
+
int[] status = new int[1];
glGetProgramiv(program, GL_LINK_STATUS, status, 0);
if (status[0] != GL_TRUE) {
glDeleteProgram(program);
return 0;
}
-
+
return program;
}
private int buildShader(String source, int type) {
int shader = glCreateShader(type);
-
+
glShaderSource(shader, source);
checkGlError();
-
+
glCompileShader(shader);
checkGlError();
-
+
int[] status = new int[1];
glGetShaderiv(shader, GL_COMPILE_STATUS, status, 0);
if (status[0] != GL_TRUE) {
glDeleteShader(shader);
return 0;
}
-
+
return shader;
}
private boolean initGL(SurfaceHolder surfaceHolder) {
mEgl = (EGL10) EGLContext.getEGL();
-
+
mEglDisplay = mEgl.eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (mEglDisplay == EGL_NO_DISPLAY) {
throw new RuntimeException("eglGetDisplay failed " +
GLUtils.getEGLErrorString(mEgl.eglGetError()));
}
-
+
int[] version = new int[2];
if (!mEgl.eglInitialize(mEglDisplay, version)) {
throw new RuntimeException("eglInitialize failed " +
GLUtils.getEGLErrorString(mEgl.eglGetError()));
}
-
+
mEglConfig = chooseEglConfig();
if (mEglConfig == null) {
throw new RuntimeException("eglConfig not initialized");
}
-
+
mEglContext = createContext(mEgl, mEglDisplay, mEglConfig);
if (mEglContext == EGL_NO_CONTEXT) {
throw new RuntimeException("createContext failed " +
throw new RuntimeException("createWindowSurface failed " +
GLUtils.getEGLErrorString(error));
}
-
+
if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) {
throw new RuntimeException("eglMakeCurrent failed " +
GLUtils.getEGLErrorString(mEgl.eglGetError()));
return true;
}
-
-
+
+
EGLContext createContext(EGL10 egl, EGLDisplay eglDisplay, EGLConfig eglConfig) {
int[] attrib_list = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
- return egl.eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, attrib_list);
+ return egl.eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, attrib_list);
}
-
+
private EGLConfig chooseEglConfig() {
int[] configsCount = new int[1];
EGLConfig[] configs = new EGLConfig[1];
public class LoadAverageService extends Service {
private View mView;
-
+
private static final class Stats extends ProcessStats {
String mLoadText;
int mLoadWidth;
-
+
private final Paint mPaint;
-
+
Stats(Paint paint) {
super(false);
mPaint = paint;
}
-
+
@Override
public void onLoadChanged(float load1, float load5, float load15) {
mLoadText = load1 + " / " + load5 + " / " + load15;
return (int)mPaint.measureText(name);
}
}
-
+
private class LoadView extends View {
private Handler mHandler = new Handler() {
@Override
};
private final Stats mStats;
-
+
private Paint mLoadPaint;
private Paint mAddedPaint;
private Paint mRemovedPaint;
final int irqTime = stats.getLastIrqTime();
final int softIrqTime = stats.getLastSoftIrqTime();
final int idleTime = stats.getLastIdleTime();
-
+
final int totalTime = userTime+systemTime+iowaitTime+irqTime+softIrqTime+idleTime;
if (totalTime == 0) {
return;
maxWidth = st.nameWidth;
}
}
-
+
int neededWidth = mPaddingLeft + mPaddingRight + maxWidth;
int neededHeight = mPaddingTop + mPaddingBottom + (mFH*(1+NW));
if (neededWidth != mNeededWidth || neededHeight != mNeededHeight) {
public Map<Class<?>, Object> mComponents;
public abstract void start();
-
+
protected void onConfigurationChanged(Configuration newConfig) {
}
d.show();
mInvalidChargerDialog = d;
}
-
+
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.print("mLowBatteryAlertCloseLevel=");
pw.println(mLowBatteryAlertCloseLevel);
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
Intent chooserIntent = Intent.createChooser(sharingIntent, null);
- chooserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK
+ chooserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK
| Intent.FLAG_ACTIVITY_NEW_TASK);
mNotificationBuilder.addAction(R.drawable.ic_menu_share,
r.getString(com.android.internal.R.string.share),
- PendingIntent.getActivity(context, 0, chooserIntent,
+ PendingIntent.getActivity(context, 0, chooserIntent,
PendingIntent.FLAG_CANCEL_CURRENT));
OutputStream out = resolver.openOutputStream(uri);
/**
* Returns the right icon to use for this item, respecting the iconId and
* iconPackage (if set)
- *
+ *
* @param context Context to use to get resources if iconPackage is not set
* @return Drawable for this item, or null if the package or item could not
* be found
if (icon.iconId == 0) {
return null;
}
-
+
try {
return r.getDrawable(icon.iconId);
} catch (RuntimeException e) {
}
public String toString() {
- return "StatusBarIconView(slot=" + mSlot + " icon=" + mIcon
+ return "StatusBarIconView(slot=" + mSlot + " icon=" + mIcon
+ " notification=" + mNotification + ")";
}
}
@Override
public void onFinishInflate() {
- mRotatedViews[Surface.ROTATION_0] =
+ mRotatedViews[Surface.ROTATION_0] =
mRotatedViews[Surface.ROTATION_180] = findViewById(R.id.rot0);
mRotatedViews[Surface.ROTATION_90] = findViewById(R.id.rot90);
-
+
mRotatedViews[Surface.ROTATION_270] = NAVBAR_ALWAYS_AT_RIGHT
? findViewById(R.id.rot90)
: findViewById(R.id.rot270);
@Override
protected void onLayout (boolean changed, int left, int top, int right, int bottom) {
if (DEBUG) Log.d(TAG, String.format(
- "onLayout: %s (%d,%d,%d,%d)",
+ "onLayout: %s (%d,%d,%d,%d)",
changed?"changed":"notchanged", left, top, right, bottom));
super.onLayout(changed, left, top, right, bottom);
}
return super.onInterceptTouchEvent(ev);
}
*/
-
+
private String getResourceName(int resId) {
if (resId != 0) {
getWindowVisibleDisplayFrame(r);
final boolean offscreen = r.right > size.x || r.bottom > size.y;
- pw.println(" window: "
+ pw.println(" window: "
+ r.toShortString()
+ " " + visibilityToString(getWindowVisibility())
+ (offscreen ? " OFFSCREEN!" : ""));
}
if (DEBUG) LOG("collapseAllPanels: animate=%s waiting=%s", animate, waiting);
if (!waiting && mState != STATE_CLOSED) {
- // it's possible that nothing animated, so we replicate the termination
+ // it's possible that nothing animated, so we replicate the termination
// conditions of panelExpansionChanged here
go(STATE_CLOSED);
onAllPanelsCollapsed();
return;
}
if (mPeekAnimator == null) {
- mPeekAnimator = ObjectAnimator.ofFloat(this,
+ mPeekAnimator = ObjectAnimator.ofFloat(this,
"expandedHeight", mPeekHeight)
.setDuration(250);
}
mFlingGestureMaxOutputVelocityPx = res.getDimension(R.dimen.fling_gesture_max_output_velocity);
- mPeekHeight = res.getDimension(R.dimen.peek_height)
+ mPeekHeight = res.getDimension(R.dimen.peek_height)
+ getPaddingBottom() // our window might have a dropshadow
- (mHandleView == null ? 0 : mHandleView.getPaddingTop()); // the handle might have a topshadow
}
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
+ private float mFlingGestureMaxOutputVelocityPx; // how fast can it really go? (should be a little
// faster than mSelfCollapseVelocityPx)
PhoneStatusBarPolicy mIconPolicy;
// viewgroup containing the normal contents of the statusbar
LinearLayout mStatusBarContents;
-
+
// right-hand icons
LinearLayout mSystemIconArea;
-
- // left-hand icons
+
+ // left-hand icons
LinearLayout mStatusIcons;
// the icons themselves
IconMerger mNotificationIcons;
// top bar
View mNotificationPanelHeader;
- View mDateTimeView;
+ View mDateTimeView;
View mClearButton;
ImageView mSettingsButton, mNotificationButton;
// XXX: gesture research
private final GestureRecorder mGestureRec = DEBUG_GESTURES
- ? new GestureRecorder("/sdcard/statusbar_gestures.dat")
+ ? new GestureRecorder("/sdcard/statusbar_gestures.dat")
: null;
private int mNavigationIconHints = 0;
mStatusBarView = (PhoneStatusBarView) mStatusBarWindow.findViewById(R.id.status_bar);
mStatusBarView.setBar(this);
-
+
PanelHolder holder = (PanelHolder) mStatusBarWindow.findViewById(R.id.panel_holder);
mStatusBarView.setPanelHolder(holder);
}
}
- mClingShown = ! (DEBUG_CLINGS
+ mClingShown = ! (DEBUG_CLINGS
|| !Prefs.read(mContext).getBoolean(Prefs.SHOWN_QUICK_SETTINGS_HELP, false));
if (!ENABLE_NOTIFICATION_PANEL_CLING || ActivityManager.isRunningInTestHarness()) {
protected void updateCarrierLabelVisibility(boolean force) {
if (!mShowCarrierInPanel) return;
- // The idea here is to only show the carrier label when there is enough room to see it,
+ // The idea here is to only show the carrier label when there is enough room to see it,
// i.e. when there aren't enough notifications to fill the panel.
if (DEBUG) {
Log.d(TAG, String.format("pileh=%d scrollh=%d carrierh=%d",
!(emergencyCallsShownElsewhere && mNetworkController.isEmergencyOnly())
&& mPile.getHeight() < (mNotificationPanel.getHeight() - mCarrierLabelHeight - mNotificationHeaderHeight)
&& mScrollView.getVisibility() == View.VISIBLE;
-
+
if (force || mCarrierLabelVisible != makeVisible) {
mCarrierLabelVisible = makeVisible;
if (DEBUG) {
+ " any=" + any + " clearable=" + clearable);
}
- if (mHasFlipSettings
- && mFlipSettingsView != null
+ if (mHasFlipSettings
+ && mFlipSettingsView != null
&& mFlipSettingsView.getVisibility() == View.VISIBLE
&& mScrollView.getVisibility() != View.VISIBLE) {
// the flip settings panel is unequivocally showing; we should not be shown
a.setStartDelay(d);
return a;
}
-
+
public Animator start(Animator a) {
a.start();
return a;
interpolator(mAccelerateInterpolator,
ObjectAnimator.ofFloat(mScrollView, View.SCALE_X, 1f, 0f)
)
- .setDuration(FLIP_DURATION_OUT),
+ .setDuration(FLIP_DURATION_OUT),
mScrollView, View.INVISIBLE));
mSettingsButtonAnim = start(
setVisibilityWhenDone(
/**
* Enables or disables layers on the children of the notifications pile.
- *
+ *
* When layers are enabled, this method attempts to enable layers for the minimal
* number of children. Only children visible when the notification area is fully
* expanded will receive a layer. The technique used in this method might cause
* more children than necessary to get a layer (at most one extra child with the
* current UI.)
- *
+ *
* @param layerType {@link View#LAYER_TYPE_NONE} or {@link View#LAYER_TYPE_HARDWARE}
*/
private void setPileLayers(int layerType) {
}
break;
case View.LAYER_TYPE_HARDWARE:
- final int[] location = new int[2];
+ final int[] location = new int[2];
mNotificationPanel.getLocationInWindow(location);
final int left = location[0];
// Cling (first-run help) handling.
// The cling is supposed to show the first time you drag, or even tap, the status bar.
- // It should show the notification panel, then fade in after half a second, giving you
+ // It should show the notification panel, then fade in after half a second, giving you
// an explanation of what just happened, as well as teach you how to access quick
- // settings (another drag). The user can dismiss the cling by clicking OK or by
+ // settings (another drag). The user can dismiss the cling by clicking OK or by
// dragging quick settings into view.
final int act = event.getActionMasked();
if (mSuppressStatusBarDrags) {
void updateDisplaySize() {
mDisplay.getMetrics(mDisplayMetrics);
if (DEBUG_GESTURES) {
- mGestureRec.tag("display",
+ mGestureRec.tag("display",
String.format("%dx%d", mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels));
}
}
if (mFullWidthNotifications) {
// No double swiping. If either panel is open, nothing else can be pulled down.
- return ((mSettingsPanel == null ? 0 : mSettingsPanel.getExpandedHeight())
- + mNotificationPanel.getExpandedHeight() > 0)
- ? null
+ return ((mSettingsPanel == null ? 0 : mSettingsPanel.getExpandedHeight())
+ + mNotificationPanel.getExpandedHeight() > 0)
+ ? null
: mNotificationPanel;
}
public abstract class Ticker {
private static final int TICKER_SEGMENT_DELAY = 3000;
-
+
private Context mContext;
private Handler mHandler = new Handler();
private ArrayList<Segment> mSegments = new ArrayList();
if (initialCount == 0 && mSegments.size() > 0) {
Segment seg = mSegments.get(0);
seg.first = false;
-
+
mIconSwitcher.setAnimateFirstView(false);
mIconSwitcher.reset();
mIconSwitcher.setImageDrawable(seg.icon);
-
+
mTextSwitcher.setAnimateFirstView(false);
mTextSwitcher.reset();
mTextSwitcher.setText(seg.getText());
-
+
tickerStarting();
scheduleAdvance();
}
boolean plugged = false;
switch (status) {
- case BatteryManager.BATTERY_STATUS_CHARGING:
+ case BatteryManager.BATTERY_STATUS_CHARGING:
case BatteryManager.BATTERY_STATUS_FULL:
plugged = true;
break;
return formatted;
}
}
-
+
return result;
}
mAttachedToWindow = true;
setUpdates();
}
-
+
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
Rect mTmpRect = new Rect();
private SwipeHelper mSwipeHelper;
-
+
BaseStatusBar mBar;
private ViewGroup mContentHolder;
-
+
private Notification mHeadsUp;
private OnClickListener mOnClickListener;
float densityScale = getResources().getDisplayMetrics().density;
float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, densityScale, pagingTouchSlop);
-
+
mContentHolder = (ViewGroup) findViewById(R.id.contentHolder);
if (mHeadsUp != null) {
// whoops, we're on already!
applyContent(mHeadsUp, mOnClickListener);
}
}
-
+
public void setBar(BaseStatusBar bar) {
mBar = bar;
}
defStyle, 0);
mCode = a.getInteger(R.styleable.KeyButtonView_keyCode, 0);
-
+
mSupportsLongpress = a.getBoolean(R.styleable.KeyButtonView_keyRepeat, true);
mGlowBG = a.getDrawable(R.styleable.KeyButtonView_glowBackground);
mGlowWidth = mGlowBG.getIntrinsicWidth();
mGlowHeight = mGlowBG.getIntrinsicHeight();
}
-
+
a.recycle();
setClickable(true);
}
final AnimatorSet as = mPressedAnim = new AnimatorSet();
if (pressed) {
- if (mGlowScale < GLOW_MAX_SCALE_FACTOR)
+ if (mGlowScale < GLOW_MAX_SCALE_FACTOR)
mGlowScale = GLOW_MAX_SCALE_FACTOR;
if (mGlowAlpha < BUTTON_QUIESCENT_ALPHA)
mGlowAlpha = BUTTON_QUIESCENT_ALPHA;
textResId = R.string.gps_notification_searching_text;
visible = true;
}
-
+
try {
if (visible) {
Intent gpsIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
// Notification.Builder will helpfully fill these out for you no matter what you do
n.tickerView = null;
n.tickerText = null;
-
+
n.priority = Notification.PRIORITY_HIGH;
int[] idOut = new int[1];
mNotificationService.enqueueNotificationWithTag(
mContext.getPackageName(), mContext.getBasePackageName(),
- null,
- GPS_NOTIFICATION_ID,
+ null,
+ GPS_NOTIFICATION_ID,
n,
idOut,
UserHandle.USER_ALL);
import java.util.HashMap;
-public class NotificationRowLayout
- extends LinearLayout
+public class NotificationRowLayout
+ extends LinearLayout
implements SwipeHelper.Callback, ExpandHelper.Callback
{
private static final String TAG = "NotificationRowLayout";
HashMap<View, ValueAnimator> mDisappearingViews = new HashMap<View, ValueAnimator>();
private SwipeHelper mSwipeHelper;
-
+
private OnSizeChangedListener mOnSizeChangedListener;
// Flag set during notification removal animation to avoid causing too much work until
mRealLayoutTransition = new LayoutTransition();
mRealLayoutTransition.setAnimateParentHierarchy(true);
setLayoutTransitionsEnabled(true);
-
+
setOrientation(LinearLayout.VERTICAL);
if (DEBUG) {
/**
* The notification that is shown when a USB mass storage host
- * is connected.
+ * is connected.
* <p>
* This is lazily created, so use {@link #setUsbStorageNotification()}.
*/
setMediaStorageNotification(
com.android.internal.R.string.ext_media_unmountable_notification_title,
com.android.internal.R.string.ext_media_unmountable_notification_message,
- com.android.internal.R.drawable.stat_notify_sdcard_usb, true, false, pi);
+ com.android.internal.R.drawable.stat_notify_sdcard_usb, true, false, pi);
updateUsbMassStorageNotification(mUmsAvailable);
} else if (newState.equals(Environment.MEDIA_REMOVED)) {
/*
if (notificationManager == null) {
return;
}
-
+
if (visible) {
Resources r = Resources.getSystem();
CharSequence title = r.getText(titleId);
} else {
mUsbStorageNotification.defaults &= ~Notification.DEFAULT_SOUND;
}
-
+
mUsbStorageNotification.flags = Notification.FLAG_ONGOING_EVENT;
mUsbStorageNotification.tickerText = title;
mUsbStorageNotification.fullScreenIntent = pi;
}
}
-
+
final int notificationId = mUsbStorageNotification.icon;
if (visible) {
notificationManager.notifyAsUser(null, notificationId, mUsbStorageNotification,
final int notificationId = mMediaStorageNotification.icon;
notificationManager.cancel(notificationId);
}
-
+
if (visible) {
Resources r = Resources.getSystem();
CharSequence title = r.getText(titleId);
mMediaStorageNotification.icon = icon;
mMediaStorageNotification.setLatestEventInfo(mContext, title, message, pi);
}
-
+
final int notificationId = mMediaStorageNotification.icon;
if (visible) {
notificationManager.notifyAsUser(null, notificationId,
switchDisplay(on);
}
};
-
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.w(TAG, "Failed to get StorageManager");
}
}
-
+
mUIHandler = new Handler();
HandlerThread thr = new HandlerThread("SystemUI UsbStorageActivity");
@Override
protected void onPause() {
super.onPause();
-
+
unregisterReceiver(mUsbStateReceiver);
if (mStorageManager == null && mStorageListener != null) {
mStorageManager.unregisterListener(mStorageListener);
// will be hidden once USB mass storage kicks in (or fails)
}
});
-
+
// things to do elsewhere
mAsyncStorageHandler.post(new Runnable() {
@Override