Add auto advancing screens for private space setup
This includes changes for 1. To add auto avancing screens to PS setup 2. Screen to set a different Private profile lock or use existing lock 3. Success screen on setup completion 4. Shows Error screen if profile creation failed for some reason 5. Send intent towards launcher, show a Toast message to access PS from bottom of All apps and exit. Bug: 299069146 Test: Manual setup Change-Id: If4e5dd5a42abb11259bc40506189c7c750324139
This commit is contained in:
@@ -4999,6 +4999,7 @@
|
|||||||
<activity android:name=".privatespace.PrivateSpaceAuthenticationActivity"
|
<activity android:name=".privatespace.PrivateSpaceAuthenticationActivity"
|
||||||
android:theme="@*android:style/Theme.DeviceDefault.Settings.Dialog.NoActionBar"
|
android:theme="@*android:style/Theme.DeviceDefault.Settings.Dialog.NoActionBar"
|
||||||
android:exported="false"/>
|
android:exported="false"/>
|
||||||
|
<activity android:name=".privatespace.PrivateProfileContextHelperActivity" android:exported="false"/>
|
||||||
|
|
||||||
<activity-alias android:name="UsageStatsActivity"
|
<activity-alias android:name="UsageStatsActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
19
res/drawable/ic_privatespace_done.xml
Normal file
19
res/drawable/ic_privatespace_done.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2023 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="48dp" android:height="48dp" android:viewportWidth="960" android:viewportHeight="960" android:tint="?attr/colorControlNormal">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M378,714L154,490L197,447L378,628L762,244L805,287L378,714Z"/>
|
||||||
|
</vector>
|
20
res/drawable/ic_warning_circle_red.xml
Normal file
20
res/drawable/ic_warning_circle_red.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2023 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 android:height="24dp" android:viewportHeight="40"
|
||||||
|
android:viewportWidth="40" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#F2B8B5" android:pathData="M20,30C20.567,30 21.033,29.817 21.4,29.45C21.8,29.05 22,28.567 22,28C22,27.433 21.8,26.967 21.4,26.6C21.033,26.2 20.567,26 20,26C19.433,26 18.95,26.2 18.55,26.6C18.183,26.967 18,27.433 18,28C18,28.567 18.183,29.05 18.55,29.45C18.95,29.817 19.433,30 20,30ZM18,22H22V10H18V22ZM20,40C17.233,40 14.633,39.483 12.2,38.45C9.767,37.383 7.65,35.95 5.85,34.15C4.05,32.35 2.617,30.233 1.55,27.8C0.517,25.367 0,22.767 0,20C0,17.233 0.517,14.633 1.55,12.2C2.617,9.767 4.05,7.65 5.85,5.85C7.65,4.05 9.767,2.633 12.2,1.6C14.633,0.533 17.233,-0 20,-0C22.767,-0 25.367,0.533 27.8,1.6C30.233,2.633 32.35,4.05 34.15,5.85C35.95,7.65 37.367,9.767 38.4,12.2C39.467,14.633 40,17.233 40,20C40,22.767 39.467,25.367 38.4,27.8C37.367,30.233 35.95,32.35 34.15,34.15C32.35,35.95 30.233,37.383 27.8,38.45C25.367,39.483 22.767,40 20,40ZM20,36C24.467,36 28.25,34.45 31.35,31.35C34.45,28.25 36,24.467 36,20C36,15.533 34.45,11.75 31.35,8.65C28.25,5.55 24.467,4 20,4C15.533,4 11.75,5.55 8.65,8.65C5.55,11.75 4,15.533 4,20C4,24.467 5.55,28.25 8.65,31.35C11.75,34.45 15.533,36 20,36Z"/>
|
||||||
|
</vector>
|
78
res/drawable/privatespace_lock_placeholder.xml
Normal file
78
res/drawable/privatespace_lock_placeholder.xml
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2023 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="380dp"
|
||||||
|
android:height="276dp"
|
||||||
|
android:viewportWidth="380"
|
||||||
|
android:viewportHeight="276">
|
||||||
|
<path
|
||||||
|
android:pathData="M354.34,276H25.66C11.56,276 0,264.2 0,249.8V26.24C0,11.8 11.56,0 25.66,0H354.44C368.44,0 380,11.8 380,26.2V249.9C380,264.2 368.44,276 354.34,276Z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M190,37.72C185.34,37.71 180.72,38.64 176.42,40.45C170.09,43.12 164.69,47.58 160.89,53.3C157.1,59.01 155.09,65.72 155.1,72.57V90.07H155.29V111.34H161.68V72.57C161.67,67.12 163.23,61.79 166.18,57.2L166.04,57.11C166.1,57.01 166.16,56.92 166.23,56.82C169.33,52.16 173.74,48.5 178.91,46.33C185.11,43.73 192.03,43.39 198.45,45.38C204.88,47.37 210.39,51.55 214.02,57.2L214.01,57.2C216.96,61.79 218.52,67.12 218.51,72.57V111.34H224.9V72.57C224.92,65.9 223,59.37 219.4,53.76L215.27,56.4L219.39,53.76C216.24,48.83 211.89,44.78 206.76,41.98C201.62,39.17 195.86,37.71 190,37.72Z"
|
||||||
|
android:fillColor="#669DF6"
|
||||||
|
android:fillType="evenOdd"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M250.08,227.69H129.92C126.53,227.69 123.28,226.35 120.88,223.96C118.48,221.56 117.14,218.32 117.14,214.93V122.24C117.14,118.86 118.48,115.61 120.88,113.22C123.28,110.83 126.53,109.48 129.92,109.48H250.08C253.47,109.48 256.72,110.83 259.12,113.22C261.52,115.61 262.86,118.86 262.86,122.24V214.93C262.86,218.32 261.52,221.56 259.12,223.96C256.72,226.35 253.47,227.69 250.08,227.69ZM129.92,113.13C127.5,113.13 125.18,114.09 123.46,115.8C121.75,117.5 120.79,119.82 120.79,122.24V214.93C120.79,217.35 121.75,219.67 123.46,221.38C125.18,223.09 127.5,224.05 129.92,224.05H250.08C252.5,224.05 254.82,223.09 256.54,221.38C258.25,219.67 259.21,217.35 259.21,214.93V122.24C259.21,119.82 258.25,117.5 256.54,115.8C254.82,114.09 252.5,113.13 250.08,113.13H129.92Z"
|
||||||
|
android:fillColor="#80868B"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M281.77,245.93C303.27,245.93 320.69,228.59 320.69,207.21C320.69,185.83 303.27,168.49 281.77,168.49C260.28,168.49 242.86,185.83 242.86,207.21C242.86,228.59 260.28,245.93 281.77,245.93Z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M281.77,168.36C260.2,168.36 242.57,185.76 242.57,207.37C242.57,228.97 260.06,246.37 281.77,246.37C303.49,246.37 320.97,228.97 320.97,207.37C320.97,185.76 303.35,168.36 281.77,168.36ZM281.77,238.37C264.57,238.37 250.47,224.34 250.47,207.22C250.47,190.11 264.57,176.08 281.77,176.08C298.98,176.08 313.08,190.11 313.08,207.22C313.08,224.48 298.98,238.37 281.77,238.37Z"
|
||||||
|
android:fillColor="#669DF6"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M281.77,170.07C261.13,170.07 244.27,186.71 244.27,207.37C244.27,228.02 260.99,244.66 281.77,244.66C302.55,244.66 319.27,228.02 319.27,207.37C319.27,186.71 302.42,170.07 281.77,170.07ZM281.77,240.07C263.64,240.07 248.77,225.29 248.77,207.22C248.77,189.16 263.64,174.38 281.77,174.38C299.91,174.38 314.78,189.16 314.78,207.22C314.78,225.43 299.9,240.07 281.77,240.07ZM242.57,207.37C242.57,185.76 260.2,168.36 281.77,168.36C303.35,168.36 320.97,185.76 320.97,207.37C320.97,228.97 303.49,246.37 281.77,246.37C260.06,246.37 242.57,228.97 242.57,207.37ZM250.47,207.22C250.47,224.34 264.57,238.37 281.77,238.37C298.98,238.37 313.08,224.48 313.08,207.22C313.08,190.11 298.98,176.08 281.77,176.08C264.57,176.08 250.47,190.11 250.47,207.22Z"
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:fillType="evenOdd"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M301.48,193.25C301.48,191.56 300.44,190.07 298.85,189.48L283.36,183.85C282.49,183.54 281.54,183.54 280.66,183.85L265.14,189.48C263.56,190.07 262.52,191.56 262.52,193.25V203.97C262.56,205.8 262.68,207.57 262.93,209.4C264.07,217.18 268.46,226.02 280.46,232.19C281.41,232.68 282.56,232.68 283.51,232.19C295.52,225.99 299.9,217.18 301.05,209.4C301.29,207.59 301.43,205.8 301.46,203.97V193.25H301.48Z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M291.62,222.69C291.74,222.13 292.45,218.26 290.38,214.37C289.21,212.19 287.7,210.92 285.63,209.28C284.21,208.18 280.46,205.76 279.52,205.17C279.56,205.19 279.64,205.27 279.68,205.29C279.17,204.97 279.2,204.97 279.52,205.17C278.47,204.46 276.67,203.04 275.3,200.59C273.67,197.68 273.62,194.96 273.62,194.45C273.62,194.4 273.62,194.38 273.62,194.33C273.62,191.05 274.64,188.5 276.27,186.67C277.49,185.3 278.88,184.51 280.05,184.05L265.14,189.48C263.56,190.04 262.52,191.56 262.52,193.25V203.97C262.56,205.8 262.68,207.57 262.93,209.4C264.07,217.18 268.46,226.02 280.46,232.18C281.41,232.68 282.56,232.68 283.51,232.18C284.63,231.62 285.65,231.01 286.63,230.4C288.14,229.27 290.79,226.78 291.6,222.69H291.62Z"
|
||||||
|
android:fillColor="#3957E2"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M279.69,205.29C279.69,205.29 279.57,205.19 279.52,205.17C279.2,204.97 279.17,204.97 279.69,205.29Z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M298.85,189.48L283.36,183.85C282.48,183.54 281.54,183.54 280.66,183.85L280.05,184.07C278.9,184.54 277.49,185.32 276.27,186.69C274.64,188.53 273.62,191.07 273.62,194.35C273.62,194.4 273.62,194.43 273.62,194.48C273.62,194.99 273.69,197.71 275.3,200.62C276.66,203.06 278.44,204.46 279.51,205.19C280.46,205.8 284.21,208.2 285.63,209.3C287.7,210.94 289.23,212.22 290.38,214.4C292.45,218.26 291.72,222.15 291.62,222.71C290.82,226.8 288.16,229.27 286.65,230.42C296.3,224.4 300.02,216.48 301.07,209.43C301.31,207.62 301.46,205.83 301.48,203.99V193.25C301.48,191.56 300.43,190.07 298.85,189.48Z"
|
||||||
|
android:fillColor="#698FF7"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M157.35,137.23C157.97,136.58 158.83,136.2 159.73,136.17C160.63,136.14 161.5,136.47 162.16,137.08L162.31,137.22L163.18,138.14C163.57,138.57 164.07,138.88 164.62,139.06C165.17,139.24 165.76,139.26 166.32,139.15L167.53,138.91C168.42,138.74 169.34,138.93 170.09,139.44C170.84,139.95 171.36,140.73 171.54,141.61C171.54,141.68 171.55,141.74 171.59,141.8L171.73,143.06C171.8,143.62 172.01,144.17 172.35,144.63C172.69,145.09 173.14,145.46 173.66,145.7L174.77,146.27C175.58,146.66 176.21,147.36 176.52,148.2C176.83,149.05 176.79,149.98 176.41,150.8C176.37,150.84 176.37,150.94 176.32,150.99L175.74,152.05C175.45,152.55 175.3,153.11 175.3,153.69C175.3,154.26 175.46,154.82 175.74,155.32L176.32,156.43C176.74,157.22 176.84,158.16 176.58,159.02C176.32,159.89 175.73,160.62 174.94,161.06C174.89,161.1 174.8,161.1 174.75,161.15L173.63,161.68C173.11,161.92 172.66,162.29 172.32,162.76C171.99,163.22 171.77,163.76 171.71,164.33L171.56,165.59C171.44,166.48 170.97,167.28 170.26,167.84C169.54,168.38 168.64,168.63 167.74,168.53C167.68,168.54 167.61,168.52 167.55,168.48L166.38,168.24C165.82,168.15 165.23,168.19 164.69,168.36C164.14,168.54 163.64,168.85 163.24,169.25L162.39,170.13C161.76,170.78 160.91,171.16 160.01,171.19C159.11,171.22 158.23,170.89 157.57,170.28L157.43,170.14L156.55,169.22C156.16,168.8 155.66,168.49 155.1,168.31C154.54,168.14 153.95,168.12 153.39,168.25L152.18,168.49C151.29,168.66 150.37,168.47 149.62,167.96C148.87,167.46 148.35,166.67 148.17,165.79C148.18,165.72 148.16,165.65 148.12,165.6L147.98,164.34C147.91,163.77 147.7,163.23 147.36,162.77C147.02,162.3 146.57,161.93 146.05,161.69L144.94,161.16C144.53,160.97 144.16,160.7 143.85,160.37C143.55,160.03 143.32,159.64 143.16,159.21C143.01,158.78 142.94,158.33 142.96,157.88C142.99,157.43 143.1,156.99 143.3,156.58C143.34,156.53 143.34,156.44 143.39,156.39L143.97,155.28C144.26,154.78 144.4,154.22 144.4,153.65C144.4,153.07 144.26,152.51 143.97,152.01L143.39,150.9C142.97,150.1 142.88,149.17 143.13,148.3C143.39,147.44 143.98,146.71 144.77,146.28C144.82,146.23 144.91,146.23 144.96,146.18L146.08,145.65C146.6,145.41 147.05,145.04 147.39,144.57C147.72,144.11 147.94,143.57 148,143L148.15,141.75C148.27,140.86 148.74,140.05 149.46,139.5C150.17,138.95 151.07,138.7 151.97,138.81C152.04,138.8 152.1,138.82 152.16,138.86L153.37,139.1C153.93,139.19 154.51,139.15 155.06,138.97C155.6,138.8 156.1,138.49 156.5,138.09L157.35,137.24L157.35,137.23Z"
|
||||||
|
android:fillColor="#EE675C"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M165.34,152.63L157.4,148.13C156.85,147.86 156.31,147.99 156.04,148.54C155.9,148.68 155.9,148.81 155.9,149.09V158.08C155.9,158.63 156.31,159.04 156.85,159.04C156.99,159.04 157.27,159.04 157.4,158.9L165.2,154.4C165.75,154.13 165.89,153.58 165.61,153.04C165.61,152.9 165.47,152.77 165.34,152.63Z"
|
||||||
|
android:fillColor="#ffffff"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M236.54,176.53L226.88,171.29C226.21,170.97 225.55,171.13 225.22,171.77C225.05,171.93 225.05,172.09 225.05,172.4V182.89C225.05,183.53 225.55,184.01 226.21,184.01C226.39,184.01 226.72,184.01 226.88,183.85L236.37,178.6C237.04,178.28 237.21,177.65 236.87,177.01C236.87,176.85 236.7,176.7 236.54,176.53Z"
|
||||||
|
android:fillColor="#3C4043"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M148.49,207.01C143.41,207.01 139.27,202.88 139.27,197.81C139.27,192.74 143.41,188.61 148.49,188.61C153.58,188.61 157.72,192.74 157.72,197.81C157.72,202.88 153.58,207.01 148.49,207.01Z"
|
||||||
|
android:fillColor="#3C4043"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M224.65,129.5L213.61,128.09C212.49,127.95 211.34,128.11 210.3,128.56C209.26,129 208.34,129.71 207.66,130.61L200.9,139.5C200.21,140.4 199.78,141.48 199.63,142.61C199.49,143.74 199.65,144.89 200.09,145.93L204.37,156.22C204.81,157.27 205.52,158.18 206.42,158.87C207.33,159.55 208.4,159.99 209.52,160.13L220.56,161.52C221.69,161.67 222.83,161.51 223.88,161.07C224.93,160.63 225.84,159.92 226.53,159.01L233.26,150.14C233.95,149.23 234.39,148.16 234.53,147.03C234.67,145.9 234.52,144.75 234.08,143.7L229.79,133.42C229.35,132.37 228.65,131.45 227.74,130.76C226.84,130.07 225.77,129.64 224.65,129.5Z"
|
||||||
|
android:fillColor="#FCC934"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M210.34,150.41L223.25,151.73L224.57,138.86L211.66,137.54L210.34,150.41ZM210.15,152.25C209.65,152.2 209.23,151.98 208.9,151.58C208.58,151.18 208.45,150.73 208.5,150.23L209.82,137.35C209.87,136.85 210.09,136.43 210.49,136.11C210.89,135.78 211.34,135.65 211.85,135.7L224.76,137.02C225.26,137.07 225.68,137.29 226.01,137.69C226.33,138.09 226.46,138.54 226.41,139.04L225.09,151.92C225.04,152.43 224.82,152.84 224.42,153.16C224.02,153.49 223.57,153.62 223.06,153.57L210.15,152.25ZM211.45,148.67L222.51,149.8L219.53,144.85L216.38,148.24L214.59,145.27L211.45,148.67L211.45,148.67ZM211.66,137.54L210.34,150.41L211.66,137.54Z"
|
||||||
|
android:fillColor="#ffffff"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M178.53,187.68C174.35,181.53 179.88,173.46 187.15,175.11L188.35,175.38C190.56,175.88 192.89,175.44 194.77,174.17L195.79,173.48C201.96,169.32 210.05,174.84 208.4,182.08L208.13,183.28C207.62,185.49 208.06,187.81 209.34,189.69L210.02,190.7C214.2,196.85 208.67,204.93 201.41,203.28L200.21,203.01C197.99,202.5 195.66,202.94 193.78,204.21L192.76,204.9C186.6,209.07 178.5,203.55 180.15,196.3L180.43,195.1C180.93,192.9 180.5,190.57 179.22,188.7L178.53,187.68L178.53,187.68Z"
|
||||||
|
android:fillColor="#5BB974"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M189.5,195.21C190.11,194.34 190.86,193.6 191.77,192.99C192.68,192.39 193.71,191.98 194.85,191.76C196,191.55 197.1,191.55 198.17,191.78C199.24,192.01 200.21,192.42 201.1,193.01L199.08,182.41L187.48,184.61L189.5,195.21ZM194.54,190.11C195.33,189.96 195.97,189.54 196.42,188.87C196.88,188.2 197.04,187.46 196.88,186.67C196.73,185.88 196.32,185.24 195.65,184.79C194.98,184.34 194.23,184.18 193.43,184.33C192.64,184.48 192,184.89 191.55,185.57C191.09,186.24 190.93,186.97 191.09,187.77C191.24,188.56 191.65,189.2 192.33,189.65C192.99,190.1 193.74,190.26 194.54,190.11ZM189.99,197.8C189.54,197.89 189.12,197.8 188.73,197.54C188.34,197.28 188.11,196.92 188.02,196.47L185.82,184.92C185.74,184.46 185.83,184.04 186.09,183.66C186.35,183.27 186.71,183.04 187.16,182.95L198.76,180.76C199.22,180.67 199.64,180.76 200.02,181.02C200.41,181.28 200.65,181.63 200.73,182.09L202.93,193.64C203.02,194.1 202.93,194.51 202.67,194.9C202.4,195.29 202.05,195.52 201.59,195.6L189.99,197.8ZM189.68,196.15L201.28,193.96L201.1,193C200.21,192.41 199.24,192.01 198.17,191.77C197.1,191.55 195.99,191.54 194.85,191.76C193.7,191.97 192.68,192.38 191.77,192.99C190.86,193.59 190.1,194.33 189.5,195.2L189.68,196.15ZM189.5,195.21L187.48,184.61L199.08,182.41L201.1,193.01C200.21,192.42 199.24,192.01 198.17,191.78C197.1,191.55 196,191.55 194.85,191.76C193.71,191.98 192.68,192.39 191.77,192.99C190.86,193.6 190.11,194.34 189.5,195.21Z"
|
||||||
|
android:fillColor="#ffffff"/>
|
||||||
|
</vector>
|
48
res/drawable/privatespace_setup_flow_placeholder.xml
Normal file
48
res/drawable/privatespace_setup_flow_placeholder.xml
Normal file
File diff suppressed because one or more lines are too long
59
res/layout/privatespace_advancing_screen.xml
Normal file
59
res/layout/privatespace_advancing_screen.xml
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2023 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.google.android.setupdesign.GlifLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/privatesapce_autoadvance_screen"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:sucHeaderText="@string/privatespace_lock_protected_title"
|
||||||
|
android:icon="@drawable/ic_privatespace_icon">
|
||||||
|
<LinearLayout style="@style/SudContentFrame"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/placeholder_image"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:src="@drawable/privatespace_setup_flow_placeholder"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/setup_progress"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|right"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar_cyclic"
|
||||||
|
style="?android:attr/progressBarStyleSmall"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_gravity="center"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/createMessage"
|
||||||
|
style="@style/PrivateSpaceSetupTextFontStyle"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:text="@string/privatespace_setting_up_text"
|
||||||
|
android:layout_margin="8dp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</com.google.android.setupdesign.GlifLayout>
|
27
res/layout/privatespace_creation_error.xml
Normal file
27
res/layout/privatespace_creation_error.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2023 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.google.android.setupdesign.GlifLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/privatespace_setup_error"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:filterTouchesWhenObscured="true"
|
||||||
|
app:sucHeaderText="@string/privatespace_error_screen_title"
|
||||||
|
app:sudDescriptionText="@string/privatespace_error_screen_summary"
|
||||||
|
android:icon="@drawable/ic_warning_circle_red">
|
||||||
|
</com.google.android.setupdesign.GlifLayout>
|
@@ -15,12 +15,12 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<com.google.android.setupdesign.GlifLayout
|
<com.google.android.setupdesign.GlifLayout
|
||||||
xmlns:aapt="http://schemas.android.com/aapt"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/ps_education_screen"
|
android:id="@+id/ps_education_screen"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:filterTouchesWhenObscured="true"
|
||||||
app:sucHeaderText="@string/privatespace_setup_title"
|
app:sucHeaderText="@string/privatespace_setup_title"
|
||||||
app:sudDescriptionText="@string/privatespace_hide_apps_summary"
|
app:sudDescriptionText="@string/privatespace_hide_apps_summary"
|
||||||
android:icon="@drawable/ic_privatespace_icon">
|
android:icon="@drawable/ic_privatespace_icon">
|
||||||
|
43
res/layout/privatespace_setlock_screen.xml
Normal file
43
res/layout/privatespace_setlock_screen.xml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2023 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.google.android.setupdesign.GlifLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/ps_fragment_lock"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:filterTouchesWhenObscured="true"
|
||||||
|
app:sucHeaderText="@string/privatespace_lockscreen_title"
|
||||||
|
app:sudDescriptionText="@string/privatespace_lockscreen_summary"
|
||||||
|
android:icon="@drawable/ic_lock">
|
||||||
|
<com.google.android.setupdesign.view.FillContentLayout
|
||||||
|
style="@style/SudContentFrame"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:maxWidth="@dimen/animation_max_size"
|
||||||
|
android:maxHeight="@dimen/animation_max_size">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/privatespace_lock_image"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:src="@drawable/privatespace_lock_placeholder"/>
|
||||||
|
|
||||||
|
</com.google.android.setupdesign.view.FillContentLayout>
|
||||||
|
</com.google.android.setupdesign.GlifLayout>
|
27
res/layout/privatespace_setup_success.xml
Normal file
27
res/layout/privatespace_setup_success.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2023 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.google.android.setupdesign.GlifLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/privatespace_setup_success"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:filterTouchesWhenObscured="true"
|
||||||
|
app:sucHeaderText="@string/privatespace_success_title"
|
||||||
|
app:sudDescriptionText="@string/privatespace_access_text"
|
||||||
|
android:icon="@drawable/ic_privatespace_done">
|
||||||
|
</com.google.android.setupdesign.GlifLayout>
|
@@ -21,5 +21,29 @@
|
|||||||
app:startDestination="@id/ps_education_fragment">
|
app:startDestination="@id/ps_education_fragment">
|
||||||
<fragment android:id="@+id/ps_education_fragment"
|
<fragment android:id="@+id/ps_education_fragment"
|
||||||
android:name="com.android.settings.privatespace.PrivateSpaceEducation"
|
android:name="com.android.settings.privatespace.PrivateSpaceEducation"
|
||||||
android:label="fragment_ps_education"/>
|
android:label="fragment_ps_education">
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_education_to_auto_advance"
|
||||||
|
app:destination="@id/ps_auto_advance_fragment"/>
|
||||||
|
</fragment>
|
||||||
|
<fragment android:id="@+id/ps_auto_advance_fragment"
|
||||||
|
android:name="com.android.settings.privatespace.AutoAdvanceSetupFragment"
|
||||||
|
android:label="fragment_ps_auto_advance">
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_advance_profile_error"
|
||||||
|
app:destination="@id/ps_profile_error_fragment"/>
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_advance_to_success"
|
||||||
|
app:destination="@id/ps_profile_success_fragment"/>
|
||||||
|
</fragment>
|
||||||
|
<fragment android:id="@+id/ps_profile_error_fragment"
|
||||||
|
android:name="com.android.settings.privatespace.PrivateProfileCreationError"
|
||||||
|
android:label="fragment_ps_error">
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_retry_profile_creation"
|
||||||
|
app:destination="@id/ps_auto_advance_fragment"/>
|
||||||
|
</fragment>
|
||||||
|
<fragment android:id="@+id/ps_profile_success_fragment"
|
||||||
|
android:name="com.android.settings.privatespace.SetupSuccessFragment"
|
||||||
|
android:label="fragment_ps_success"/>
|
||||||
</navigation>
|
</navigation>
|
24
res/navigation/privatespace_private_context_nav.xml
Normal file
24
res/navigation/privatespace_private_context_nav.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2023 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/private_space_navigation"
|
||||||
|
app:startDestination="@id/ps_profile_lock_fragment">
|
||||||
|
<fragment android:id="@+id/ps_profile_lock_fragment"
|
||||||
|
android:name="com.android.settings.privatespace.PrivateSpaceSetLockFragment"
|
||||||
|
android:label="fragment_ps_lock"/>
|
||||||
|
</navigation>
|
@@ -459,4 +459,7 @@
|
|||||||
<dimen name="screen_flash_color_button_inner_circle_size">42dp</dimen>
|
<dimen name="screen_flash_color_button_inner_circle_size">42dp</dimen>
|
||||||
<dimen name="screen_flash_color_button_inner_circle_padding">3dp</dimen>
|
<dimen name="screen_flash_color_button_inner_circle_padding">3dp</dimen>
|
||||||
<dimen name="screen_flash_color_button_inner_circle_stroke">1dp</dimen>
|
<dimen name="screen_flash_color_button_inner_circle_stroke">1dp</dimen>
|
||||||
|
|
||||||
|
<!-- An arbitrarily large number to make the max size fit the parent -->
|
||||||
|
<dimen name="animation_max_size">1000dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -1239,24 +1239,54 @@
|
|||||||
<string name="no_device_lock_action_label">Set screen lock</string>
|
<string name="no_device_lock_action_label">Set screen lock</string>
|
||||||
<!-- Action label to cancel Alert dialog when no screen lock is set [CHAR LIMIT=30] -->
|
<!-- Action label to cancel Alert dialog when no screen lock is set [CHAR LIMIT=30] -->
|
||||||
<string name="no_device_lock_cancel">Cancel</string>
|
<string name="no_device_lock_cancel">Cancel</string>
|
||||||
<!-- Action label to cancel Private Space Setup flow [CHAR LIMIT=50] -->
|
<!-- Action label to cancel Private Space Setup flow [CHAR LIMIT=30] -->
|
||||||
<string name="privatespace_cancel_label">Cancel</string>
|
<string name="privatespace_cancel_label">Cancel</string>
|
||||||
<!-- Label for Private Space setup button to create Private Space [CHAR LIMIT=50] -->
|
<!-- Label for Private Space setup button to create Private Space [CHAR LIMIT=30] -->
|
||||||
<string name="privatespace_setup_button_label">Set up</string>
|
<string name="privatespace_setup_button_label">Set up</string>
|
||||||
<!-- Title for Private Space setup education screen. [CHAR LIMIT=60] -->
|
<!-- Title for Private Space setup education screen. [CHAR LIMIT=50] -->
|
||||||
<string name="privatespace_setup_title">Set up Private Space</string>
|
<string name="privatespace_setup_title">Set up Private Space</string>
|
||||||
<!-- Summary for the Private Space setup education screen. [CHAR LIMIT=NONE] -->
|
<!-- Summary for the Private Space setup education screen. [CHAR LIMIT=NONE] -->
|
||||||
<string name="privatespace_hide_apps_summary">Hide private apps in a secure space that only you can access</string>
|
<string name="privatespace_hide_apps_summary">Hide private apps in a secure space that only you can access</string>
|
||||||
<!-- Text shown in Private Space setup screen which explains how the Private Space works [CHAR LIMIT=NONE] -->
|
<!-- Text shown in Private Space setup screen which explains how the Private Space works [CHAR LIMIT=50] -->
|
||||||
<string name="privatespace_how_title">How it works</string>
|
<string name="privatespace_how_title">How it works</string>
|
||||||
<!-- Text shown in Private Space setup screen which explains Private Space can be accessed from bottom of all apps list. [CHAR LIMIT=NONE] -->
|
<!-- Text shown in Private Space setup screen which explains Private Space can be accessed from bottom of all apps list. [CHAR LIMIT=NONE] -->
|
||||||
<string name="privatespace_access_bottom_text">You can access Private Space from the bottom of your apps list</string>
|
<string name="privatespace_access_bottom_text">You can access Private Space from the bottom of your apps list</string>
|
||||||
<!-- Text shown in Private Space setup screen which explains Private Space apps are protected by a lock. [CHAR LIMIT=NONE] -->
|
<!-- Text shown in Private Space setup screen which explains Private Space apps are protected by a lock. [CHAR LIMIT=60] -->
|
||||||
<string name="privatespace_protected_lock_text">Apps in Private Space are protected by a lock</string>
|
<string name="privatespace_protected_lock_text">Apps in Private Space are protected by a lock</string>
|
||||||
<!-- Text shown in Private Space setup screen which explains notifications from Private Space apps will not be shown when Private Space is locked. [CHAR LIMIT=NONE] -->
|
<!-- Text shown in Private Space setup screen which explains notifications from Private Space apps will not be shown when Private Space is locked. [CHAR LIMIT=NONE] -->
|
||||||
<string name="privatespace_hidden_notifications_text">Notifications from apps in Private Space are hidden when it\'s locked</string>
|
<string name="privatespace_hidden_notifications_text">Notifications from apps in Private Space are hidden when it\u2019s locked</string>
|
||||||
<!-- Text shown in Private Space setup screen which explains that the permissions granted to Private Space apps will not be shown in settings when Private Space is locked. [CHAR LIMIT=NONE] -->
|
<!-- Text shown in Private Space setup screen which explains that the permissions granted to Private Space apps will not be shown in settings when Private Space is locked. [CHAR LIMIT=NONE] -->
|
||||||
<string name="privatespace_apps_permission_text">Private Space apps won\'t appear in permission manager, privacy dashboard, and other settings when Private Space is locked</string>
|
<string name="privatespace_apps_permission_text">Private Space apps won\u2019t appear in permission manager, privacy dashboard, and other settings when Private Space is locked</string>
|
||||||
|
<!-- Text shown at the bottom in Private Space auto advancing screens. [CHAR LIMIT=60] -->
|
||||||
|
<string name="privatespace_setting_up_text">Setting up Private Space\u2026</string>
|
||||||
|
<!-- Title for Private Space setup in auto advancing screen informing private space is protected by a lock. [CHAR LIMIT=60] -->
|
||||||
|
<string name="privatespace_lock_protected_title">Private Space is protected by a lock</string>
|
||||||
|
<!-- Title for Private Space setup in auto advancing screen informing private space is hidden when locked. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="privatespace_apps_hidden_title">Usage info for Private Space apps is hidden when it\u2019s locked</string>
|
||||||
|
<!-- Title for Private Space setup in auto advancing screen informing private space can be accessed from apps list. [CHAR LIMIT=60] -->
|
||||||
|
<string name="privatespace_access_from_apps_title">Access Private Space from your apps list</string>
|
||||||
|
<!-- Title for Private Space creation error screen. [CHAR LIMIT=60] -->
|
||||||
|
<string name="privatespace_error_screen_title">Couldn\u2019t set up Private Space</string>
|
||||||
|
<!-- Summary for the Private Space creation error screen. [CHAR LIMIT=60] -->
|
||||||
|
<string name="privatespace_error_screen_summary">Try again now, or come back later</string>
|
||||||
|
<!-- Label for button to retry creating private space again on creation error. [CHAR LIMIT=30] -->
|
||||||
|
<string name="privatespace_tryagain_label">Try Again</string>
|
||||||
|
<!-- Title for Private Space lock setup screen. [CHAR LIMIT=50] -->
|
||||||
|
<string name="privatespace_lockscreen_title">Use screen lock to unlock?</string>
|
||||||
|
<!-- Summary for the Private Space lock setup screen. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="privatespace_lockscreen_summary">You can unlock Private Space the same way you unlock your device, or choose a different lock</string>
|
||||||
|
<!-- Action label to use existing device lock for Private Space. [CHAR LIMIT=50] -->
|
||||||
|
<string name="privatespace_use_screenlock_label">Use screen lock</string>
|
||||||
|
<!-- Label for Private Space lock setup button to choose a new lock. [CHAR LIMIT=50] -->
|
||||||
|
<string name="privatespace_set_lock_label">Choose new lock</string>
|
||||||
|
<!-- Title for Private Space setup success screen. [CHAR LIMIT=30] -->
|
||||||
|
<string name="privatespace_success_title">All set!</string>
|
||||||
|
<!-- Summary for the Private Space setup success screen. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="privatespace_access_text">To access Private Space, swipe up from the bottom of your home screen, then scroll down</string>
|
||||||
|
<!-- Label for Private Space done button to show a toast, finish setup and launch All apps [CHAR LIMIT=30] -->
|
||||||
|
<string name="privatespace_done_label">Done</string>
|
||||||
|
<!-- Toast to show on private space setup completion informing user to scroll down All apps to access private space. [CHAR LIMIT=60] -->
|
||||||
|
<string name="scrolldown_to_access">Scroll down to access Private Space</string>
|
||||||
|
|
||||||
<!-- Text shown when "Add fingerprint" button is disabled -->
|
<!-- Text shown when "Add fingerprint" button is disabled -->
|
||||||
<string name="fingerprint_add_max">You can add up to <xliff:g id="count" example="5">%d</xliff:g> fingerprints</string>
|
<string name="fingerprint_add_max">You can add up to <xliff:g id="count" example="5">%d</xliff:g> fingerprints</string>
|
||||||
|
@@ -0,0 +1,150 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.privatespace;
|
||||||
|
|
||||||
|
import static com.android.settings.privatespace.PrivateSpaceSetupActivity.SET_LOCK_ACTION;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.os.UserHandle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.util.Pair;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.activity.OnBackPressedCallback;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
|
||||||
|
import com.google.android.setupdesign.GlifLayout;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/** Fragment to show screens that auto advance during private space setup flow */
|
||||||
|
public class AutoAdvanceSetupFragment extends Fragment {
|
||||||
|
private static final String TAG = "AutoAdvanceFragment";
|
||||||
|
private static final String TITLE_INDEX = "title_index";
|
||||||
|
private static final int DELAY_BETWEEN_SCREENS = 5000; // 5 seconds in millis
|
||||||
|
private GlifLayout mRootView;
|
||||||
|
private Handler mHandler;
|
||||||
|
private int mScreenTitleIndex;
|
||||||
|
private static final List<Pair<Integer, Integer>> HEADER_IMAGE_PAIRS =
|
||||||
|
ImmutableList.of(
|
||||||
|
new Pair(R.string.privatespace_lock_protected_title,
|
||||||
|
R.drawable.privatespace_setup_flow_placeholder),
|
||||||
|
new Pair(R.string.privatespace_apps_hidden_title,
|
||||||
|
R.drawable.privatespace_setup_flow_placeholder),
|
||||||
|
new Pair(R.string.privatespace_access_from_apps_title,
|
||||||
|
R.drawable.privatespace_setup_flow_placeholder));
|
||||||
|
|
||||||
|
private Runnable mUpdateScreenResources =
|
||||||
|
new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (getActivity() != null) {
|
||||||
|
if (++mScreenTitleIndex < HEADER_IMAGE_PAIRS.size()) {
|
||||||
|
updateHeaderAndImage();
|
||||||
|
mHandler.postDelayed(mUpdateScreenResources, DELAY_BETWEEN_SCREENS);
|
||||||
|
} else {
|
||||||
|
PrivateSpaceMaintainer privateSpaceMaintainer = PrivateSpaceMaintainer
|
||||||
|
.getInstance(getActivity());
|
||||||
|
UserHandle userHandle;
|
||||||
|
if (privateSpaceMaintainer.doesPrivateSpaceExist() && (userHandle =
|
||||||
|
privateSpaceMaintainer.getPrivateProfileHandle()) != null) {
|
||||||
|
startActivityInPrivateUser(userHandle);
|
||||||
|
} else {
|
||||||
|
showPrivateSpaceErrorScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(
|
||||||
|
LayoutInflater inflater,
|
||||||
|
@Nullable ViewGroup container,
|
||||||
|
@Nullable Bundle savedInstanceState) {
|
||||||
|
if (savedInstanceState == null) {
|
||||||
|
if (PrivateSpaceMaintainer.getInstance(getActivity()).createPrivateSpace()) {
|
||||||
|
Log.i(TAG, "Private Space created");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mScreenTitleIndex = savedInstanceState.getInt(TITLE_INDEX);
|
||||||
|
if (mScreenTitleIndex >= HEADER_IMAGE_PAIRS.size()) {
|
||||||
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mRootView =
|
||||||
|
(GlifLayout)
|
||||||
|
inflater.inflate(R.layout.privatespace_advancing_screen, container, false);
|
||||||
|
updateHeaderAndImage();
|
||||||
|
mHandler = new Handler(Looper.getMainLooper());
|
||||||
|
mHandler.postDelayed(mUpdateScreenResources, DELAY_BETWEEN_SCREENS);
|
||||||
|
OnBackPressedCallback callback =
|
||||||
|
new OnBackPressedCallback(true /* enabled by default */) {
|
||||||
|
@Override
|
||||||
|
public void handleOnBackPressed() {
|
||||||
|
// Handle the back button event. We intentionally don't want to allow back
|
||||||
|
// button to work in this screen during the setup flow.
|
||||||
|
}
|
||||||
|
};
|
||||||
|
requireActivity().getOnBackPressedDispatcher().addCallback(this, callback);
|
||||||
|
return mRootView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(@NotNull Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
outState.putInt(TITLE_INDEX, mScreenTitleIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
mHandler.removeCallbacks(mUpdateScreenResources);
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
|
private void startActivityInPrivateUser(UserHandle userHandle) {
|
||||||
|
/* Start new activity in private profile which is needed to set private profile lock */
|
||||||
|
Intent intent = new Intent(getContext(), PrivateProfileContextHelperActivity.class);
|
||||||
|
getActivity().startActivityForResultAsUser(intent, SET_LOCK_ACTION, userHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showPrivateSpaceErrorScreen() {
|
||||||
|
NavHostFragment.findNavController(AutoAdvanceSetupFragment.this)
|
||||||
|
.navigate(R.id.action_advance_profile_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateHeaderAndImage() {
|
||||||
|
mRootView.setHeaderText(HEADER_IMAGE_PAIRS.get(mScreenTitleIndex).first);
|
||||||
|
((ImageView) mRootView.findViewById(R.id.placeholder_image))
|
||||||
|
.setImageResource(HEADER_IMAGE_PAIRS.get(mScreenTitleIndex).second);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.privatespace;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.SetupWizardUtils;
|
||||||
|
|
||||||
|
import com.google.android.setupdesign.util.ThemeHelper;
|
||||||
|
|
||||||
|
/** Activity that is started as private profile user that helps to set private profile lock. */
|
||||||
|
public class PrivateProfileContextHelperActivity extends FragmentActivity {
|
||||||
|
private static final String TAG = "PrivateProfileHelper";
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
|
||||||
|
ThemeHelper.trySetDynamicColor(this);
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.privatespace_setup_root);
|
||||||
|
NavHostFragment navHostFragment = (NavHostFragment) getSupportFragmentManager()
|
||||||
|
.findFragmentById(R.id.ps_nav_host_fragment);
|
||||||
|
navHostFragment.getNavController().setGraph(R.navigation.privatespace_private_context_nav);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.privatespace;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.activity.OnBackPressedCallback;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
|
||||||
|
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||||
|
import com.google.android.setupcompat.template.FooterButton;
|
||||||
|
import com.google.android.setupdesign.GlifLayout;
|
||||||
|
|
||||||
|
/** Fragment to display error screen if creation of private profile failed for any reason. */
|
||||||
|
public class PrivateProfileCreationError extends Fragment {
|
||||||
|
@Override
|
||||||
|
public View onCreateView(
|
||||||
|
LayoutInflater inflater,
|
||||||
|
@Nullable ViewGroup container,
|
||||||
|
@Nullable Bundle savedInstanceState) {
|
||||||
|
GlifLayout rootView =
|
||||||
|
(GlifLayout)
|
||||||
|
inflater.inflate(R.layout.privatespace_creation_error, container, false);
|
||||||
|
final FooterBarMixin mixin = rootView.getMixin(FooterBarMixin.class);
|
||||||
|
mixin.setPrimaryButton(
|
||||||
|
new FooterButton.Builder(getContext())
|
||||||
|
.setText(R.string.privatespace_tryagain_label)
|
||||||
|
.setListener(onTryAgain())
|
||||||
|
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||||
|
.setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
|
||||||
|
.build());
|
||||||
|
mixin.setSecondaryButton(
|
||||||
|
new FooterButton.Builder(getContext())
|
||||||
|
.setText(R.string.privatespace_cancel_label)
|
||||||
|
.setListener(onCancel())
|
||||||
|
.setButtonType(FooterButton.ButtonType.CANCEL)
|
||||||
|
.setTheme(
|
||||||
|
androidx.appcompat.R.style
|
||||||
|
.Base_TextAppearance_AppCompat_Widget_Button)
|
||||||
|
.build());
|
||||||
|
OnBackPressedCallback callback =
|
||||||
|
new OnBackPressedCallback(true /* enabled by default */) {
|
||||||
|
@Override
|
||||||
|
public void handleOnBackPressed() {
|
||||||
|
// Handle the back button event. We intentionally don't want to allow back
|
||||||
|
// button to work in this screen during the setup flow.
|
||||||
|
}
|
||||||
|
};
|
||||||
|
requireActivity().getOnBackPressedDispatcher().addCallback(this, callback);
|
||||||
|
|
||||||
|
return rootView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private View.OnClickListener onTryAgain() {
|
||||||
|
return v -> {
|
||||||
|
NavHostFragment.findNavController(PrivateProfileCreationError.this)
|
||||||
|
.navigate(R.id.action_retry_profile_creation);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private View.OnClickListener onCancel() {
|
||||||
|
return v -> {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
activity.finish();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@@ -24,6 +24,7 @@ import android.view.ViewGroup;
|
|||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
|
||||||
@@ -49,7 +50,6 @@ public class PrivateSpaceEducation extends Fragment {
|
|||||||
.setButtonType(FooterButton.ButtonType.NEXT)
|
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||||
.setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
|
.setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
|
||||||
.build());
|
.build());
|
||||||
mixin.getPrimaryButtonView().setFilterTouchesWhenObscured(true);
|
|
||||||
mixin.setSecondaryButton(
|
mixin.setSecondaryButton(
|
||||||
new FooterButton.Builder(getContext())
|
new FooterButton.Builder(getContext())
|
||||||
.setText(R.string.privatespace_cancel_label)
|
.setText(R.string.privatespace_cancel_label)
|
||||||
@@ -59,29 +59,24 @@ public class PrivateSpaceEducation extends Fragment {
|
|||||||
androidx.appcompat.R.style
|
androidx.appcompat.R.style
|
||||||
.Base_TextAppearance_AppCompat_Widget_Button)
|
.Base_TextAppearance_AppCompat_Widget_Button)
|
||||||
.build());
|
.build());
|
||||||
mixin.getSecondaryButtonView().setFilterTouchesWhenObscured(true);
|
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener onSetup() {
|
private View.OnClickListener onSetup() {
|
||||||
return v -> {
|
return v -> {
|
||||||
if (PrivateSpaceMaintainer.getInstance(getContext()).createPrivateSpace()) {
|
NavHostFragment.findNavController(PrivateSpaceEducation.this)
|
||||||
finishActivity();
|
.navigate(R.id.action_education_to_auto_advance);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener onCancel() {
|
private View.OnClickListener onCancel() {
|
||||||
return v -> {
|
return v -> {
|
||||||
finishActivity();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void finishActivity() {
|
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
activity.finish();
|
activity.finish();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,6 +162,15 @@ public class PrivateSpaceMaintainer {
|
|||||||
/* title= */ null, /* description= */ null);
|
/* title= */ null, /* description= */ null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns Private profile user handle if private profile exists otherwise returns null. */
|
||||||
|
@Nullable
|
||||||
|
public synchronized UserHandle getPrivateProfileHandle() {
|
||||||
|
if (doesPrivateSpaceExist()) {
|
||||||
|
return mUserHandle;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns the instance of {@link PrivateSpaceMaintainer} */
|
/** Returns the instance of {@link PrivateSpaceMaintainer} */
|
||||||
public static synchronized PrivateSpaceMaintainer getInstance(Context context) {
|
public static synchronized PrivateSpaceMaintainer getInstance(Context context) {
|
||||||
if (sPrivateSpaceMaintainer == null) {
|
if (sPrivateSpaceMaintainer == null) {
|
||||||
|
@@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.privatespace;
|
||||||
|
|
||||||
|
import static android.app.Activity.RESULT_OK;
|
||||||
|
import static android.app.admin.DevicePolicyManager.ACTION_SET_NEW_PASSWORD;
|
||||||
|
import static android.app.admin.DevicePolicyManager.EXTRA_PASSWORD_COMPLEXITY;
|
||||||
|
import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_LOW;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.KeyguardManager;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.activity.OnBackPressedCallback;
|
||||||
|
import androidx.activity.result.ActivityResult;
|
||||||
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
|
||||||
|
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||||
|
import com.google.android.setupcompat.template.FooterButton;
|
||||||
|
import com.google.android.setupdesign.GlifLayout;
|
||||||
|
|
||||||
|
/** Fragment that provides an option to user to choose between the existing screen lock or set a
|
||||||
|
* separate private profile lock. */
|
||||||
|
public class PrivateSpaceSetLockFragment extends Fragment {
|
||||||
|
private final ActivityResultLauncher<Intent> mVerifyDeviceLock =
|
||||||
|
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
|
||||||
|
this::onSetDeviceNewLock);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(
|
||||||
|
LayoutInflater inflater,
|
||||||
|
@Nullable ViewGroup container,
|
||||||
|
@Nullable Bundle savedInstanceState) {
|
||||||
|
GlifLayout rootView =
|
||||||
|
(GlifLayout) inflater.inflate(
|
||||||
|
R.layout.privatespace_setlock_screen, container, false);
|
||||||
|
final FooterBarMixin mixin = rootView.getMixin(FooterBarMixin.class);
|
||||||
|
mixin.setPrimaryButton(
|
||||||
|
new FooterButton.Builder(getContext())
|
||||||
|
.setText(R.string.privatespace_use_screenlock_label)
|
||||||
|
.setListener(onClickUse())
|
||||||
|
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||||
|
.setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
|
||||||
|
.build());
|
||||||
|
mixin.setSecondaryButton(
|
||||||
|
new FooterButton.Builder(getContext())
|
||||||
|
.setText(R.string.privatespace_set_lock_label)
|
||||||
|
.setListener(onClickNewLock())
|
||||||
|
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||||
|
.setTheme(
|
||||||
|
androidx.appcompat.R.style
|
||||||
|
.Base_TextAppearance_AppCompat_Widget_Button)
|
||||||
|
.build());
|
||||||
|
OnBackPressedCallback callback =
|
||||||
|
new OnBackPressedCallback(true /* enabled by default */) {
|
||||||
|
@Override
|
||||||
|
public void handleOnBackPressed() {
|
||||||
|
// Handle the back button event. We intentionally don't want to allow back
|
||||||
|
// button to work in this screen during the setup flow.
|
||||||
|
}
|
||||||
|
};
|
||||||
|
requireActivity().getOnBackPressedDispatcher().addCallback(this, callback);
|
||||||
|
|
||||||
|
return rootView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private View.OnClickListener onClickUse() {
|
||||||
|
return v -> {
|
||||||
|
// Simply Use default screen lock. No need to handle
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
activity.setResult(RESULT_OK);
|
||||||
|
activity.finish();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private View.OnClickListener onClickNewLock() {
|
||||||
|
return v -> {
|
||||||
|
createPrivateSpaceLock();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createPrivateSpaceLock() {
|
||||||
|
final Intent intent = new Intent(ACTION_SET_NEW_PASSWORD);
|
||||||
|
intent.putExtra(EXTRA_PASSWORD_COMPLEXITY, PASSWORD_COMPLEXITY_LOW);
|
||||||
|
mVerifyDeviceLock.launch(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onSetDeviceNewLock(@Nullable ActivityResult result) {
|
||||||
|
// TODO(b/307281644) : Verify this for biometrics and check result code after new
|
||||||
|
// Authentication changes are merged.
|
||||||
|
if (result != null) {
|
||||||
|
Activity profileContextHelperActivity = getActivity();
|
||||||
|
if (profileContextHelperActivity != null && profileContextHelperActivity
|
||||||
|
.getSystemService(KeyguardManager.class).isDeviceSecure()) {
|
||||||
|
profileContextHelperActivity.setResult(RESULT_OK);
|
||||||
|
profileContextHelperActivity.finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -16,8 +16,10 @@
|
|||||||
|
|
||||||
package com.android.settings.privatespace;
|
package com.android.settings.privatespace;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.navigation.fragment.NavHostFragment;
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
|
|
||||||
@@ -26,15 +28,26 @@ import com.android.settings.SetupWizardUtils;
|
|||||||
|
|
||||||
import com.google.android.setupdesign.util.ThemeHelper;
|
import com.google.android.setupdesign.util.ThemeHelper;
|
||||||
|
|
||||||
|
/** Activity class that helps in setting up of private space */
|
||||||
public class PrivateSpaceSetupActivity extends FragmentActivity {
|
public class PrivateSpaceSetupActivity extends FragmentActivity {
|
||||||
|
public static final int SET_LOCK_ACTION = 1;
|
||||||
|
private NavHostFragment mNavHostFragment;
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
|
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
|
||||||
ThemeHelper.trySetDynamicColor(this);
|
ThemeHelper.trySetDynamicColor(this);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.privatespace_setup_root);
|
setContentView(R.layout.privatespace_setup_root);
|
||||||
NavHostFragment navHostFragment = (NavHostFragment) getSupportFragmentManager()
|
mNavHostFragment = (NavHostFragment) getSupportFragmentManager()
|
||||||
.findFragmentById(R.id.ps_nav_host_fragment);
|
.findFragmentById(R.id.ps_nav_host_fragment);
|
||||||
navHostFragment.getNavController().setGraph(R.navigation.privatespace_main_context_nav);
|
mNavHostFragment.getNavController().setGraph(R.navigation.privatespace_main_context_nav);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
|
if (requestCode == SET_LOCK_ACTION && resultCode == RESULT_OK) {
|
||||||
|
mNavHostFragment.getNavController().navigate(R.id.action_advance_to_success);
|
||||||
|
}
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.privatespace;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.activity.OnBackPressedCallback;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
|
||||||
|
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||||
|
import com.google.android.setupcompat.template.FooterButton;
|
||||||
|
import com.google.android.setupdesign.GlifLayout;
|
||||||
|
|
||||||
|
/** Fragment for the final screen shown on successful completion of private space setup. */
|
||||||
|
public class SetupSuccessFragment extends Fragment {
|
||||||
|
private static final String TAG = "SetupSuccessFragment";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(
|
||||||
|
LayoutInflater inflater,
|
||||||
|
@Nullable ViewGroup container,
|
||||||
|
@Nullable Bundle savedInstanceState) {
|
||||||
|
GlifLayout rootView =
|
||||||
|
(GlifLayout)
|
||||||
|
inflater.inflate(R.layout.privatespace_setup_success, container, false);
|
||||||
|
final FooterBarMixin mixin = rootView.getMixin(FooterBarMixin.class);
|
||||||
|
mixin.setPrimaryButton(
|
||||||
|
new FooterButton.Builder(getContext())
|
||||||
|
.setText(R.string.privatespace_done_label)
|
||||||
|
.setListener(onClickNext())
|
||||||
|
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||||
|
.setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
|
||||||
|
.build());
|
||||||
|
OnBackPressedCallback callback =
|
||||||
|
new OnBackPressedCallback(true /* enabled by default */) {
|
||||||
|
@Override
|
||||||
|
public void handleOnBackPressed() {
|
||||||
|
// Handle the back button event. We intentionally don't want to allow back
|
||||||
|
// button to work in this screen during the setup flow.
|
||||||
|
}
|
||||||
|
};
|
||||||
|
requireActivity().getOnBackPressedDispatcher().addCallback(this, callback);
|
||||||
|
|
||||||
|
return rootView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private View.OnClickListener onClickNext() {
|
||||||
|
return v -> {
|
||||||
|
accessPrivateSpaceToast();
|
||||||
|
// TODO: Replace with the intent to launch PS/PS Launch Settings
|
||||||
|
Intent startMain = new Intent(Intent.ACTION_MAIN);
|
||||||
|
startMain.addCategory(Intent.CATEGORY_HOME);
|
||||||
|
startActivity(startMain);
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
activity.finish();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void accessPrivateSpaceToast() {
|
||||||
|
Toast.makeText(getContext(), R.string.scrolldown_to_access, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user