Skip to content

Commit

Permalink
Headsup: squashed update (1/2)
Browse files Browse the repository at this point in the history
- Patch SlimRoms#1: Remove Slim HeadsUp customizations

  **Patchset by @CPA-Poke <brock.shahan@cox.net> **

- Patch SlimRoms#2: HeadsUp Options (1/2)

  ** Patchset by @LinuxXxxX <io.nolinuxnoparty@gmail.com> **

  * Includes:
     * Base: forward port Headsup options (1/2)
     * Global on/off
     * Blacklist and Do not disturb
     * HeadsUp: fix settings not being applied after reboot
     * blacklist and dnd setting were not being applied at boot
     * clean up the SettingsObserver
     * Let user choose if headsup swype action hides or dimisses notification

- Patch SlimRoms#3: Frameworks: Actually start to use HEADS_UP_REQUESTED extra

  ** Patchset by @kufikugel **

- Patch SlimRoms#4: HeadsUp: add timeout option (1/2)

  ** Patchset by @kufikugel **

- Patch SlimRoms#5: HeadsUp: check if headsup is attached and not null when adding view

  ** Patchset by @bigbrother1984 <carlosavignano@aospa.co> **

- Patch SlimRoms#6: [Heads up swipe] Disable by default

  ** Patchset by @cristianomatos <cristianobmatos@gmail.com> **

- Patch SlimRoms#7: [Heads up] Add touch outside event

  ** Patchset by @bigbrother1984 <carlosavignano@aospa.co> **

- Patch SlimRoms#8: [Heads up] Touch outside to hide (1/2)

  ** Patchset by @cristianomatos <cristianobmatos@gmail.com> **

- Patch SlimRoms#9: HeadsUp: fix headsup for incoming calls

  ** Patchset by @Altaf-Mahdi **

- Patch SlimRoms#10: [Heads up] Don't show heads up while IME is showing

  ** Patchset by @bigbrother1984 <carlosavignano@aospa.co> **

- Patch SlimRoms#11: HeadsUp: Don't reset Y coordinate and improve edge
  swipe readability

  ** Patchset by @bigbrother1984 <carlosavignano@aospa.co> **

- Patch SlimRoms#12: Fix heads up dismiss not working

  ** Patchset by @cristianomatos <cristianobmatos@gmail.com> **

Change-Id: Id0e903d1f8c3040d0724dc59568332e99f346b84

Conflicts:
	core/java/android/provider/Settings.java
	core/java/com/android/internal/statusbar/IStatusBar.aidl
	core/java/com/android/internal/statusbar/IStatusBarService.aidl
	core/res/res/values/liquid_strings.xml
	packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
	packages/SystemUI/AndroidManifest.xml
	packages/SystemUI/res/layout/notification_guts.xml
	packages/SystemUI/res/values/config.xml
	packages/SystemUI/res/values/liquid_strings.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	services/core/java/com/android/server/am/ActivityStackSupervisor.java
	services/core/java/com/android/server/statusbar/StatusBarManagerService.java

Conflicts:
	packages/SystemUI/res/values/config.xml
	services/core/java/com/android/server/am/ActivityStackSupervisor.java
  • Loading branch information
letmedanz committed Mar 14, 2015
1 parent 2cd6218 commit 5677669
Show file tree
Hide file tree
Showing 35 changed files with 427 additions and 693 deletions.
3 changes: 0 additions & 3 deletions core/java/android/app/INotificationManager.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ interface INotificationManager
void setShowNotificationForPackageOnKeyguard(String pkg, int uid, int status);
int getShowNotificationForPackageOnKeyguard(String pkg, int uid);

void setHeadsUpNotificationsEnabledForPackage(String pkg, int uid, int headsUp);
int getHeadsUpNotificationsEnabledForPackage(String pkg, int uid);

// TODO: Remove this when callers have been migrated to the equivalent
// INotificationListener method.
StatusBarNotification[] getActiveNotifications(String callingPkg);
Expand Down
25 changes: 1 addition & 24 deletions core/java/android/app/NotificationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,34 +271,11 @@ public boolean matchesCallFilter(Bundle extras) {
public int getShowNotificationForPackageOnKeyguard(String pkg, int uid) {
INotificationManager service = getService();
try {
return service.getShowNotificationForPackageOnKeyguard(pkg, uid);
return getService().getShowNotificationForPackageOnKeyguard(pkg, uid);
} catch (RemoteException e) {
return Notification.SHOW_ALL_NOTI_ON_KEYGUARD;
}
}

/**
* @hide
*/
public int getHeadsUpNotificationsEnabledForPackage(String pkg, int uid) {
INotificationManager service = getService();
try {
return service.getHeadsUpNotificationsEnabledForPackage(pkg, uid);
} catch (RemoteException e) {
return Notification.HEADS_UP_NEVER;
}
}

/**
* @hide
*/
public void setHeadsUpNotificationsEnabledForPackage(String pkg, int uid, int headsUp) {
INotificationManager service = getService();
try {
service.setHeadsUpNotificationsEnabledForPackage(pkg, uid, headsUp);
} catch (RemoteException e) {
}
}

private Context mContext;
}
58 changes: 42 additions & 16 deletions core/java/android/provider/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -2189,20 +2189,6 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
public static final String LOCKSCREEN_SHORTCUTS_LONGPRESS =
"lockscreen_shortcuts_longpress";

/**
* Defines global heads up snooze time if user want to snooze it.
*
* @hide
*/
public static final String HEADS_UP_SNOOZE_TIME = "heads_up_snooze_time";

/**
* Defines the global heads up notification decay
*
* @hide
*/
public static final String HEADS_UP_NOTIFCATION_DECAY = "heads_up_notification_decay";

/**
* Timeout for ambient display notification
* @hide
Expand Down Expand Up @@ -2993,6 +2979,18 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
*/
public static final String SIP_CALL_OPTIONS = "sip_call_options";

/**
* Hide notification instead of remove when swiping headsup
* @hide
*/
public static final String HEADS_UP_DISMISS_ON_REMOVE = "heads_up_dismiss_on_remove";

/**
* Hide notification 1 second after touching outside
* @hide
*/
public static final String HEADS_UP_TOUCH_OUTSIDE = "heads_up_touch_outside";

/**
* One of the sip call options: Always use SIP with network access.
* @hide
Expand Down Expand Up @@ -3507,8 +3505,36 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
public static final String ANIMATION_CONTROLS_DURATION = "animation_controls_duration";
public static final String ANIMATION_CONTROLS_EXIT_ONLY = "animation_controls_exit_only";
public static final String ANIMATION_CONTROLS_REVERSE_EXIT = "animation_controls_reverse_exit";

/**

/**
* Heads Up Notifications
*
* @hide
*/
public static final String HEADS_UP_NOTIFICATION = "heads_up_enabled";

/**
* Which applications to disable heads up notifications for
*
* @hide
*/
public static final String HEADS_UP_CUSTOM_VALUES = "heads_up_custom_values";

/**
* Which applications to disable heads up notifications for
*
* @hide
*/
public static final String HEADS_UP_BLACKLIST_VALUES = "heads_up_blacklist_values";

/**
* Defines the global heads up notification decay
*
* @hide
*/
public static final String HEADS_UP_NOTIFCATION_DECAY = "heads_up_notification_decay";

/**
* Settings to backup. This is here so that it's in the same place as the settings
* keys and easy to update.
*
Expand Down
11 changes: 11 additions & 0 deletions core/java/android/view/inputmethod/InputMethodManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,17 @@ static void scheduleCheckFocusLocked(View view) {
}
}

/**
* @hide
*/
public boolean isImeShowing() {
try {
return mService.isImeShowing();
} catch (RemoteException e) {
return false;
}
}

/**
* @hide
*/
Expand Down
55 changes: 0 additions & 55 deletions core/java/android/widget/RemoteViews.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.StrictMode;
import android.os.UserHandle;
import android.text.TextUtils;
Expand All @@ -53,8 +51,6 @@
import android.view.ViewGroup;
import android.widget.AdapterView.OnItemClickListener;

import com.android.internal.statusbar.IStatusBarService;

import libcore.util.Objects;

import java.lang.annotation.ElementType;
Expand Down Expand Up @@ -666,13 +662,6 @@ private class SetOnClickPendingIntent extends Action {
public SetOnClickPendingIntent(int id, PendingIntent pendingIntent) {
this.viewId = id;
this.pendingIntent = pendingIntent;
this.clearHeadsUp = false;
}

public SetOnClickPendingIntent(int id, PendingIntent pendingIntent, boolean clearHeadsUp) {
this.viewId = id;
this.pendingIntent = pendingIntent;
this.clearHeadsUp = clearHeadsUp;
}

public SetOnClickPendingIntent(Parcel parcel) {
Expand All @@ -682,8 +671,6 @@ public SetOnClickPendingIntent(Parcel parcel) {
if (parcel.readInt() != 0) {
pendingIntent = PendingIntent.readPendingIntentOrNullFromParcel(parcel);
}
// Read possible clearHeadsUp state from parcel
clearHeadsUp = parcel.readInt() != 0;
}

public void writeToParcel(Parcel dest, int flags) {
Expand All @@ -695,8 +682,6 @@ public void writeToParcel(Parcel dest, int flags) {
if (pendingIntent != null) {
pendingIntent.writeToParcel(dest, 0 /* no flags */);
}
// Write possible clearHeadsUp state to parcel
dest.writeInt(clearHeadsUp ? 1 : 0);
}

@Override
Expand Down Expand Up @@ -724,24 +709,6 @@ public void apply(View root, ViewGroup rootParent, final OnClickHandler handler)
if (pendingIntent != null) {
listener = new OnClickListener() {
public void onClick(View v) {
// If clearHeadsUp == true we know that we are a notification button.
// A lot apps do not directly dismiss the notification
// if the user pressed an action button. This is ok for normal
// notifications. But with heads up the notficiation stays and
// disturbes the workflow for the user. So we hide the heads up view, push
// the notification into background and let the app handle everything else.
if (clearHeadsUp) {
final IStatusBarService barService =
IStatusBarService.Stub.asInterface(
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
try {
if (barService != null) {
barService.scheduleHeadsUpClose();
}
} catch (RemoteException e) {
// Ooops that should never happen.
}
}
// Find target view location in screen coordinates and
// fill into PendingIntent before sending.
final Rect rect = getSourceBounds(v);
Expand All @@ -760,7 +727,6 @@ public String getActionName() {
}

PendingIntent pendingIntent;
boolean clearHeadsUp;

public final static int TAG = 1;
}
Expand Down Expand Up @@ -2170,27 +2136,6 @@ public void setOnClickPendingIntent(int viewId, PendingIntent pendingIntent) {
addAction(new SetOnClickPendingIntent(viewId, pendingIntent));
}

/**
* Equivalent to calling
* {@link android.view.View#setOnClickListener(android.view.View.OnClickListener)}
* to launch the provided {@link PendingIntent}.
*
* This method is only called by notifications when adding an action button
* {@link android.app.Notification}
*
* @param viewId The id of the view that will trigger the {@link PendingIntent} when clicked
* @param pendingIntent The {@link PendingIntent} to send when user clicks
* @param whether notification is tombstone, but mainly used to indicate that the new
* SetOnClickPendingIntent knows that a notification is calling.
*
* @hide
*/
public void setOnClickPendingIntent(int viewId,
PendingIntent pendingIntent, boolean tombstone) {
if (tombstone) return;
addAction(new SetOnClickPendingIntent(viewId, pendingIntent, true));
}

/**
* When using collections (eg. {@link ListView}, {@link StackView} etc.) in widgets, it is very
* costly to set PendingIntents on the individual items, and is hence not permitted. Instead
Expand Down
4 changes: 1 addition & 3 deletions core/java/com/android/internal/statusbar/IStatusBar.aidl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* Copyright (c) 2007, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -46,8 +46,6 @@ oneway interface IStatusBar
void cancelPreloadRecentApps();
void setAutoRotate(boolean enabled);
void showCustomIntentAfterKeyguard(inout Intent intent);
void hideHeadsUpCandidate(String packageName);
void scheduleHeadsUpClose();
void toggleScreenshot();
void toggleLastApp();
void toggleKillApp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ interface IStatusBarService
void cancelPreloadRecentApps();
void setAutoRotate(boolean enabled);
void showCustomIntentAfterKeyguard(inout Intent intent);
void hideHeadsUpCandidate(String packageName);
void scheduleHeadsUpClose();
void toggleScreenshot();
void toggleLastApp();
void toggleKillApp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,5 @@ interface IInputMethodManager {
void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes);
int getInputMethodWindowVisibleHeight();
oneway void notifyUserAction(int sequenceNumber);
boolean isImeShowing();
}
8 changes: 0 additions & 8 deletions core/res/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2317,14 +2317,6 @@
android:description="@string/permdesc_changeComponentState"
android:protectionLevel="signature|system" />

<!-- @hide Allows an application to change heads up state only with correct signature.
Maybe overkill...but we do not want to allow whatever third party app
without permission to confuse the user. -->
<permission android:name="android.permission.CHANGE_HEADS_UP_STATE"
android:label="@string/permlab_changeHeadsUpState"
android:description="@string/permdesc_changeHeadsUpState"
android:protectionLevel="signature|system" />

<!-- @hide Allows an application to grant or revoke specific permissions. -->
<permission android:name="android.permission.GRANT_REVOKE_PERMISSIONS"
android:label="@string/permlab_grantRevokePermissions"
Expand Down
7 changes: 4 additions & 3 deletions core/res/res/values/slim_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@
<!-- In WiFi AP notification -->
<string name="notify_turn_wifi_ap_off_title">Turn Wi-Fi AP off</string>

<!-- Heads up -->
<string name="permlab_changeHeadsUpState">enable or disable heads up</string>
<string name="permdesc_changeHeadsUpState">Allows the application to change whether another application is allowed to show normal notifications as heads up notification.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_accessTorchService">access torch service</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_accessTorchService">Allows an app to access the torch service. Should never be needed for normal apps.</string>

</resources>
6 changes: 6 additions & 0 deletions packages/SettingsProvider/res/values/defaults.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@
<!-- Default for Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED, 1==on -->
<integer name="def_heads_up_enabled">1</integer>

<!-- Default DnD values of Settings.System.HEADS_UP_NOTIFICATION -->
<string name="def_heads_up_notification_dnd_values"></string>

<!-- Default Blacklist values of Settings.System.HEADS_UP_NOTIFICATION -->
<string name="def_heads_up_notification_blacklist_values"></string>

<!-- Default for Settings.Global.DEVICE_NAME $1=MANUFACTURER $2=MODEL-->
<string name="def_device_name">%1$s %2$s</string>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2273,6 +2273,18 @@ private void loadVibrateWhenRingingSetting(SQLiteDatabase db) {
}
}

private void loadHeadsUpSetting(SQLiteStatement stmt) {
String dndValues = mContext.getResources()
.getString(R.string.def_heads_up_notification_dnd_values);
String blackListValues = mContext.getResources()
.getString(R.string.def_heads_up_notification_blacklist_values);
if (!TextUtils.isEmpty(dndValues)) {
loadSetting(stmt, Settings.System.HEADS_UP_NOTIFICATION, "0");
loadSetting(stmt, Settings.System.HEADS_UP_CUSTOM_VALUES, dndValues);
loadSetting(stmt, Settings.System.HEADS_UP_BLACKLIST_VALUES, blackListValues);
}
}

private void loadSettings(SQLiteDatabase db) {
loadSystemSettings(db);
loadSecureSettings(db);
Expand Down
3 changes: 0 additions & 3 deletions packages/SystemUI/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@
<!-- Screen Capturing -->
<uses-permission android:name="android.permission.MANAGE_MEDIA_PROJECTION" />

<!-- Heads up -->
<uses-permission android:name="android.permission.CHANGE_HEADS_UP_STATE" />

<!-- Visualizer tile -->
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
Expand Down
Binary file removed packages/SystemUI/res/drawable-hdpi/ic_heads_up.png
Binary file not shown.
Binary file removed packages/SystemUI/res/drawable-mdpi/ic_heads_up.png
Binary file not shown.
Binary file removed packages/SystemUI/res/drawable-xhdpi/ic_heads_up.png
Binary file not shown.
Binary file removed packages/SystemUI/res/drawable-xxhdpi/ic_heads_up.png
Binary file not shown.
24 changes: 0 additions & 24 deletions packages/SystemUI/res/drawable/ic_heads_up_snooze.xml

This file was deleted.

Loading

0 comments on commit 5677669

Please sign in to comment.