diff options
author | Jorge Ruesga <jorge@ruesga.com> | 2015-08-15 14:31:46 +0200 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-08-31 16:41:09 -0700 |
commit | 95dadd837cbcfaed73137919373871b3560967ad (patch) | |
tree | 3241d31d20ff9e5225a4b16cd87cef3e3bdb8067 /src/java/cyanogenmod/app | |
parent | 0eb2999091c19e8c9b9d9a33c96e33776b69121f (diff) | |
download | vendor_cmsdk-95dadd837cbcfaed73137919373871b3560967ad.zip vendor_cmsdk-95dadd837cbcfaed73137919373871b3560967ad.tar.gz vendor_cmsdk-95dadd837cbcfaed73137919373871b3560967ad.tar.bz2 |
cmsdk: allow custom tiles to set the new qstile's sensitive data flag
Requires: topic:hide-qs-tiles
Change-Id: I71c85a00ae5797f1e142073b4d6a3a4c3274007b
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src/java/cyanogenmod/app')
-rw-r--r-- | src/java/cyanogenmod/app/CustomTile.java | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/java/cyanogenmod/app/CustomTile.java b/src/java/cyanogenmod/app/CustomTile.java index 7e57fd8..4ab71c1 100644 --- a/src/java/cyanogenmod/app/CustomTile.java +++ b/src/java/cyanogenmod/app/CustomTile.java @@ -109,6 +109,13 @@ public class CustomTile implements Parcelable { public boolean collapsePanel = true; /** + * Indicates whether this tile has sensitive data that have to be hidden on + * secure lockscreens. + * By default {@link #sensitiveData} is false + */ + public boolean sensitiveData = false; + + /** * Unflatten the CustomTile from a parcel. */ public CustomTile(Parcel parcel) { @@ -152,6 +159,7 @@ public class CustomTile implements Parcelable { if (parcel.readInt() != 0) { this.deleteIntent = PendingIntent.CREATOR.createFromParcel(parcel); } + this.sensitiveData = (parcel.readInt() == 1); } parcel.setDataPosition(startPosition + parcelableSize); @@ -210,6 +218,7 @@ public class CustomTile implements Parcelable { if (deleteIntent != null) { b.append("deleteIntent=" + deleteIntent.toString() + NEW_LINE); } + b.append("sensitiveData=" + sensitiveData + NEW_LINE); return b.toString(); } @@ -229,6 +238,7 @@ public class CustomTile implements Parcelable { that.collapsePanel = this.collapsePanel; that.remoteIcon = this.remoteIcon; that.deleteIntent = this.deleteIntent; + that.sensitiveData = this.sensitiveData; } @Override @@ -290,20 +300,19 @@ public class CustomTile implements Parcelable { // ==== BOYSENBERRY ===== out.writeString(resourcesPackageName); out.writeInt(collapsePanel ? 1 : 0); - if (remoteIcon != null) { out.writeInt(1); remoteIcon.writeToParcel(out, 0); } else { out.writeInt(0); } - if (deleteIntent != null) { out.writeInt(1); deleteIntent.writeToParcel(out, 0); } else { out.writeInt(0); } + out.writeInt(sensitiveData ? 1 : 0); // Go back and write size int parcelableSize = out.dataPosition() - startPosition; @@ -908,6 +917,7 @@ public class CustomTile implements Parcelable { private ExpandedStyle mExpandedStyle; private boolean mCollapsePanel = true; private PendingIntent mDeleteIntent; + private boolean mSensitiveData = false; /** * Constructs a new Builder with the defaults: @@ -1052,6 +1062,17 @@ public class CustomTile implements Parcelable { } /** + * Indicates whether this tile has sensitive data that have to be hidden + * on secure lockscreens. + * @param bool + * @return {@link cyanogenmod.app.CustomTile.Builder} + */ + public Builder hasSensitiveData(boolean bool) { + mSensitiveData = bool; + return this; + } + + /** * Create a {@link cyanogenmod.app.CustomTile} object * @return {@link cyanogenmod.app.CustomTile} */ @@ -1068,6 +1089,7 @@ public class CustomTile implements Parcelable { tile.collapsePanel = mCollapsePanel; tile.remoteIcon = mRemoteIcon; tile.deleteIntent = mDeleteIntent; + tile.sensitiveData = mSensitiveData; return tile; } } |