Search in sources :

Example 1 with LocusId

use of android.content.LocusId in project robolectric by robolectric.

the class ShadowContentCaptureManagerTest method getContentCaptureConditions_withContentCaptureConditions.

@Test
public void getContentCaptureConditions_withContentCaptureConditions() {
    Set<ContentCaptureCondition> contentCaptureConditions = new HashSet<>();
    contentCaptureConditions.add(new ContentCaptureCondition(new LocusId("fake locusId"), 0));
    instance.setContentCaptureConditions(contentCaptureConditions);
    assertThat(instance.getContentCaptureConditions()).isEqualTo(contentCaptureConditions);
}
Also used : ContentCaptureCondition(android.view.contentcapture.ContentCaptureCondition) LocusId(android.content.LocusId) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with LocusId

use of android.content.LocusId in project android_packages_apps_404Launcher by P-404.

the class RecentsView method updateLocusId.

/**
 * Update the current activity locus id to show the enabled state of Overview
 */
public void updateLocusId() {
    String locusId = "Overview";
    if (mOverviewStateEnabled && mActivity.isStarted()) {
        locusId += "|ENABLED";
    } else {
        locusId += "|DISABLED";
    }
    final LocusId id = new LocusId(locusId);
    // Set locus context is a binder call, don't want it to happen during a transition
    UI_HELPER_EXECUTOR.post(() -> mActivity.setLocusContext(id, Bundle.EMPTY));
}
Also used : LocusId(android.content.LocusId)

Example 3 with LocusId

use of android.content.LocusId in project android_packages_apps_Launcher3 by crdroidandroid.

the class RecentsView method updateLocusId.

/**
 * Update the current activity locus id to show the enabled state of Overview
 */
public void updateLocusId() {
    String locusId = "Overview";
    if (mOverviewStateEnabled && mActivity.isStarted()) {
        locusId += "|ENABLED";
    } else {
        locusId += "|DISABLED";
    }
    final LocusId id = new LocusId(locusId);
    // Set locus context is a binder call, don't want it to happen during a transition
    UI_HELPER_EXECUTOR.post(() -> mActivity.setLocusContext(id, Bundle.EMPTY));
}
Also used : LocusId(android.content.LocusId)

Example 4 with LocusId

use of android.content.LocusId in project security-certification-resources by android.

the class MainActivity method setupLocusTest.

/**
 * Sets up the device for the ACCESS_LOCUS_ID_USAGE_STATS test.
 *
 * <p>The ACCESS_LOCUS_ID_USAGE_STATS permission allows an app to query for locus events
 * created by other apps. This method generates a locus event to ensure there is an event
 * on the device for which the permission test can query. For additional details about locus
 * events see <a href="https://developer.android.com/reference/android/content/LocusId">
 * LocusId</a>.
 */
private void setupLocusTest() {
    // permission was introduced in Android 11.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
        LocusId locusId = new LocusId("ACCESS_LOCUS_ID_USAGE_STATS_test");
        setLocusContext(locusId, null);
    }
}
Also used : LocusId(android.content.LocusId)

Example 5 with LocusId

use of android.content.LocusId in project android_packages_apps_Launcher3 by ArrowOS.

the class RecentsView method updateLocusId.

/**
 * Update the current activity locus id to show the enabled state of Overview
 */
public void updateLocusId() {
    String locusId = "Overview";
    if (mOverviewStateEnabled && mActivity.isStarted()) {
        locusId += "|ENABLED";
    } else {
        locusId += "|DISABLED";
    }
    final LocusId id = new LocusId(locusId);
    // Set locus context is a binder call, don't want it to happen during a transition
    UI_HELPER_EXECUTOR.post(() -> mActivity.setLocusContext(id, Bundle.EMPTY));
}
Also used : LocusId(android.content.LocusId)

Aggregations

LocusId (android.content.LocusId)7 ContentCaptureCondition (android.view.contentcapture.ContentCaptureCondition)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1