當前位置: 首頁>>代碼示例>>Java>>正文


Java AccessibilityServiceInfo類代碼示例

本文整理匯總了Java中android.accessibilityservice.AccessibilityServiceInfo的典型用法代碼示例。如果您正苦於以下問題:Java AccessibilityServiceInfo類的具體用法?Java AccessibilityServiceInfo怎麽用?Java AccessibilityServiceInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AccessibilityServiceInfo類屬於android.accessibilityservice包,在下文中一共展示了AccessibilityServiceInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: IsAccessibilityServiceEnabled

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
public boolean IsAccessibilityServiceEnabled(@NonNull String serviceId) {
    Logger.getInstance().Debug(TAG, String.format(Locale.getDefault(), "IsAccessibilityServiceEnabled for serviceId %s", serviceId));

    AccessibilityManager accessibilityManager = (AccessibilityManager) _context.getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (accessibilityManager == null) {
        Logger.getInstance().Error(TAG, "accessibilityManager is null!");
        return false;
    }

    List<AccessibilityServiceInfo> runningServices = accessibilityManager.getEnabledAccessibilityServiceList(AccessibilityEvent.TYPES_ALL_MASK);
    for (AccessibilityServiceInfo service : runningServices) {
        Logger.getInstance().Debug(TAG, String.format(Locale.getDefault(), "Found active service %s", service.getId()));
        if (serviceId.equals(service.getId())) {
            return true;
        }
    }

    return false;
}
 
開發者ID:GuepardoApps,項目名稱:LucaHome-AndroidApplication,代碼行數:20,代碼來源:AndroidSystemController.java

示例2: checkEnabledAccessibilityService

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
private boolean checkEnabledAccessibilityService() {
    if(isAccessibilitySettingsOn(this))
        return true;;
    List<AccessibilityServiceInfo> accessibilityServices =
            mAccessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK);
    for (AccessibilityServiceInfo info : accessibilityServices) {
        if (info.getId().equals(SERVICE_NAME)) {
            log.d(info.getId()+" "+info.toString());
            return true;
        }
    }
    Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
    return false;
}
 
開發者ID:yippeesoft,項目名稱:NotifyTools,代碼行數:17,代碼來源:JumpService.java

示例3: onCreate

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();
    tipViewController=TipViewController.getInstance();
    mAccessibilityServiceInfo=new AccessibilityServiceInfo();
    mAccessibilityServiceInfo.feedbackType=FEEDBACK_GENERIC;
    mAccessibilityServiceInfo.eventTypes=AccessibilityEvent.TYPE_VIEW_CLICKED|AccessibilityEvent.TYPE_VIEW_LONG_CLICKED|AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
    int flag=0;
    if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP){
        flag=flag|AccessibilityServiceInfo.FLAG_RETRIEVE_INTERACTIVE_WINDOWS;
    }
    if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.JELLY_BEAN_MR2){
        flag=flag|AccessibilityServiceInfo.FLAG_REQUEST_FILTER_KEY_EVENTS;
    }
    mAccessibilityServiceInfo.flags=flag;
    mAccessibilityServiceInfo.notificationTimeout=100;
    setServiceInfo(mAccessibilityServiceInfo);
}
 
開發者ID:l465659833,項目名稱:RecentTask,代碼行數:19,代碼來源:AccessibilityMonitorService.java

示例4: observeKey

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
public void observeKey() {
    if (mListeningKey)
        return;
    mScriptRuntime.ensureAccessibilityServiceEnabled();
    AccessibilityService service = mAccessibilityBridge.getService();
    if (service == null)
        throw new ScriptException("AccessibilityService = null");
    if ((service.getServiceInfo().flags & AccessibilityServiceInfo.FLAG_REQUEST_FILTER_KEY_EVENTS) == 0) {
        throw new ScriptException(mContext.getString(R.string.text_should_enable_key_observing));
    }
    ensureHandler();
    mLoopers.waitWhenIdle(true);
    mListeningKey = true;
    mAccessibilityBridge.ensureServiceEnabled();
    service.getOnKeyObserver().addListener(this);
}
 
開發者ID:hyb1996,項目名稱:Auto.js,代碼行數:17,代碼來源:Events.java

示例5: onServiceConnected

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
@Override
protected void onServiceConnected() {
    super.onServiceConnected();

    Log.i(TAG, "SublimeNavBarService connected");

    AccessibilityServiceInfo info = new AccessibilityServiceInfo();

    // Set the type of events that this service wants to listen to.  Others
    // won't be passed to this service. `TYPE_WINDOW_STATE_CHANGED`
    // has been used only for demo purposes.
    info.eventTypes = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;

    // Set the type of feedback your service will provide.
    info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;

    // no delay before we are notified about an accessibility event
    info.notificationTimeout = 0;

    setServiceInfo(info);

    mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
    addNavView();
}
 
開發者ID:vikramkakkar,項目名稱:SublimeNavBar,代碼行數:25,代碼來源:SublimeNavBarService.java

示例6: showFullScreen

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
private boolean showFullScreen() {
    final boolean isInExoticWindowMode;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        isInExoticWindowMode = activity.isInMultiWindowMode() || activity.isInPictureInPictureMode();
    } else {
        isInExoticWindowMode = false;
    }

    final boolean hasHardwareKeyboard =
            activity.getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS;

    final boolean hasAccessibilityEnabled;
    final AccessibilityManager manager = (AccessibilityManager) activity.getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (manager != null) {
        final List<AccessibilityServiceInfo> enabledAccessibilityServiceList
                = manager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK);
        hasAccessibilityEnabled = enabledAccessibilityServiceList != null && enabledAccessibilityServiceList.size() > 0;
    } else {
        hasAccessibilityEnabled = false;
    }

    return isInExoticWindowMode || hasHardwareKeyboard || hasAccessibilityEnabled;
}
 
開發者ID:zendesk,項目名稱:belvedere,代碼行數:24,代碼來源:ImageStreamUi.java

示例7: enableGoogleMapsMonitoring

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
private void enableGoogleMapsMonitoring(boolean enable) {
    try {
        AccessibilityServiceInfo serviceInfo = getServiceInfo();
        if (serviceInfo != null) {
            if (enable) {
                serviceInfo.eventTypes = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED |
                        AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED;
                serviceInfo.notificationTimeout = 500;
            } else {
                serviceInfo.eventTypes = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
                serviceInfo.notificationTimeout = 0;
            }
            setServiceInfo(serviceInfo);
        }
    } catch (Exception e) {
        if (!BuildConfig.DEBUG) {
            Crashlytics.logException(e);
        }
    }
}
 
開發者ID:plusCubed,項目名稱:velociraptor,代碼行數:21,代碼來源:AppDetectionService.java

示例8: onServiceConnected

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
@Override
protected void onServiceConnected() {
    super.onServiceConnected();

    packageManager = getPackageManager();
    notificationManager = NotificationManagerCompat.from(this);

    volumeReceiver = new VolumeReceiver(this);
    registerReceiver(volumeReceiver, new IntentFilter("android.media.VOLUME_CHANGED_ACTION"));

    notifications = new ArrayList<>();
    AccessibilityServiceInfo config = new AccessibilityServiceInfo();
    config.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED | AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
    config.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
        config.flags = AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS;

    setServiceInfo(config);
}
 
開發者ID:TheAndroidMaster,項目名稱:Status,代碼行數:21,代碼來源:AccessibilityService.java

示例9: updateServiceStatus

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
private void updateServiceStatus() {
    boolean serviceEnabled = false;

    AccessibilityManager accessibilityManager =
            (AccessibilityManager) getSystemService(Context.ACCESSIBILITY_SERVICE);
    List<AccessibilityServiceInfo> accessibilityServices =
            accessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_GENERIC);
    for (AccessibilityServiceInfo info : accessibilityServices) {
        if (info.getId().equals(getPackageName() + "/.services.HongbaoService")) {
            serviceEnabled = true;
            break;
        }
    }

    if (serviceEnabled) {
        switchPlugin.setText(R.string.service_off);
    } else {
        switchPlugin.setText(R.string.service_on);
    }
}
 
開發者ID:idctop,項目名稱:WeiXinHongBao,代碼行數:21,代碼來源:MainActivity.java

示例10: onAccessibilityEvent

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    AccessibilityServiceInfo serviceInfo = this.getServiceInfo();
    accessibilityId = serviceInfo.getId();

    PackageManager localPackageManager = getPackageManager();
    Intent intent = new Intent("android.intent.action.MAIN");
    intent.addCategory("android.intent.category.HOME");
    String launcher = localPackageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY).activityInfo.packageName;

    if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED && event.getPackageName() != null) {
        sPackageName = event.getPackageName().toString();
        Log.d(TAG, "Package Name is " + sPackageName);
        if ((System.currentTimeMillis() - time) < 1000) {
            if (!sPackageName.equals(launcher) || !sPackageName.equals("com.android.systemui")) {
                process_window_change(sPackageName);
            }
        } else if ((System.currentTimeMillis() - time) >= 1000) {
            process_window_change(sPackageName);
        }
    }
}
 
開發者ID:exynos5420,項目名稱:deathly_adiutor_free,代碼行數:23,代碼來源:PerAppMonitor.java

示例11: onServiceConnected

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
@Override
protected void onServiceConnected() {
    super.onServiceConnected();

    packageManager = getPackageManager();
    butterboard = (Butterboard) getApplicationContext();

    AccessibilityServiceInfo config = new AccessibilityServiceInfo();
    config.eventTypes = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
    config.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
        config.flags = AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS;

    setServiceInfo(config);
}
 
開發者ID:DoubleDotLabs,項目名稱:Butterboard,代碼行數:17,代碼來源:AccessibilityService.java

示例12: onAccessibilityEvent

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    AccessibilityServiceInfo serviceInfo = this.getServiceInfo();
    accessibilityId = serviceInfo.getId();

    if (event.getPackageName() == null || event.getEventType() != AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED)
        return;

    sPackageName = event.getPackageName().toString();
    Log.d(TAG, "Package Name is " + sPackageName);
    if (sPackageName.equals("com.android.systemui"))
        return;

    if ((System.currentTimeMillis() - time) < 2000) {
        if (!sPackageName.equals(UserLauncher())) {
            process_window_change(sPackageName);
        }
    } else {
        process_window_change(sPackageName);
    }

}
 
開發者ID:bhb27,項目名稱:KA27,代碼行數:23,代碼來源:PerAppMonitor.java

示例13: onAccessibilityEvent

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    AccessibilityServiceInfo serviceInfo = this.getServiceInfo();
    accessibilityId = serviceInfo.getId();

    PackageManager localPackageManager = getPackageManager();
    Intent intent = new Intent("android.intent.action.MAIN");
    intent.addCategory("android.intent.category.HOME");
    String launcher = localPackageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY).activityInfo.packageName;

    if(event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED && event.getPackageName() != null) {
        sPackageName = event.getPackageName().toString();
        Log.d(TAG, "Package Name is "+sPackageName);
        if ((System.currentTimeMillis() - time) < 1000) {
            if (!sPackageName.equals(launcher) || !sPackageName.equals("com.android.systemui")) {
                process_window_change(sPackageName);
            }
        }
        else if ((System.currentTimeMillis() - time) >= 1000) {
            process_window_change(sPackageName);
        }
    }
}
 
開發者ID:yoinx,項目名稱:kernel_adiutor,代碼行數:24,代碼來源:PerAppMonitor.java

示例14: onServiceConnected

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
@Override
    protected void onServiceConnected() {
        super.onServiceConnected();
        registerScreenReceiver();
        if (BuildConfig.DEBUG) {
            Log.d(TAG, "onServiceConnected: ");
        }
        sIsEnable = true;
        AccessibilityServiceInfo info = new AccessibilityServiceInfo();
        info.eventTypes = TYPE_WINDOW_CONTENT_CHANGED | TYPE_WINDOWS_CHANGED | TYPE_WINDOW_STATE_CHANGED | TYPE_NOTIFICATION_STATE_CHANGED;

        // If you only want this service to work with specific applications, set their
        // package names here.  Otherwise, when the service is activated, it will listen
        // to events from all applications.
        info.packageNames = new String[]{Constant.QQ_PKG};

        info.feedbackType = AccessibilityServiceInfo.FEEDBACK_SPOKEN;
//        info.flags = AccessibilityServiceInfo.DEFAULT;
        info.notificationTimeout = 100;

        this.setServiceInfo(info);
        setState(new IdleState(this));
    }
 
開發者ID:BCsl,項目名稱:WaterMonitor,代碼行數:24,代碼來源:VideoAccessibilityService.java

示例15: updateServiceStatus

import android.accessibilityservice.AccessibilityServiceInfo; //導入依賴的package包/類
private void updateServiceStatus() {
    boolean serviceEnabled = false;

    AccessibilityManager accessibilityManager =
            (AccessibilityManager) baseContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
    List<AccessibilityServiceInfo> accessibilityServices =
            accessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_GENERIC);
    for (AccessibilityServiceInfo info : accessibilityServices) {
        if (info.getId().equals(baseContext.getPackageName() + "/.services.QQService")) {
            serviceEnabled = true;
            break;
        }
    }

    if (!serviceEnabled) {
        btn.setText(R.string.service_open);
    } else {
        btn.setText(R.string.service_off);
    }
}
 
開發者ID:tttony3,項目名稱:WeChatHongBao,代碼行數:21,代碼來源:QQFragment.java


注:本文中的android.accessibilityservice.AccessibilityServiceInfo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。