android.support.annotation.RestrictTo Java Examples
The following examples show how to use
android.support.annotation.RestrictTo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConnectRequest.java From Android-BLE with Apache License 2.0 | 6 votes |
/** * 兼容原生android系统直接断开系统蓝牙导致的异常 * 直接断开系统蓝牙不回调onConnectionStateChange接口问题 */ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) public void disconnectBluetooth(){ if (!connectedDevices.isEmpty()){ for (T device: connectedDevices) { if (null != connectCallback){ device.setConnectionState(BleDevice.DISCONNECT); BleLog.e(TAG, "System Bluetooth is disconnected>>>> "+device.getBleName()); connectCallback.onConnectionChanged(device); } } bleRequest.close(); connectedDevices.clear(); devices.clear(); } }
Example #2
Source File: BrowserActionsIntent.java From custom-tabs-client with Apache License 2.0 | 6 votes |
/** @hide */ @RestrictTo(LIBRARY_GROUP) @VisibleForTesting static void launchIntent(Context context, Intent intent, List<ResolveInfo> handlers) { if (handlers == null || handlers.size() == 0) { openFallbackBrowserActionsMenu(context, intent); return; } else if (handlers.size() == 1) { intent.setPackage(handlers.get(0).activityInfo.packageName); } else { Intent viewIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(TEST_URL)); PackageManager pm = context.getPackageManager(); ResolveInfo defaultHandler = pm.resolveActivity(viewIntent, PackageManager.MATCH_DEFAULT_ONLY); if (defaultHandler != null) { String defaultPackageName = defaultHandler.activityInfo.packageName; for (int i = 0; i < handlers.size(); i++) { if (defaultPackageName.equals(handlers.get(i).activityInfo.packageName)) { intent.setPackage(defaultPackageName); break; } } } } ContextCompat.startActivity(context, intent, null); }
Example #3
Source File: VectorDrawableCompat.java From VectorChildFinder with Apache License 2.0 | 6 votes |
/** * The size of a pixel when scaled from the intrinsic dimension to the viewport dimension. This * is used to calculate the path animation accuracy. * * @hide */ @RestrictTo(LIBRARY_GROUP) public float getPixelSize() { if (mVectorState == null && mVectorState.mVPathRenderer == null || mVectorState.mVPathRenderer.mBaseWidth == 0 || mVectorState.mVPathRenderer.mBaseHeight == 0 || mVectorState.mVPathRenderer.mViewportHeight == 0 || mVectorState.mVPathRenderer.mViewportWidth == 0) { return 1; // fall back to 1:1 pixel mapping. } float intrinsicWidth = mVectorState.mVPathRenderer.mBaseWidth; float intrinsicHeight = mVectorState.mVPathRenderer.mBaseHeight; float viewportWidth = mVectorState.mVPathRenderer.mViewportWidth; float viewportHeight = mVectorState.mVPathRenderer.mViewportHeight; float scaleX = viewportWidth / intrinsicWidth; float scaleY = viewportHeight / intrinsicHeight; return Math.min(scaleX, scaleY); }
Example #4
Source File: Util.java From android-perftracking with MIT License | 6 votes |
/** * Check if the application is debuggable. * * <p>This method check if the application is signed by a debug key. * https://stackoverflow.com/questions/7085644/how-to-check-if-apk-is-signed-or-debug-build * * @param context application context * @return true if app is debuggable, false otherwise */ @RestrictTo(LIBRARY) @VisibleForTesting(otherwise = PACKAGE_PRIVATE) static boolean isAppDebuggable(@NonNull final Context context) { try { PackageManager packageManager = context.getPackageManager(); PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES); Signature[] signatures = packageInfo.signatures; CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); for (Signature signature : signatures) { ByteArrayInputStream stream = new ByteArrayInputStream(signature.toByteArray()); X509Certificate cert = (X509Certificate) certificateFactory.generateCertificate(stream); String principal = cert.getSubjectX500Principal().toString().toUpperCase(); return principal.contains("C=US") && principal.contains("O=ANDROID") && principal.contains("CN=ANDROID DEBUG"); } } catch (Exception e) { // Things went south, anyway the app is not debuggable. } return false; }
Example #5
Source File: SetupStepsFactory.java From spark-setup-android with Apache License 2.0 | 5 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY) public WaitForCloudConnectivityStep newWaitForCloudConnectivityStep(Context context) { return new WaitForCloudConnectivityStep( StepConfig.newBuilder() .setMaxAttempts(MAX_RETRIES_DISCONNECT_FROM_DEVICE) .setResultCode(SuccessActivity.RESULT_FAILURE_NO_DISCONNECT) .setStepId(R.id.check_for_internet_connectivity) .build(), context.getApplicationContext()); }
Example #6
Source File: LinearLayoutManager.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * @hide This method should be called by ItemTouchHelper only. */ @RestrictTo(LIBRARY_GROUP) @Override public void prepareForDrop(View view, View target, int x, int y) { assertNotInLayoutOrScroll("Cannot drop a view during a scroll or layout calculation"); ensureLayoutState(); resolveShouldLayoutReverse(); final int myPos = getPosition(view); final int targetPos = getPosition(target); final int dropDirection = myPos < targetPos ? LayoutState.ITEM_DIRECTION_TAIL : LayoutState.ITEM_DIRECTION_HEAD; if (mShouldReverseLayout) { if (dropDirection == LayoutState.ITEM_DIRECTION_TAIL) { scrollToPositionWithOffset(targetPos, mOrientationHelper.getEndAfterPadding() - (mOrientationHelper.getDecoratedStart(target) + mOrientationHelper.getDecoratedMeasurement(view))); } else { scrollToPositionWithOffset(targetPos, mOrientationHelper.getEndAfterPadding() - mOrientationHelper.getDecoratedEnd(target)); } } else { if (dropDirection == LayoutState.ITEM_DIRECTION_HEAD) { scrollToPositionWithOffset(targetPos, mOrientationHelper.getDecoratedStart(target)); } else { scrollToPositionWithOffset(targetPos, mOrientationHelper.getDecoratedEnd(target) - mOrientationHelper.getDecoratedMeasurement(view)); } } }
Example #7
Source File: SetupStepsFactory.java From spark-setup-android with Apache License 2.0 | 5 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY) public EnsureSoftApNotVisible newEnsureSoftApNotVisible(SSID deviceSoftApSsid, WifiFacade wifiFacade) { return new EnsureSoftApNotVisible( StepConfig.newBuilder() .setMaxAttempts(MAX_RETRIES_DISCONNECT_FROM_DEVICE) .setResultCode(SuccessActivity.RESULT_FAILURE_CONFIGURE) .setStepId(R.id.wait_for_device_cloud_connection) .build(), deviceSoftApSsid, wifiFacade); }
Example #8
Source File: LinearLayoutManager.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * @hide This method should be called by ItemTouchHelper only. */ @RestrictTo(LIBRARY_GROUP) @Override public void prepareForDrop(View view, View target, int x, int y) { assertNotInLayoutOrScroll("Cannot drop a view during a scroll or layout calculation"); ensureLayoutState(); resolveShouldLayoutReverse(); final int myPos = getPosition(view); final int targetPos = getPosition(target); final int dropDirection = myPos < targetPos ? LayoutState.ITEM_DIRECTION_TAIL : LayoutState.ITEM_DIRECTION_HEAD; if (mShouldReverseLayout) { if (dropDirection == LayoutState.ITEM_DIRECTION_TAIL) { scrollToPositionWithOffset(targetPos, mOrientationHelper.getEndAfterPadding() - (mOrientationHelper.getDecoratedStart(target) + mOrientationHelper.getDecoratedMeasurement(view))); } else { scrollToPositionWithOffset(targetPos, mOrientationHelper.getEndAfterPadding() - mOrientationHelper.getDecoratedEnd(target)); } } else { if (dropDirection == LayoutState.ITEM_DIRECTION_HEAD) { scrollToPositionWithOffset(targetPos, mOrientationHelper.getDecoratedStart(target)); } else { scrollToPositionWithOffset(targetPos, mOrientationHelper.getDecoratedEnd(target) - mOrientationHelper.getDecoratedMeasurement(view)); } } }
Example #9
Source File: SetupStepsFactory.java From spark-setup-android with Apache License 2.0 | 5 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY) public CheckIfDeviceClaimedStep newCheckIfDeviceClaimedStep(ParticleCloud sparkCloud, String deviceId) { return new CheckIfDeviceClaimedStep( StepConfig.newBuilder() .setMaxAttempts(MAX_RETRIES_CLAIM) .setResultCode(SuccessActivity.RESULT_FAILURE_CLAIMING) .setStepId(R.id.verify_product_ownership) .build(), sparkCloud, deviceId); }
Example #10
Source File: LifecycleManager.java From sdl_java_suite with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * This method is used to ensure all of the methods in this class can remain private and no grantees can be made * to the developer what methods are available or not. * * @param sdlManager this must be a working manager instance * @return the internal interface that hooks into this manager */ @RestrictTo(RestrictTo.Scope.LIBRARY) public ISdl getInternalInterface(SdlManager sdlManager) { if (sdlManager != null) { return internalInterface; } return null; }
Example #11
Source File: SetupStepsFactory.java From spark-setup-android with Apache License 2.0 | 5 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY) public WaitForDisconnectionFromDeviceStep newWaitForDisconnectionFromDeviceStep(SSID deviceSoftApSsid, WifiFacade wifiFacade) { return new WaitForDisconnectionFromDeviceStep( StepConfig.newBuilder() .setMaxAttempts(MAX_RETRIES_DISCONNECT_FROM_DEVICE) .setResultCode(SuccessActivity.RESULT_FAILURE_NO_DISCONNECT) .setStepId(R.id.reconnect_to_wifi_network) .build(), deviceSoftApSsid, wifiFacade); }
Example #12
Source File: SetupStepsFactory.java From spark-setup-android with Apache License 2.0 | 5 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY) public ConnectDeviceToNetworkStep newConnectDeviceToNetworkStep(CommandClient commandClient, SetupStepApReconnector reconnector) { return new ConnectDeviceToNetworkStep( StepConfig.newBuilder() .setMaxAttempts(MAX_RETRIES_CONNECT_AP) .setResultCode(SuccessActivity.RESULT_FAILURE_CONFIGURE) .setStepId(R.id.connect_to_wifi_network) .build(), commandClient, reconnector); }
Example #13
Source File: SetupStepsFactory.java From spark-setup-android with Apache License 2.0 | 5 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY) public ConfigureAPStep newConfigureApStep(CommandClient commandClient, SetupStepApReconnector reconnector, ScanApCommand.Scan networkToConnectTo, String networkSecretPlaintext, PublicKey publicKey) { return new ConfigureAPStep( StepConfig.newBuilder() .setMaxAttempts(MAX_RETRIES_CONFIGURE_AP) .setResultCode(SuccessActivity.RESULT_FAILURE_CONFIGURE) .setStepId(R.id.configure_device_wifi_credentials) .build(), commandClient, reconnector, networkToConnectTo, networkSecretPlaintext, publicKey); }
Example #14
Source File: BrowserActionItem.java From custom-tabs-client with Apache License 2.0 | 5 votes |
/** @hide */ @RestrictTo(LIBRARY_GROUP) public BrowserActionItem( @NonNull String title, @NonNull PendingIntent action, @NonNull Uri iconUri) { mTitle = title; mAction = action; mIconUri = iconUri; }
Example #15
Source File: ControllerImpl.java From MiPushFramework with GNU General Public License v3.0 | 5 votes |
@SuppressLint("MissingPermission") @NonNull @RestrictTo(RestrictTo.Scope.LIBRARY) public static PushController getConnected(@NonNull Context context, @Nullable final AbstractConnectionStatusListener disconnectListener) { PushController controller = new ControllerImpl(context); if (disconnectListener != null) new Handler(Looper.getMainLooper()) .postDelayed(disconnectListener::onReady, 300); return controller; }
Example #16
Source File: MutableStatusBarNotification.java From sdk with Apache License 2.0 | 4 votes |
@RestrictTo(LIBRARY) protected MutableStatusBarNotification(final String pkg, final String opPkg, final int id, final String tag, final int uid, final int initialPid, final MutableNotification notification, final UserHandle user, final long postTime) { super(pkg, opPkg, id, tag, uid, initialPid, 0/* unused */, notification, user, postTime); mTag = tag; mId = id; }
Example #17
Source File: DiscoverProcessWorker.java From spark-setup-android with Apache License 2.0 | 4 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY) DiscoverProcessWorker withClient(CommandClient client) { this.client = client; return this; }
Example #18
Source File: BrowserActionItem.java From custom-tabs-client with Apache License 2.0 | 4 votes |
/** @hide */ @RestrictTo(LIBRARY_GROUP) Runnable getRunnableAction() { return mRunnableAction; }
Example #19
Source File: BusProvider.java From quill with MIT License | 4 votes |
@RestrictTo(RestrictTo.Scope.TESTS) public static void setupForTesting() { sBus = new Bus(ThreadEnforcer.ANY); }
Example #20
Source File: ApplicationModule.java From spark-setup-android with Apache License 2.0 | 4 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY) public ApplicationModule(Application application) { this.application = application; }
Example #21
Source File: BrowserActionsFallbackMenuUi.java From custom-tabs-client with Apache License 2.0 | 4 votes |
/** @hide */ @VisibleForTesting @RestrictTo(LIBRARY_GROUP) void setMenuUiListener(BrowserActionsFallMenuUiListener menuUiListener) { mMenuUiListener = menuUiListener; }
Example #22
Source File: ChipsLayoutManager.java From ChipsLayoutManager with Apache License 2.0 | 4 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @Override public int computeHorizontalScrollExtent(RecyclerView.State state) { return scrollingController.computeHorizontalScrollExtent(state); }
Example #23
Source File: ParticleDeviceSetupLibrary.java From spark-setup-android with Apache License 2.0 | 4 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY) public ApplicationComponent getApplicationComponent() { return applicationComponent; }
Example #24
Source File: ChipsLayoutManager.java From ChipsLayoutManager with Apache License 2.0 | 4 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @Override public int computeVerticalScrollRange(RecyclerView.State state) { return scrollingController.computeVerticalScrollRange(state); }
Example #25
Source File: ChipsLayoutManager.java From ChipsLayoutManager with Apache License 2.0 | 4 votes |
@NonNull @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) AnchorViewState getAnchor() { return anchorView; }
Example #26
Source File: ChipsLayoutManager.java From ChipsLayoutManager with Apache License 2.0 | 4 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @Override public int computeVerticalScrollExtent(RecyclerView.State state) { return scrollingController.computeVerticalScrollExtent(state); }
Example #27
Source File: ChipsLayoutManager.java From ChipsLayoutManager with Apache License 2.0 | 4 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @Override public int computeVerticalScrollOffset(RecyclerView.State state) { return scrollingController.computeVerticalScrollOffset(state); }
Example #28
Source File: ChipsLayoutManager.java From ChipsLayoutManager with Apache License 2.0 | 4 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @Override public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) { return scrollingController.scrollHorizontallyBy(dx, recycler, state); }
Example #29
Source File: ChipsLayoutManager.java From ChipsLayoutManager with Apache License 2.0 | 4 votes |
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @Override public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) { return scrollingController.scrollVerticallyBy(dy, recycler, state); }
Example #30
Source File: ChipsLayoutManager.java From ChipsLayoutManager with Apache License 2.0 | 4 votes |
@VisibleForTesting @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) void setSpy(ISpy spy) { this.spy = spy; }