Skip to content

Commit 4ebcdfd

Browse files
committed
Implement final lock now affordance
Also removes the GlobalAction. Also fixes the animation not being applied to the background of the affordance. Bug: 15344542 Bug: 16952834 Change-Id: Ie790b40a5d1ba10fa42a793c8cfeaf6687d17c61
1 parent 70236bf commit 4ebcdfd

File tree

6 files changed

+23
-8
lines changed

6 files changed

+23
-8
lines changed

core/res/res/values/config.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,6 @@
15901590
-->
15911591
<string-array translatable="false" name="config_globalActionsList">
15921592
<item>power</item>
1593-
<item>lockdown</item>
15941593
<item>bugreport</item>
15951594
<item>users</item>
15961595
</string-array>

packages/SystemUI/res/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,4 +782,7 @@
782782
<!-- Monitoring dialog legacy VPN with device owner text [CHAR LIMIT=300] -->
783783
<string name="monitoring_description_legacy_vpn_device_owned">This device is managed by:\n<xliff:g id="organization">%1$s</xliff:g>\n\nYour administrator is capable of monitoring your network activity including emails, apps, and secure websites. For more information, contact your administrator.\n\nAlso, you\'re connected to a VPN (\"<xliff:g id="application">%2$s</xliff:g>\"). Your VPN service provider can monitor network activity too.</string>
784784

785+
<!-- Indication on the keyguard that appears when the user disables trust agents until the next time they unlock manually. [CHAR LIMIT=NONE] -->
786+
<string name="keyguard_indication_trust_disabled">Device will stay locked until you manually unlock</string>
787+
785788
</resources>

packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,9 @@ public void setImageAlpha(float alpha, boolean animate, long duration,
401401
Interpolator interpolator, Runnable runnable) {
402402
cancelAnimator(mAlphaAnimator);
403403
int endAlpha = (int) (alpha * 255);
404+
final Drawable background = getBackground();
404405
if (!animate) {
406+
if (background != null) background.mutate().setAlpha(endAlpha);
405407
setImageAlpha(endAlpha);
406408
} else {
407409
int currentAlpha = getImageAlpha();
@@ -410,7 +412,9 @@ public void setImageAlpha(float alpha, boolean animate, long duration,
410412
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
411413
@Override
412414
public void onAnimationUpdate(ValueAnimator animation) {
413-
setImageAlpha((int) animation.getAnimatedValue());
415+
int alpha = (int) animation.getAnimatedValue();
416+
if (background != null) background.mutate().setAlpha(alpha);
417+
setImageAlpha(alpha);
414418
}
415419
});
416420
animator.addListener(mAlphaEndListener);

packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import com.android.keyguard.KeyguardUpdateMonitor;
3939
import com.android.keyguard.KeyguardUpdateMonitorCallback;
4040
import com.android.systemui.R;
41+
import com.android.systemui.statusbar.KeyguardIndicationController;
4142
import com.android.systemui.statusbar.policy.FlashlightController;
4243
import com.android.systemui.statusbar.KeyguardAffordanceView;
4344
import com.android.systemui.statusbar.policy.PreviewInflater;
@@ -72,6 +73,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
7273
private LockPatternUtils mLockPatternUtils;
7374
private FlashlightController mFlashlightController;
7475
private PreviewInflater mPreviewInflater;
76+
private KeyguardIndicationController mIndicationController;
7577
private boolean mFaceUnlockRunning;
7678

7779
public KeyguardBottomAreaView(Context context) {
@@ -111,6 +113,7 @@ protected void onFinishInflate() {
111113
setClipToPadding(false);
112114
mPreviewInflater = new PreviewInflater(mContext, new LockPatternUtils(mContext));
113115
inflatePreviews();
116+
mLockIcon.setOnClickListener(this);
114117
}
115118

116119
public void setActivityStarter(ActivityStarter activityStarter) {
@@ -204,6 +207,10 @@ public void onClick(View v) {
204207
launchCamera();
205208
} else if (v == mPhoneImageView) {
206209
launchPhone();
210+
} if (v == mLockIcon) {
211+
mIndicationController.showTransientIndication(
212+
R.string.keyguard_indication_trust_disabled);
213+
mLockPatternUtils.requireCredentialEntry(mLockPatternUtils.getCurrentUser());
207214
}
208215
}
209216

@@ -244,6 +251,7 @@ private void updateLockIcon() {
244251
boolean trustManaged = mUnlockMethodCache.isTrustManaged();
245252
mLockIcon.setBackgroundResource(trustManaged && !mFaceUnlockRunning
246253
? R.drawable.trust_circle : 0);
254+
mLockIcon.setClickable(trustManaged);
247255
}
248256

249257
public KeyguardAffordanceView getPhoneView() {
@@ -318,4 +326,9 @@ public void onFaceUnlockStateChanged(boolean running) {
318326
updateLockIcon();
319327
}
320328
};
329+
330+
public void setKeyguardIndicationController(
331+
KeyguardIndicationController keyguardIndicationController) {
332+
mIndicationController = keyguardIndicationController;
333+
}
321334
}

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ public void onClick(View v) {
721721
mKeyguardIndicationController = new KeyguardIndicationController(mContext,
722722
(KeyguardIndicationTextView) mStatusBarWindow.findViewById(
723723
R.id.keyguard_indication_text));
724+
mKeyguardBottomArea.setKeyguardIndicationController(mKeyguardIndicationController);
724725

725726
mTickerEnabled = res.getBoolean(R.bool.enable_ticker);
726727
if (mTickerEnabled) {

policy/src/com/android/internal/policy/impl/GlobalActions.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public boolean showBeforeProvisioning() {
283283
addUsersToMenu(mItems);
284284
} else if (GLOBAL_ACTION_KEY_SETTINGS.equals(actionKey)) {
285285
mItems.add(getSettingsAction());
286-
} else if (GLOBAL_ACTION_KEY_LOCKDOWN.equals(actionKey) && hasTrustAgents()) {
286+
} else if (GLOBAL_ACTION_KEY_LOCKDOWN.equals(actionKey)) {
287287
mItems.add(getLockdownAction());
288288
} else {
289289
Log.e(TAG, "Invalid global action key " + actionKey);
@@ -323,11 +323,6 @@ public boolean onItemLongClick(AdapterView<?> parent, View view, int position,
323323
return dialog;
324324
}
325325

326-
private boolean hasTrustAgents() {
327-
// TODO: Add implementation.
328-
return true;
329-
}
330-
331326
private final class PowerAction extends SinglePressAction implements LongPressAction {
332327
private PowerAction() {
333328
super(com.android.internal.R.drawable.ic_lock_power_off,

0 commit comments

Comments
 (0)