@SuppressLint("InlinedApi") private static boolean isHandledMediaKey(int keyCode) { return keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD || keyCode == KeyEvent.KEYCODE_MEDIA_REWIND || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE || keyCode == KeyEvent.KEYCODE_MEDIA_NEXT || keyCode == KeyEvent.KEYCODE_MEDIA_PREVIOUS; }
@SuppressLint("InlinedApi") private boolean isDpadKey(int keyCode) { return keyCode == KeyEvent.KEYCODE_DPAD_UP || keyCode == KeyEvent.KEYCODE_DPAD_UP_RIGHT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT || keyCode == KeyEvent.KEYCODE_DPAD_DOWN_RIGHT || keyCode == KeyEvent.KEYCODE_DPAD_DOWN || keyCode == KeyEvent.KEYCODE_DPAD_DOWN_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_UP_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_CENTER; }
@SuppressLint("NewApi") public AnimatedZoomJob(ViewPortHandler viewPortHandler, View v, Transformer trans, YAxis axis, float xAxisRange, float scaleX, float scaleY, float xOrigin, float yOrigin, float zoomCenterX, float zoomCenterY, float zoomOriginX, float zoomOriginY, long duration) { super(viewPortHandler, scaleX, scaleY, trans, v, xOrigin, yOrigin, duration); this.zoomCenterX = zoomCenterX; this.zoomCenterY = zoomCenterY; this.zoomOriginX = zoomOriginX; this.zoomOriginY = zoomOriginY; this.animator.addListener(this); this.yAxis = axis; this.xAxisRange = xAxisRange; }
@SuppressLint("NewApi") @Override public void run() { animator.start(); }
@SuppressLint("StaticFieldLeak") void startAsyncWork() { // This runnable is an anonymous class and therefore has a hidden reference to the outer // class MainActivity. If the activity gets destroyed before the thread finishes (e.g. rotation), // the activity instance will leak. Runnable work = new Runnable() { @Override public void run() { // Do some slow work in background SystemClock.sleep(20000); } }; new Thread(work).start(); } }
@VisibleForTesting @SuppressLint("ValidFragment") RequestManagerFragment(@NonNull ActivityFragmentLifecycle lifecycle) { this.lifecycle = lifecycle; }
@VisibleForTesting @SuppressLint("ValidFragment") public SupportRequestManagerFragment(@NonNull ActivityFragmentLifecycle lifecycle) { this.lifecycle = lifecycle; }
@SuppressLint("CheckResult") @SuppressWarnings("PMD.ConstructorCallsOverridableMethod") protected RequestBuilder(Class<TranscodeType> transcodeClass, RequestBuilder<?> other) { this(other.glide, other.requestManager, transcodeClass, other.context); model = other.model; isModelSet = other.isModelSet; // This is safe because it will always mutate, no one else has access to the object. apply(other); }
@SuppressWarnings("unchecked") // addListener always returns the same instance. @SuppressLint("CheckResult") private void initRequestListeners(List<RequestListener<Object>> requestListeners) { for (RequestListener<Object> listener : requestListeners) { addListener((RequestListener<TranscodeType>) listener); } }
@SuppressWarnings("ResultOfMethodCallIgnored") //intended, nothing useful can be done @SuppressLint("SetWorldReadable") //intended, default permission private static void setFilePermissions(File outputFile) { // Try change permission to rwxr-xr-x outputFile.setReadable(true, false); outputFile.setExecutable(true, false); outputFile.setWritable(true); }
@SuppressLint("HandlerLeak") class EventPostHandler extends Handler { public EventPostHandler(Looper looper) { super(looper); } @Override public void handleMessage(Message msg) { eventBus.post(msg.obj); } void post(Object event) { sendMessage(obtainMessage(0, event)); } }
public MoreDetailsView(Context context, AttributeSet attrs) { super(context, attrs); Resources resources = getResources(); iconPaint = new Paint(Paint.ANTI_ALIAS_FLAG); float strokeSize = resources.getDimensionPixelSize(R.dimen.leak_canary_more_stroke_width); iconPaint.setStrokeWidth(strokeSize); // This lint check doesn't work for libraries which have a common prefix. @SuppressLint("CustomViewStyleable") // TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.leak_canary_MoreDetailsView); int plusColor = a.getColor(R.styleable.leak_canary_MoreDetailsView_leak_canary_plus_color, Color.BLACK); a.recycle(); iconPaint.setColor(plusColor); }
@SuppressLint({ "UsingDefaultJsonDeserializer", "EmptyJsonPropertyUse" }) public static class MessageAddedRequest { @JsonProperty(required = true) public ConsoleMessage message; }
@SuppressLint("WrongConstant") // Suppress spurious lint error [Internal ref: b/32137960] private static void forceWidevineL3(MediaDrm mediaDrm) { mediaDrm.setPropertyString("securityLevel", "L3"); }
@Override @SuppressLint("NewApi") public boolean isHardwareAccelerated() { // >= 3.0 if (Build.VERSION.SDK_INT >= 11) { return super.isHardwareAccelerated(); } else { return false; } }
@SuppressLint("NewApi") private static final int getMaximumBitmapWidth(Canvas c) { if (Build.VERSION.SDK_INT >= 14) { return c.getMaximumBitmapWidth(); } else { return c.getWidth(); } }
@SuppressLint("SetWorldReadable") void shareHeapDump() { AnalyzedHeap visibleLeak = getVisibleLeak(); final File heapDumpFile = visibleLeak.heapDump.heapDumpFile; AsyncTask.SERIAL_EXECUTOR.execute(new Runnable() { @Override public void run() { //noinspection ResultOfMethodCallIgnored heapDumpFile.setReadable(true, false); final Uri heapDumpUri = getUriForFile(getBaseContext(), "com.squareup.leakcanary.fileprovider." + getApplication().getPackageName(), heapDumpFile); runOnUiThread(new Runnable() { @Override public void run() { startShareIntentChooser(heapDumpUri); } }); } }); }
@SuppressLint("InlinedApi") /* package */ static AudioCapabilities getCapabilities(@Nullable Intent intent) { if (intent == null || intent.getIntExtra(AudioManager.EXTRA_AUDIO_PLUG_STATE, 0) == 0) { return DEFAULT_AUDIO_CAPABILITIES; } return new AudioCapabilities( intent.getIntArrayExtra(AudioManager.EXTRA_ENCODINGS), intent.getIntExtra( AudioManager.EXTRA_MAX_CHANNEL_COUNT, /* defaultValue= */ DEFAULT_MAX_CHANNEL_COUNT)); }
@SuppressLint("LongLogTag") @Override public void onBindViewHolder(MyViewHolder holder, int position) { Log.i(TAG, "onBindViewHolder [" + holder.jzvdStd.hashCode() + "] position=" + position); holder.jzvdStd.setUp( VideoConstant.videoUrls[0][position], VideoConstant.videoTitles[0][position], Jzvd.SCREEN_WINDOW_LIST); Glide.with(holder.jzvdStd.getContext()).load(VideoConstant.videoThumbs[0][position]).into(holder.jzvdStd.thumbImageView); }
@SuppressLint("ClickableViewAccessibility") @Override public boolean onTouchEvent(MotionEvent event) { return inTouchableArea(event.getX(), event.getY()) && super.onTouchEvent(event); }