Skip to content

Commit

Permalink
4.4 implementation of active display
Browse files Browse the repository at this point in the history
Change-Id: I08330a28d0880f82c09ccaec7e36844d9e6570d5

Conflicts:
	core/java/android/app/INotificationManager.aidl
	core/res/AndroidManifest.xml
	packages/SystemUI/AndroidManifest.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	services/java/com/android/server/NotificationManagerService.java

Conflicts:
	core/java/android/app/INotificationManager.aidl
	core/java/android/provider/Settings.java
	core/res/res/values/slim_symbols.xml
	packages/SystemUI/AndroidManifest.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	services/java/com/android/server/NotificationManagerService.java
  • Loading branch information
0xD34D authored and cannondalev2000 committed Mar 16, 2014
1 parent f3af886 commit dc8606b
Show file tree
Hide file tree
Showing 57 changed files with 2,523 additions and 2 deletions.
4 changes: 3 additions & 1 deletion core/java/android/app/INotificationManager.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ interface INotificationManager
void cancelAllNotificationsFromListener(in INotificationListener token);

StatusBarNotification[] getActiveNotificationsFromListener(in INotificationListener token);
}
StatusBarNotification[] getActiveNotificationsFromSystemListener(in INotificationListener token);
void cancelNotificationFromSystemListener(in INotificationListener token, String pkg, String tag, int id);
}
150 changes: 150 additions & 0 deletions core/java/android/provider/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -3697,6 +3697,156 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
*/
public static final String LISTVIEW_ANIMATION = "listview_animation";

<<<<<<< HEAD
=======
/**
* HALO, should default to 0 (no, do not show)
* @hide
*/
public static final String HALO_ACTIVE = "halo_active";

/**
* HALO reversed?, should default to 1 (yes, reverse)
* @hide
*/
public static final String HALO_REVERSED = "halo_reversed";

/**
* HALO hide?, should default to 0 (no, do not hide)
* @hide
*/
public static final String HALO_HIDE = "halo_hide";

/**
* HALO pause activities?, defaults to 0 (no, do not pause) on devices which isLargeRAM() == true
* otherwise it defaults to 1 (yes, do pause)
* @hide
*/
public static final String HALO_PAUSE = "halo_pause";

/**
* HALO size fraction, default is 1.0f (normal)
* @hide
*/
public static final String HALO_SIZE = "halo_size";

/**
* HALO ninja?, should default to 0 (no, do not disappear when empty)
* @hide
*/
public static final String HALO_NINJA = "halo_ninja";

/**
* HALO message box?, should default to 1 (yes, show message box on incoming notification)
* @hide
*/
public static final String HALO_MSGBOX = "halo_msgbox";

/**
* HALO notificatoin count?, should default to 4 (both)
* @hide
*/
public static final String HALO_NOTIFY_COUNT = "halo_notify_count";

/**
* HALO message box animation?, should default to 2 (flip animation)
* @hide
*/
public static final String HALO_MSGBOX_ANIMATION = "halo_msgbox_animation";

/**
* HALO unlock ping?, should default to 0 (no, do not ping on unlock)
* @hide
*/
public static final String HALO_UNLOCK_PING = "halo_unlock_ping";

/**
* Whether to display notifications on screen when screen is off
* @hide
*/
public static final String ENABLE_ACTIVE_DISPLAY = "enable_active_display";

/**
* Whether to display notification messages around ring
* @hide
*/
public static final String ACTIVE_DISPLAY_TEXT = "active_display_text";

/**
* Time to redisplay notifications on screen from when screen turns off, 0 = never redisplay
* @hide
*/
public static final String ACTIVE_DISPLAY_REDISPLAY = "active_display_redisplay";

/**
* Brightness of the display when displaying the active display view
* @hide
*/
public static final String ACTIVE_DISPLAY_BRIGHTNESS = "active_display_brightness";

/**
* Display active display view when device comes out of the user's pocket, etc...
* @hide
*/
public static final String ACTIVE_DISPLAY_POCKET_MODE = "active_display_pocket_mode";

/**
* Whether to include ongoing/non-clearable notifications
* @hide
*/
public static final String ACTIVE_DISPLAY_ALL_NOTIFICATIONS = "active_display_all_notifications";

/**
* Whether to hide low priority notifications like those from google now
* @hide
*/
public static final String ACTIVE_DISPLAY_HIDE_LOW_PRIORITY_NOTIFICATIONS =
"active_display_hide_low_priority_notifications";

/**
* Whether to display AM/PM after time when in 12h format
* @hide
*/
public static final String ACTIVE_DISPLAY_SHOW_AMPM = "active_display_show_ampm";

/**
* Whether to display the date above the time
* @hide
*/
public static final String ACTIVE_DISPLAY_SHOW_DATE = "active_display_show_date";

/**
* Whether to invert the colors when in bright light
* @hide
*/
public static final String ACTIVE_DISPLAY_SUNLIGHT_MODE = "active_display_sunlight_mode";

/**
* Whether to turn off the device when gets pocketed again and was waked up by active display
* @hide
*/
public static final String ACTIVE_DISPLAY_TURNOFF_MODE = "active_display_turnoff_mode";

/**
* Threshold of the proximity sensor to turn on the device.
* @hide
*/
public static final String ACTIVE_DISPLAY_THRESHOLD = "active_display_threshold";

/**
* Timeout of the display when there is no user interaction
* @hide
*/
public static final String ACTIVE_DISPLAY_TIMEOUT = "active_display_timeout";

/**
* A list of packages to exclude from being displayed in active display.
* This should be a string of packages separated by |
* @hide
*/
public static final String ACTIVE_DISPLAY_EXCLUDED_APPS = "active_display_excluded_apps";

>>>>>>> 624757b... 4.4 implementation of active display
/**
* ListView Interpolators
* 0 == None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Path;
import android.graphics.RectF;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.Vibrator;
import android.provider.Settings;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
Expand All @@ -49,6 +54,7 @@
import com.android.internal.R;
import com.android.internal.util.slim.ImageHelper;

import java.lang.Math;
import java.util.ArrayList;

/**
Expand Down Expand Up @@ -131,6 +137,8 @@ public interface OnTriggerListener {
private static final float TARGET_SCALE_COLLAPSED = 0.8f;
private static final float RING_SCALE_EXPANDED = 1.0f;
private static final float RING_SCALE_COLLAPSED = 0.5f;
private static final float HANDLE_TEXT_RADIUS = 120f;
private static final float MAX_TEXT_ARC_RADIANS = (float) (270.0 / 170.0 * Math.PI);

private ArrayList<TargetDrawable> mTargetDrawables = new ArrayList<TargetDrawable>();
private AnimationBundle mWaveAnimations = new AnimationBundle();
Expand All @@ -156,6 +164,12 @@ public interface OnTriggerListener {
private int mMaxTargetWidth;
private float mRingScaleFactor = 1f;
private boolean mAllowScaling;
private boolean mDrawOuterRing = true;

private Paint mPaintText;
private String mHandleText = "";
private int mTextRadius;
private float mMaxTextArcLength;

private float mOuterRadius = 0.0f;
private float mSnapMargin = 0.0f;
Expand All @@ -165,6 +179,10 @@ public interface OnTriggerListener {
private int mNewTargetResources;
private ArrayList<TargetDrawable> mNewTargetDrawables;

private Paint mArcPaint;
private RectF mArcRect;
private float mArcAngle = 0f;

private class AnimationBundle extends ArrayList<Tweener> {
private static final long serialVersionUID = 0xA84D78726F127468L;
private boolean mSuspended;
Expand Down Expand Up @@ -320,6 +338,24 @@ public GlowPadView(Context context, AttributeSet attrs) {
mPointCloud = new PointCloud(mPointDrawable);
mPointCloud.makePointCloud(mInnerRadius, mOuterRadius);
mPointCloud.glowManager.setRadius(mGlowRadius);

mArcPaint = new Paint();
mArcPaint.setStrokeWidth(10.0f);
mArcPaint.setStyle(Paint.Style.STROKE);
mArcRect = new RectF(mHandleDrawable.getPositionX() - mHandleDrawable.getWidth()/2,
mHandleDrawable.getPositionY() - mHandleDrawable.getHeight()/2,
mHandleDrawable.getPositionX() + mHandleDrawable.getWidth()/2,
mHandleDrawable.getPositionY() + mHandleDrawable.getHeight()/2);

mPaintText = new Paint();
mPaintText.setAntiAlias(true);
mPaintText.setColor(res.getColor(android.R.color.white));
mPaintText.setTextAlign(Align.CENTER);
mPaintText.setStyle(Paint.Style.FILL_AND_STROKE);
mPaintText.setFakeBoldText(true);
mPaintText.setTextSize(res.getDimensionPixelSize(R.dimen.glowpad_notification_font_size));
mTextRadius = res.getDimensionPixelSize(R.dimen.glowpad_notification_text_radius);
mMaxTextArcLength = mTextRadius * MAX_TEXT_ARC_RADIANS;
}

private int getResourceId(TypedArray a, int id) {
Expand Down Expand Up @@ -408,13 +444,15 @@ private void switchToState(int state, float x, float y) {
startBackgroundAnimation(0, 0.0f);
mHandleDrawable.setState(TargetDrawable.STATE_INACTIVE);
mHandleDrawable.setAlpha(1.0f);
mPaintText.setAlpha(255);
break;

case STATE_START:
startBackgroundAnimation(0, 0.0f);
break;

case STATE_FIRST_TOUCH:
mPaintText.setAlpha(0);
mHandleDrawable.setAlpha(0.0f);
deactivateTargets();
showTargets(true);
Expand All @@ -426,12 +464,14 @@ private void switchToState(int state, float x, float y) {
break;

case STATE_TRACKING:
mPaintText.setAlpha(0);
mHandleDrawable.setAlpha(0.0f);
showGlow(REVEAL_GLOW_DURATION , REVEAL_GLOW_DELAY, 1.0f, null);
break;

case STATE_SNAP:
// TODO: Add transition states (see list_selector_background_transition.xml)
mPaintText.setAlpha(0);
mHandleDrawable.setAlpha(0.0f);
showGlow(REVEAL_GLOW_DURATION , REVEAL_GLOW_DELAY, 0.0f, null);
break;
Expand Down Expand Up @@ -1338,7 +1378,7 @@ private void updatePointCloudPosition(float centerX, float centerY) {
@Override
protected void onDraw(Canvas canvas) {
mPointCloud.draw(canvas);
mOuterRing.draw(canvas);
if (mDrawOuterRing) mOuterRing.draw(canvas);
final int ntargets = mTargetDrawables.size();
for (int i = 0; i < ntargets; i++) {
TargetDrawable target = mTargetDrawables.get(i);
Expand All @@ -1347,6 +1387,41 @@ protected void onDraw(Canvas canvas) {
}
}
mHandleDrawable.draw(canvas);

if (mArcAngle > 0 && mHandleDrawable.getAlpha() > 0) {
mArcRect.set(mHandleDrawable.getPositionX() - mHandleDrawable.getWidth()/3,
mHandleDrawable.getPositionY() - mHandleDrawable.getHeight()/3,
mHandleDrawable.getPositionX() + mHandleDrawable.getWidth()/3,
mHandleDrawable.getPositionY() + mHandleDrawable.getHeight()/3);

canvas.drawArc(mArcRect, -90, mArcAngle, false, mArcPaint);
}
if (!TextUtils.isEmpty(mHandleText) && mPaintText.getAlpha() != 0) {
float x = mHandleDrawable.getPositionX();
float y = mHandleDrawable.getPositionY();
Path circle = new Path();
circle.addCircle(x, y, mTextRadius, Path.Direction.CW);
canvas.rotate(90f, x, y);
canvas.drawTextOnPath(mHandleText, circle, 0, 0, mPaintText);
}
}

public void setHandleDrawable(TargetDrawable d) {
float x = mHandleDrawable.getPositionX();
float y = mHandleDrawable.getPositionY();
mHandleDrawable = new TargetDrawable(d);
mHandleDrawable.setPositionX(x);
mHandleDrawable.setPositionY(y);
}

public void setHandleText(String text) {
mHandleText = TextUtils.ellipsize(
text, new TextPaint(mPaintText), mMaxTextArcLength,
TextUtils.TruncateAt.END).toString();
}

public void setDrawOuterRing(boolean drawOuterRing) {
mDrawOuterRing = drawOuterRing;
}

public void setOnTriggerListener(OnTriggerListener listener) {
Expand Down
6 changes: 6 additions & 0 deletions core/res/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2389,6 +2389,12 @@
android:description="@string/permlab_copyProtectedData"
android:protectionLevel="signature" />

<!-- Internal permission protecting access to internal notification listener
@hide
-->
<permission android:name="android.permission.SYSTEM_NOTIFICATION_LISTENER"
android:protectionLevel="signature|system" />

<!-- Internal permission protecting access to the encryption methods
@hide
-->
Expand Down
13 changes: 13 additions & 0 deletions core/res/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -368,4 +368,17 @@

<!-- EdgeGesture service: Thickness of the active trigger fields around the screen border -->
<dimen name="edge_gesture_trigger_thickness">15dp</dimen>

<!-- Lockscreen target insets -->
<item type="dimen" name="lockscreen_target_inset">30dp</item>

<!-- Font size for notification text -->
<dimen name="glowpad_notification_font_size">12dp</dimen>

<!-- Radius of notification text -->
<dimen name="glowpad_notification_text_radius">60dp</dimen>

<!-- Top margin for overflow notifications shown in the active display view -->
<dimen name="glowpad_overflow_notifications_margin_top">48dp</dimen>

</resources>
10 changes: 10 additions & 0 deletions core/res/res/values/slim_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,14 @@
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_preventpower">Allows an application to override the power key</string>

<!-- Title of an application permission that lets an application view/edit revoked permissions. -->
<string name="permlab_revokePermissions">Allows view and edit of revoked permissions. Not for use by normal applications.</string>
<!-- Description of an application permission that lets lets an application view/edit revoked permissions. -->
<string name="permdesc_revokePermissions">Allows read and write for revoked permissions. Not for use by normal applications.</string>

<!-- Title of an application permission that lets an application access the ThemeManagerService. -->
<string name="permlab_accessThemeService">Allows accessing the theme manager service. Not for use by normal applications.</string>
<!-- Description of an application permission that lets lets an application access the ThemeManagerService -->
<string name="permdesc_accessThemeService">Allows an application to set/reset themes. Not for use by normal applications.</string>

</resources>

0 comments on commit dc8606b

Please sign in to comment.