当前位置: 首页>>代码示例>>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;未经允许,请勿转载。