Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c45ac96a authored by Olawale Ogunwale's avatar Olawale Ogunwale Committed by Android Git Automerger
Browse files

am ae5d653d: am dc797d5b: am e0b2cad0: Merge "Change attribute values per API...

am ae5d653d: am dc797d5b: am e0b2cad0: Merge "Change attribute values per API council." into mnc-dev

* commit 'ae5d653d':
  Change attribute values per API council.
parents fd59f746 ae5d653d
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -1070,29 +1070,29 @@
             is launched that task will or will not start depending on whether the package of this
             activity has been whitelisted.
             <p>Tasks rooted at this activity can only exit lockTask mode using stopLockTask(). -->
        <enum name="lockTaskModeDefault" value="0"/>
        <enum name="normal" value="0"/>
        <!-- Tasks will not launch into lockTask mode and cannot be placed there using
             {@link android.app.Activity#startLockTask} or be pinned from the Overview screen.
             If the system is already in lockTask mode when a new task rooted at this activity is
             launched that task will not be started.
             <p>Note: This mode is only available to system and privileged applications.
             Non-privileged apps with this value will be treated as lockTaskModeDefault.
             Non-privileged apps with this value will be treated as normal.
             -->
        <enum name="lockTaskModeNever" value="1"/>
        <enum name="never" value="1"/>
        <!-- Tasks rooted at this activity will always launch into lockTask mode. If the system is
             already in lockTask mode when this task is launched then the new task will be launched
             on top of the current task. Tasks launched in this mode are capable of exiting
             lockTask mode using finish(), whereas tasks entering lockTask mode using
             startLockTask() must use stopLockTask() to exit.
             <p>Note: This mode is only available to system and privileged applications.
             Non-privileged apps with this value will be treated as lockTaskModeDefault.
             Non-privileged apps with this value will be treated as normal.
             -->
        <enum name="lockTaskModeAlways" value="2"/>
        <enum name="always" value="2"/>
        <!-- If the DevicePolicyManager (DPM) authorizes this package ({@link
             android.app.admin.DevicePolicyManager#setLockTaskPackages}) then this mode is
             identical to lockTaskModeAlways. If the DPM does not authorize this package then this
             mode is identical to lockTaskModeDefault. -->
        <enum name="lockTaskModeIfWhitelisted" value="3"/>
             identical to always. If the DPM does not authorize this package then this
             mode is identical to normal. -->
        <enum name="if_whitelisted" value="3"/>
    </attr>
    <!-- When set installer will extract native libraries. If set to false
         libraries in the apk must be stored and page-aligned.  -->
+4 −4
Original line number Diff line number Diff line
@@ -29,28 +29,28 @@
            android:label="@string/title_activity_default"
            android:taskAffinity=""
            android:documentLaunchMode="always"
            android:lockTaskMode="lockTaskModeDefault" >
            android:lockTaskMode="normal" >
        </activity>
        <activity
            android:name="com.google.android.example.locktasktests.LockTaskNeverActivity"
            android:label="@string/title_activity_never"
            android:taskAffinity=""
            android:documentLaunchMode="always"
            android:lockTaskMode="lockTaskModeNever" >
            android:lockTaskMode="never" >
        </activity>
        <activity
            android:name="com.google.android.example.locktasktests.LockWhitelistedActivity"
            android:label="@string/title_activity_whitelist"
            android:taskAffinity=""
            android:documentLaunchMode="always"
            android:lockTaskMode="lockTaskModeIfWhitelisted" >
            android:lockTaskMode="if_whitelisted" >
        </activity>
        <activity
            android:name="com.google.android.example.locktasktests.LockAtLaunchActivity"
            android:label="@string/title_activity_always"
            android:taskAffinity=""
            android:documentLaunchMode="always"
            android:lockTaskMode="lockTaskModeAlways" >
            android:lockTaskMode="always" >
        </activity>
    </application>

+5 −4
Original line number Diff line number Diff line
@@ -7,16 +7,17 @@
    <string name="title_activity_whitelist">LockWhitelistedActivity</string>
    <string name="title_activity_always">LockAtLaunchActivity</string>
    <string name="launch_default">android:lockTaskMode=\n
            \"lockTaskModeDefault\"\n
            \"default\"\n
            Pinnable from Overview.</string>
    <string name="launch_never">android:lockTaskMode=\n
            \"lockTaskModeNever\"\n
            \"never\"\n
            Not Lockable or Pinnable.</string>
    <string name="launch_whitelist">android:lockTaskMode=\n\"lockTaskModeIfWhitelisted\"\n
    <string name="launch_whitelist">android:lockTaskMode=\n
            \"if_whitelisted\"\n
            Lockable if whitelisted, Pinnable.\n
            Use SampleDeviceOwner app to set whitelist.</string>
    <string name="launch_always">android:lockTaskMode=\n
            \"lockTaskModeAlways\"\n
            \"always\"\n
            Launches into lock mode.</string>
    <string name="launch_main">launch MainActivity (as activity)"</string>
    <string name="try_lock">Call startLockMode()</string>
+29 −5
Original line number Diff line number Diff line
@@ -6,26 +6,50 @@ import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.View;

public class MainActivity extends Activity {

    private final static String TAG = "LockTaskTests";
    Runnable mBackgroundPolling;
    boolean mRunning;
    Handler mHandler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

        mBackgroundPolling = new Runnable() {
            // Poll lock task state and set background pink if locked, otherwise white.
            @Override
    public void onResume() {
        super.onResume();
            public void run() {
                if (!mRunning) {
                    return;
                }
                ActivityManager activityManager =
                        (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
                final int color = activityManager.getLockTaskModeState() !=
                        ActivityManager.LOCK_TASK_MODE_NONE ? 0xFFFFC0C0 : 0xFFFFFFFF;
                findViewById(R.id.root_launch).setBackgroundColor(color);
                mHandler.postDelayed(this, 500);
            }
        };
        mHandler = new Handler(Looper.getMainLooper());
    }

    @Override
    public void onResume() {
        super.onResume();
        mRunning = true;
        mBackgroundPolling.run();
    }

    @Override
    public void onPause() {
        super.onPause();
        mRunning = false;
    }

    public void onButtonPressed(View v) {