Loading packages/SystemUI/res/drawable/ic_wallet_lockscreen.xml 0 → 100644 +37 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* * Copyright 2021, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <group> <clip-path android:pathData="M2.15,1.54h20v21h-20z"/> <path android:pathData="M19,21.83H5.35a3.19,3.19 0,0 1,-3.2 -3.19v-7A3.19,3.19 0,0 1,5.35 8.5H19a3.19,3.19 0,0 1,3.19 3.19v7A3.19,3.19 0,0 1,19 21.83ZM5.35,10.44A1.25,1.25 0,0 0,4.1 11.69v7a1.25,1.25 0,0 0,1.25 1.24H19a1.25,1.25 0,0 0,1.25 -1.24v-7A1.25,1.25 0,0 0,19 10.44Z" android:fillColor="#FF000000" /> <path android:pathData="M4.7,10.16 L4.21,8.57 16,5a3.56,3.56 0,0 1,3.1 0.25c1,0.67 1.65,2 1.89,4l-1.66,0.2C19.12,8 18.72,7 18.15,6.62a2,2 0,0 0,-1.7 0Z" android:fillColor="#FF000000" /> <path android:pathData="M4.43,10.47l-1,-1.34 7.31,-5.44c3,-1.86 5.51,1 6.33,2L15.82,6.77c-2.1,-2.44 -3.23,-2.26 -4.14,-1.7Z" android:fillColor="#FF000000" /> </group> </vector> packages/SystemUI/res/drawable/wallet_lockscreen_bg.xml 0 → 100644 +33 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* * Copyright 2021, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" android:color="?android:attr/textColorPrimary"> <item> <shape android:shape="oval"> <solid android:color="?androidprv:attr/colorSurface"/> <size android:width="@dimen/keyguard_affordance_width" android:height="@dimen/keyguard_affordance_height"/> </shape> </item> </ripple> packages/SystemUI/res/layout/keyguard_bottom_area.xml +5 −3 Original line number Diff line number Diff line Loading @@ -90,9 +90,11 @@ android:layout_width="@dimen/keyguard_affordance_width" android:layout_gravity="bottom|end" android:scaleType="center" android:tint="?attr/wallpaperTextColor" android:layout_marginStart="24dp" android:layout_marginBottom="48dp" android:tint="?android:attr/textColorPrimary" android:src="@drawable/ic_wallet_lockscreen" android:background="@drawable/wallet_lockscreen_bg" android:layout_marginEnd="@dimen/keyguard_affordance_horizontal_offset" android:layout_marginBottom="@dimen/keyguard_affordance_vertical_offset" android:visibility="gone" /> <FrameLayout Loading packages/SystemUI/res/values/dimens.xml +6 −3 Original line number Diff line number Diff line Loading @@ -865,9 +865,12 @@ + 8dp. --> <dimen name="assist_orb_navbar_scrim_height">56dp</dimen> <!-- The width/height of the phone/camera icon view on keyguard. --> <dimen name="keyguard_affordance_height">56dp</dimen> <dimen name="keyguard_affordance_width">56dp</dimen> <!-- The width/height of the keyguard bottom area icon view on keyguard. --> <dimen name="keyguard_affordance_height">48dp</dimen> <dimen name="keyguard_affordance_width">48dp</dimen> <dimen name="keyguard_affordance_horizontal_offset">32dp</dimen> <dimen name="keyguard_affordance_vertical_offset">32dp</dimen> <!-- The width/height of the unlock icon view on keyguard. --> <dimen name="keyguard_lock_height">42dp</dimen> Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +73 −20 Original line number Diff line number Diff line Loading @@ -48,8 +48,11 @@ import android.os.Messenger; import android.os.RemoteException; import android.os.UserHandle; import android.provider.MediaStore; import android.provider.Settings; import android.service.media.CameraPrewarmService; import android.service.quickaccesswallet.GetWalletCardsError; import android.service.quickaccesswallet.GetWalletCardsRequest; import android.service.quickaccesswallet.GetWalletCardsResponse; import android.service.quickaccesswallet.QuickAccessWalletClient; import android.telecom.TelecomManager; import android.text.TextUtils; import android.util.AttributeSet; Loading @@ -64,6 +67,8 @@ import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; Loading @@ -75,6 +80,7 @@ import com.android.systemui.animation.Interpolators; import com.android.systemui.assist.AssistManager; import com.android.systemui.camera.CameraIntents; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.IntentButtonProvider; import com.android.systemui.plugins.IntentButtonProvider.IntentButton; import com.android.systemui.plugins.IntentButtonProvider.IntentButton.IconState; Loading @@ -87,6 +93,9 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.PreviewInflater; import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory; import com.android.systemui.tuner.TunerService; import com.android.systemui.wallet.ui.WalletActivity; import java.util.concurrent.Executor; /** * Implementation for the bottom area of the Keyguard, including camera/phone affordance and status Loading Loading @@ -121,7 +130,13 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private KeyguardAffordanceView mRightAffordanceView; private KeyguardAffordanceView mLeftAffordanceView; private ImageView mWalletButton; private boolean mWalletEnabled = false; private boolean mHasCard = false; private WalletCardRetriever mCardRetriever = new WalletCardRetriever(); private QuickAccessWalletClient mQuickAccessWalletClient; private ViewGroup mIndicationArea; private TextView mIndicationText; private TextView mIndicationTextBottom; Loading @@ -138,7 +153,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private AccessibilityController mAccessibilityController; private StatusBar mStatusBar; private KeyguardAffordanceHelper mAffordanceHelper; private FalsingManager mFalsingManager; private boolean mUserSetupComplete; private boolean mPrewarmBound; private Messenger mPrewarmMessenger; Loading Loading @@ -170,7 +185,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private int mBurnInXOffset; private int mBurnInYOffset; private ActivityIntentHelper mActivityIntentHelper; private int mLockScreenMode; private KeyguardUpdateMonitor mKeyguardUpdateMonitor; public KeyguardBottomAreaView(Context context) { Loading Loading @@ -415,10 +429,11 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } private void updateWalletVisibility() { if (mDozing) { if (mDozing || !mWalletEnabled) { mWalletButton.setVisibility(GONE); } else { mWalletButton.setVisibility(VISIBLE); mWalletButton.setOnClickListener(this::onWalletClick); } } Loading Loading @@ -871,25 +886,63 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL return insets; } private void setupWallet() { boolean inNewLayout = mLockScreenMode != KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL; boolean settingEnabled = Settings.Global.getInt(mContext.getContentResolver(), "controls_lockscreen", 0) == 1; if (!inNewLayout || !settingEnabled) { mWalletButton.setVisibility(View.GONE); /** Set the falsing manager */ public void setFalsingManager(FalsingManager falsingManager) { mFalsingManager = falsingManager; } /** * Initialize the wallet feature, only enabling if the feature is enabled within the platform. */ public void initWallet(QuickAccessWalletClient client, Executor uiExecutor, boolean enabled) { mQuickAccessWalletClient = client; mWalletEnabled = enabled && client.isWalletFeatureAvailable(); if (mWalletEnabled) { queryWalletCards(uiExecutor); } updateWalletVisibility(); } private void queryWalletCards(Executor uiExecutor) { GetWalletCardsRequest request = new GetWalletCardsRequest(1 /* cardWidth */, 1 /* cardHeight */, 1 /* iconSizePx */, 2 /* maxCards */); mQuickAccessWalletClient.getWalletCards(uiExecutor, request, mCardRetriever); } private void onWalletClick(View v) { // More coming here; need to inform the user about how to proceed mFalsingManager.isFalseTap(FalsingManager.LOW_PENALTY); if (mHasCard) { Intent intent = new Intent(mContext, WalletActivity.class) .setAction(Intent.ACTION_VIEW) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent); } else { if (mQuickAccessWalletClient.createWalletIntent() == null) { Log.w(TAG, "Could not get intent of the wallet app."); return; } mActivityStarter.postStartActivityDismissingKeyguard( mQuickAccessWalletClient.createWalletIntent(), /* delay= */ 0); } } private class WalletCardRetriever implements QuickAccessWalletClient.OnWalletCardsRetrievedCallback { // TODO: add image // mWalletButton.setImageDrawable(list.get(0).loadIcon()); @Override public void onWalletCardsRetrieved(@NonNull GetWalletCardsResponse response) { mHasCard = !response.getWalletCards().isEmpty(); updateWalletVisibility(); } /** * Optionally add controls when in the new lockscreen mode */ public void onLockScreenModeChanged(int mode) { mLockScreenMode = mode; setupWallet(); @Override public void onWalletCardRetrievalError(@NonNull GetWalletCardsError error) { mHasCard = false; updateWalletVisibility(); } } } Loading
packages/SystemUI/res/drawable/ic_wallet_lockscreen.xml 0 → 100644 +37 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* * Copyright 2021, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <group> <clip-path android:pathData="M2.15,1.54h20v21h-20z"/> <path android:pathData="M19,21.83H5.35a3.19,3.19 0,0 1,-3.2 -3.19v-7A3.19,3.19 0,0 1,5.35 8.5H19a3.19,3.19 0,0 1,3.19 3.19v7A3.19,3.19 0,0 1,19 21.83ZM5.35,10.44A1.25,1.25 0,0 0,4.1 11.69v7a1.25,1.25 0,0 0,1.25 1.24H19a1.25,1.25 0,0 0,1.25 -1.24v-7A1.25,1.25 0,0 0,19 10.44Z" android:fillColor="#FF000000" /> <path android:pathData="M4.7,10.16 L4.21,8.57 16,5a3.56,3.56 0,0 1,3.1 0.25c1,0.67 1.65,2 1.89,4l-1.66,0.2C19.12,8 18.72,7 18.15,6.62a2,2 0,0 0,-1.7 0Z" android:fillColor="#FF000000" /> <path android:pathData="M4.43,10.47l-1,-1.34 7.31,-5.44c3,-1.86 5.51,1 6.33,2L15.82,6.77c-2.1,-2.44 -3.23,-2.26 -4.14,-1.7Z" android:fillColor="#FF000000" /> </group> </vector>
packages/SystemUI/res/drawable/wallet_lockscreen_bg.xml 0 → 100644 +33 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* * Copyright 2021, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" android:color="?android:attr/textColorPrimary"> <item> <shape android:shape="oval"> <solid android:color="?androidprv:attr/colorSurface"/> <size android:width="@dimen/keyguard_affordance_width" android:height="@dimen/keyguard_affordance_height"/> </shape> </item> </ripple>
packages/SystemUI/res/layout/keyguard_bottom_area.xml +5 −3 Original line number Diff line number Diff line Loading @@ -90,9 +90,11 @@ android:layout_width="@dimen/keyguard_affordance_width" android:layout_gravity="bottom|end" android:scaleType="center" android:tint="?attr/wallpaperTextColor" android:layout_marginStart="24dp" android:layout_marginBottom="48dp" android:tint="?android:attr/textColorPrimary" android:src="@drawable/ic_wallet_lockscreen" android:background="@drawable/wallet_lockscreen_bg" android:layout_marginEnd="@dimen/keyguard_affordance_horizontal_offset" android:layout_marginBottom="@dimen/keyguard_affordance_vertical_offset" android:visibility="gone" /> <FrameLayout Loading
packages/SystemUI/res/values/dimens.xml +6 −3 Original line number Diff line number Diff line Loading @@ -865,9 +865,12 @@ + 8dp. --> <dimen name="assist_orb_navbar_scrim_height">56dp</dimen> <!-- The width/height of the phone/camera icon view on keyguard. --> <dimen name="keyguard_affordance_height">56dp</dimen> <dimen name="keyguard_affordance_width">56dp</dimen> <!-- The width/height of the keyguard bottom area icon view on keyguard. --> <dimen name="keyguard_affordance_height">48dp</dimen> <dimen name="keyguard_affordance_width">48dp</dimen> <dimen name="keyguard_affordance_horizontal_offset">32dp</dimen> <dimen name="keyguard_affordance_vertical_offset">32dp</dimen> <!-- The width/height of the unlock icon view on keyguard. --> <dimen name="keyguard_lock_height">42dp</dimen> Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +73 −20 Original line number Diff line number Diff line Loading @@ -48,8 +48,11 @@ import android.os.Messenger; import android.os.RemoteException; import android.os.UserHandle; import android.provider.MediaStore; import android.provider.Settings; import android.service.media.CameraPrewarmService; import android.service.quickaccesswallet.GetWalletCardsError; import android.service.quickaccesswallet.GetWalletCardsRequest; import android.service.quickaccesswallet.GetWalletCardsResponse; import android.service.quickaccesswallet.QuickAccessWalletClient; import android.telecom.TelecomManager; import android.text.TextUtils; import android.util.AttributeSet; Loading @@ -64,6 +67,8 @@ import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; Loading @@ -75,6 +80,7 @@ import com.android.systemui.animation.Interpolators; import com.android.systemui.assist.AssistManager; import com.android.systemui.camera.CameraIntents; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.IntentButtonProvider; import com.android.systemui.plugins.IntentButtonProvider.IntentButton; import com.android.systemui.plugins.IntentButtonProvider.IntentButton.IconState; Loading @@ -87,6 +93,9 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.PreviewInflater; import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory; import com.android.systemui.tuner.TunerService; import com.android.systemui.wallet.ui.WalletActivity; import java.util.concurrent.Executor; /** * Implementation for the bottom area of the Keyguard, including camera/phone affordance and status Loading Loading @@ -121,7 +130,13 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private KeyguardAffordanceView mRightAffordanceView; private KeyguardAffordanceView mLeftAffordanceView; private ImageView mWalletButton; private boolean mWalletEnabled = false; private boolean mHasCard = false; private WalletCardRetriever mCardRetriever = new WalletCardRetriever(); private QuickAccessWalletClient mQuickAccessWalletClient; private ViewGroup mIndicationArea; private TextView mIndicationText; private TextView mIndicationTextBottom; Loading @@ -138,7 +153,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private AccessibilityController mAccessibilityController; private StatusBar mStatusBar; private KeyguardAffordanceHelper mAffordanceHelper; private FalsingManager mFalsingManager; private boolean mUserSetupComplete; private boolean mPrewarmBound; private Messenger mPrewarmMessenger; Loading Loading @@ -170,7 +185,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private int mBurnInXOffset; private int mBurnInYOffset; private ActivityIntentHelper mActivityIntentHelper; private int mLockScreenMode; private KeyguardUpdateMonitor mKeyguardUpdateMonitor; public KeyguardBottomAreaView(Context context) { Loading Loading @@ -415,10 +429,11 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } private void updateWalletVisibility() { if (mDozing) { if (mDozing || !mWalletEnabled) { mWalletButton.setVisibility(GONE); } else { mWalletButton.setVisibility(VISIBLE); mWalletButton.setOnClickListener(this::onWalletClick); } } Loading Loading @@ -871,25 +886,63 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL return insets; } private void setupWallet() { boolean inNewLayout = mLockScreenMode != KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL; boolean settingEnabled = Settings.Global.getInt(mContext.getContentResolver(), "controls_lockscreen", 0) == 1; if (!inNewLayout || !settingEnabled) { mWalletButton.setVisibility(View.GONE); /** Set the falsing manager */ public void setFalsingManager(FalsingManager falsingManager) { mFalsingManager = falsingManager; } /** * Initialize the wallet feature, only enabling if the feature is enabled within the platform. */ public void initWallet(QuickAccessWalletClient client, Executor uiExecutor, boolean enabled) { mQuickAccessWalletClient = client; mWalletEnabled = enabled && client.isWalletFeatureAvailable(); if (mWalletEnabled) { queryWalletCards(uiExecutor); } updateWalletVisibility(); } private void queryWalletCards(Executor uiExecutor) { GetWalletCardsRequest request = new GetWalletCardsRequest(1 /* cardWidth */, 1 /* cardHeight */, 1 /* iconSizePx */, 2 /* maxCards */); mQuickAccessWalletClient.getWalletCards(uiExecutor, request, mCardRetriever); } private void onWalletClick(View v) { // More coming here; need to inform the user about how to proceed mFalsingManager.isFalseTap(FalsingManager.LOW_PENALTY); if (mHasCard) { Intent intent = new Intent(mContext, WalletActivity.class) .setAction(Intent.ACTION_VIEW) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent); } else { if (mQuickAccessWalletClient.createWalletIntent() == null) { Log.w(TAG, "Could not get intent of the wallet app."); return; } mActivityStarter.postStartActivityDismissingKeyguard( mQuickAccessWalletClient.createWalletIntent(), /* delay= */ 0); } } private class WalletCardRetriever implements QuickAccessWalletClient.OnWalletCardsRetrievedCallback { // TODO: add image // mWalletButton.setImageDrawable(list.get(0).loadIcon()); @Override public void onWalletCardsRetrieved(@NonNull GetWalletCardsResponse response) { mHasCard = !response.getWalletCards().isEmpty(); updateWalletVisibility(); } /** * Optionally add controls when in the new lockscreen mode */ public void onLockScreenModeChanged(int mode) { mLockScreenMode = mode; setupWallet(); @Override public void onWalletCardRetrievalError(@NonNull GetWalletCardsError error) { mHasCard = false; updateWalletVisibility(); } } }