android.util.Log Java Examples

The following examples show how to use android.util.Log. 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: PermissionCheckGroup.java    From android_external_MicroGUiTools with Apache License 2.0 8 votes vote down vote up
private void doPermissionCheck(Context context, ResultCollector collector, final String permission) {
    PackageManager pm = context.getPackageManager();
    try {
        PermissionInfo info = pm.getPermissionInfo(permission, 0);
        PermissionGroupInfo groupInfo = info.group != null ? pm.getPermissionGroupInfo(info.group, 0) : null;
        CharSequence permLabel = info.loadLabel(pm);
        CharSequence groupLabel = groupInfo != null ? groupInfo.loadLabel(pm) : permLabel;
        collector.addResult(context.getString(R.string.self_check_name_permission, permLabel),
                context.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED ? Positive : Negative,
                context.getString(R.string.self_check_resolution_permission, groupLabel),
                new SelfCheckGroup.CheckResolver() {

                    @Override
                    public void tryResolve(Fragment fragment) {
                        fragment.requestPermissions(new String[]{permission}, 0);
                    }
                });
    } catch (PackageManager.NameNotFoundException e) {
        Log.w(TAG, e);
    }
}
 
Example #2
Source File: SteamService.java    From UpdogFarmer with GNU General Public License v3.0 7 votes vote down vote up
/**
 * Resume farming/idling
 */
private void resumeFarming() {
    if (paused || waiting) {
        return;
    }

    if (farming) {
        Log.i(TAG, "Resume farming");
        executor.execute(farmTask);
    } else if (currentGames.size() == 1) {
        Log.i(TAG, "Resume playing");
        new Handler(Looper.getMainLooper()).post(() -> idleSingle(currentGames.get(0)));
    } else if (currentGames.size() > 1) {
        Log.i(TAG, "Resume playing (multiple)");
        idleMultiple(currentGames);
    }
}
 
Example #3
Source File: MomentStatActivity.java    From hayoou-wechat-export with GNU General Public License v3.0 6 votes vote down vote up
public void shareToTimeLine() {
    generateShareImage();
    File file = new File(Config.EXT_DIR + "/share_image.jpg");
    try {
        Intent intent = new Intent();
        ComponentName comp = new ComponentName("com.tencent.mm",
                "com.tencent.mm.ui.tools.ShareToTimeLineUI");
        intent.setComponent(comp);
        intent.setAction("android.intent.action.SEND");
        intent.setType("image/*");
        //intent.setFlags(0x3000001);
        intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
        startActivity(intent);
    } catch (Exception e) {
        Log.e("wechatmomentstat", "exception", e);
    }
}
 
Example #4
Source File: NightscoutUploadProcess.java    From 600SeriesAndroidUploader with MIT License 6 votes vote down vote up
private int deleteTreatments(Response<List<TreatmentsEndpoints.Treatment>> response) throws Exception {
    cheanupCheckCount++;
    int result = 0;
    if (response.isSuccessful()) {
        List<TreatmentsEndpoints.Treatment> list = response.body();
        for (TreatmentsEndpoints.Treatment item : list) {
            cheanupDeleteCount++;
            Response<ResponseBody> responseBody = dataStore.isNightscoutUseQuery()
                    ? treatmentsEndpoints.deleteID(item.getCreated_at(), item.get_id()).execute()
                    : treatmentsEndpoints.deleteID(item.get_id()).execute();
            if (responseBody.isSuccessful()) {
                Log.d(TAG, String.format("deleted treatment ID: %s with KEY: %s MAC: %s DATE: %s QUERY: %s",
                        item.get_id(), item.getKey600(), item.getPumpMAC600(), item.getCreated_at(), dataStore.isNightscoutUseQuery()));
            } else {
                Log.d(TAG, "no DELETE response from nightscout site");
                return -1;
            }
            result++;
        }
    } else return -1;
    return result;
}
 
Example #5
Source File: Utf7ImeService.java    From android-unicode with MIT License 6 votes vote down vote up
@Override
public View onCreateInputView() {
    Log.d(TAG, "onCreateInputView()");
    View mInputView = getLayoutInflater().inflate(R.layout.keyboard, null);

    if (mReceiver == null) {
        IntentFilter filter = new IntentFilter(IME_MESSAGE);
        filter.addAction(IME_CHARS);
        filter.addAction(IME_KEYCODE);
        filter.addAction(IME_EDITORCODE);
        mReceiver = new AdbReceiver();
        registerReceiver(mReceiver, filter);
    }

    return mInputView; 
}
 
Example #6
Source File: BaseQQShareHandler.java    From BiliShare with Apache License 2.0 6 votes vote down vote up
/**
 * 必须在主线程分享
 *
 * @param activity
 * @param params
 */
protected void doShareToQQ(final Activity activity, final Bundle params) {
    doOnMainThread(new Runnable() {
        @Override
        public void run() {
            Log.d(TAG, "real start share");
            postProgressStart();
            onShare(activity, mTencent, params, mUiListener);
            if (activity != null && !isMobileQQSupportShare(activity.getApplicationContext())) {
                Log.d(TAG, "qq has not install");
                String msg = activity.getString(R.string.bili_share_sdk_not_install_qq);
                Toast.makeText(activity, msg, Toast.LENGTH_SHORT).show();
                if (getShareListener() != null) {
                    getShareListener().onError(getShareMedia(), BiliShareStatusCode.ST_CODE_SHARE_ERROR_NOT_INSTALL, new ShareException(msg));
                }
            }
        }
    });
}
 
Example #7
Source File: TwilioVoiceModule.java    From react-native-twilio-programmable-voice with MIT License 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();
    if (action.equals(ACTION_INCOMING_CALL)) {
        if (BuildConfig.DEBUG) {
            Log.d(TAG, "VoiceBroadcastReceiver.onReceive ACTION_INCOMING_CALL. Intent "+ intent.getExtras());
        }
        handleIncomingCallIntent(intent);
    } else if (action.equals(ACTION_MISSED_CALL)) {
        SharedPreferences sharedPref = getReactApplicationContext().getSharedPreferences(PREFERENCE_KEY, Context.MODE_PRIVATE);
        SharedPreferences.Editor sharedPrefEditor = sharedPref.edit();
        sharedPrefEditor.remove(MISSED_CALLS_GROUP);
        sharedPrefEditor.commit();
    } else {
        Log.e(TAG, "received broadcast unhandled action " + action);
    }
}
 
Example #8
Source File: SimCardInfo.java    From MobileInfo with Apache License 2.0 6 votes vote down vote up
static JSONObject getMobSimInfo(Context context) {
        SimCardBean simCardBean = new SimCardBean();
        try {
            simCardBean.setHaveCard(hasSimCard(context));
//            SimCardUtils.SimCardInfo simCardInfo = SimCardUtils.instance().getmSimCardInfo(context.getApplicationContext());
//            simCardBean.setSim1Imsi(simCardInfo.getSim1Imsi());
//            simCardBean.setSim2Imsi(simCardInfo.getSim2Imsi());
//            simCardBean.setOperator(getOperators(simCardInfo.getOperator(simSlotIndex)));
//            simCardBean.setSim1ImsiOperator(getOperators(simCardInfo.getSim1Imsi()));
//            simCardBean.setSim2ImsiOperator(getOperators(simCardInfo.getSim2Imsi()));

            MobCardUtils.mobGetCardInfo(context, simCardBean);


        } catch (Exception e) {
            Log.e(TAG, e.toString());
        }
        return simCardBean.toJSONObject();

    }
 
Example #9
Source File: MasterService.java    From 600SeriesAndroidUploader with MIT License 6 votes vote down vote up
private boolean checkUsbDevice() {
    if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_USB_HOST)) {
        Log.e(TAG, "Device does not support USB OTG");
        statusNotification.updateNotification(StatusNotification.NOTIFICATION.ERROR);
        UserLogMessage.send(mContext, UserLogMessage.TYPE.WARN, R.string.ul_usb__no_support);
        return false;
    }

    UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);

    if (usbManager == null) {
        Log.e(TAG, "USB connection error. mUsbManager == null");
        statusNotification.updateNotification(StatusNotification.NOTIFICATION.ERROR);
        UserLogMessage.send(mContext, UserLogMessage.TYPE.WARN, R.string.ul_usb__no_connection);
        return false;
    }

    if (UsbHidDriver.getUsbDevice(usbManager, MedtronicCnlService.USB_VID, MedtronicCnlService.USB_PID) == null) {
        Log.w(TAG, "USB connection error. Is the CNL plugged in?");
        statusNotification.updateNotification(StatusNotification.NOTIFICATION.ERROR);
        UserLogMessage.send(mContext, UserLogMessage.TYPE.WARN, R.string.ul_usb__no_connection);
        return false;
    }

    return true;
}
 
Example #10
Source File: AndroidFFMPEGLocator.java    From cythara with GNU General Public License v3.0 6 votes vote down vote up
private String getFFMPEGFileName(CPUArchitecture architecture){
    final String ffmpegFileName;
    switch (architecture){
        case X86:
            ffmpegFileName = "x86_ffmpeg";
            break;
        case ARMEABI_V7A:
            ffmpegFileName = "armeabi-v7a_ffmpeg";
            break;
        case ARMEABI_V7A_NEON:
            ffmpegFileName = "armeabi-v7a-neon_ffmpeg";
            break;
        default:
            ffmpegFileName = null;
            String message= "Could not determine your processor architecture correctly, no ffmpeg binary available.";
            Log.e(TAG,message);
            throw new Error(message);
    }
    return ffmpegFileName;
}
 
Example #11
Source File: SerialSocket.java    From SimpleBluetoothLeTerminal with MIT License 6 votes vote down vote up
@Override
public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {
    delegate.onDescriptorWrite(gatt, descriptor, status);
    if(canceled)
        return;
    if(descriptor.getCharacteristic() == readCharacteristic) {
        Log.d(TAG,"writing read characteristic descriptor finished, status="+status);
        if (status != BluetoothGatt.GATT_SUCCESS) {
            onSerialConnectError(new IOException("write descriptor failed"));
        } else {
            // onCharacteristicChanged with incoming data can happen after writeDescriptor(ENABLE_INDICATION/NOTIFICATION)
            // before confirmed by this method, so receive data can be shown before device is shown as 'Connected'.
            onSerialConnect();
            connected = true;
            Log.d(TAG, "connected");
        }
    }
}
 
Example #12
Source File: PlaybackActivityMonitor.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
void addDuck(@NonNull AudioPlaybackConfiguration apc, boolean skipRamp) {
    final int piid = new Integer(apc.getPlayerInterfaceId());
    if (mDuckedPlayers.contains(piid)) {
        if (DEBUG) { Log.v(TAG, "player piid:" + piid + " already ducked"); }
        return;
    }
    try {
        sEventLogger.log((new DuckEvent(apc, skipRamp)).printLog(TAG));
        apc.getPlayerProxy().applyVolumeShaper(
                DUCK_VSHAPE,
                skipRamp ? PLAY_SKIP_RAMP : PLAY_CREATE_IF_NEEDED);
        mDuckedPlayers.add(piid);
    } catch (Exception e) {
        Log.e(TAG, "Error ducking player piid:" + piid + " uid:" + mUid, e);
    }
}
 
Example #13
Source File: ESPDevice.java    From esp-idf-provisioning-android with Apache License 2.0 6 votes vote down vote up
private void getFullWiFiList() {

        Log.e(TAG, "Total count : " + totalCount + " and start index is : " + startIndex);

        if (totalCount < 4) {

            getWiFiScanList(0, totalCount);

        } else {

            int temp = totalCount - startIndex;

            if (temp > 0) {

                if (temp > 4) {
                    getWiFiScanList(startIndex, 4);
                } else {
                    getWiFiScanList(startIndex, temp);
                }

            } else {
                Log.d(TAG, "Nothing to do. Wifi list completed.");
                completeWifiList();
            }
        }
    }
 
Example #14
Source File: Forecast.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void setValues(double[] y, double[] x) {
    if (x.length != y.length) {
        throw new IllegalArgumentException(String.format("The numbers of y and x values must be equal (%d != %d)", y.length, x.length));
    }
    double[][] xData = new double[x.length][];
    for (int i = 0; i < x.length; i++) {
        // the implementation determines how to produce a vector of predictors from a single x
        xData[i] = xVector(x[i]);
    }
    if (logY()) { // in some models we are predicting ln y, so we replace each y with ln y
        y = Arrays.copyOf(y, y.length); // user might not be finished with the array we were given
        for (int i = 0; i < x.length; i++) {
            y[i] = Math.log(y[i]);
        }
    }
    final OLSMultipleLinearRegression ols = new OLSMultipleLinearRegression();
    ols.setNoIntercept(true); // let the implementation include a constant in xVector if desired
    ols.newSampleData(y, xData); // provide the data to the model
    coef = MatrixUtils.createColumnRealMatrix(ols.estimateRegressionParameters()); // get our coefs
    last_error_rate = ols.estimateErrorVariance();
    Log.d(TAG, getClass().getSimpleName() + " Forecast Error rate: errorvar:"
            + JoH.qs(last_error_rate, 4)
            + " regssionvar:" + JoH.qs(ols.estimateRegressandVariance(), 4)
            + "  stderror:" + JoH.qs(ols.estimateRegressionStandardError(), 4));
}
 
Example #15
Source File: FpsMeter.java    From LPR with Apache License 2.0 6 votes vote down vote up
public void measure() {
    if (!mIsInitialized) {
        init();
        mIsInitialized = true;
    } else {
        mFramesCounter++;
        if (mFramesCounter % STEP == 0) {
            long time = Core.getTickCount();
            double fps = STEP * mFrequency / (time - mprevFrameTime);
            mprevFrameTime = time;
            if (mWidth != 0 && mHeight != 0)
                mStrfps = FPS_FORMAT.format(fps) + " FPS@" + Integer.valueOf(mWidth) + "x" + Integer.valueOf(mHeight);
            else
                mStrfps = FPS_FORMAT.format(fps) + " FPS";
            Log.i(TAG, mStrfps);
        }
    }
}
 
Example #16
Source File: WallpaperService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
void reportVisibility() {
    if (!mDestroyed) {
        mDisplayState = mDisplay == null ? Display.STATE_UNKNOWN : mDisplay.getState();
        boolean visible = mVisible && mDisplayState != Display.STATE_OFF;
        if (mReportedVisible != visible) {
            mReportedVisible = visible;
            if (DEBUG) Log.v(TAG, "onVisibilityChanged(" + visible
                    + "): " + this);
            if (visible) {
                // If becoming visible, in preview mode the surface
                // may have been destroyed so now we need to make
                // sure it is re-created.
                doOffsetsChanged(false);
                updateSurface(false, false, false);
            }
            onVisibilityChanged(visible);
        }
    }
}
 
Example #17
Source File: BluetoothMapClient.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Returns true if the specified Bluetooth device is connected.
 * Returns false if not connected, or if this proxy object is not
 * currently connected to the Map service.
 */
public boolean isConnected(BluetoothDevice device) {
    if (VDBG) Log.d(TAG, "isConnected(" + device + ")");
    final IBluetoothMapClient service = mService;
    if (service != null) {
        try {
            return service.isConnected(device);
        } catch (RemoteException e) {
            Log.e(TAG, e.toString());
        }
    } else {
        Log.w(TAG, "Proxy not attached to service");
        if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable()));
    }
    return false;
}
 
Example #18
Source File: BaseTransientBottomBar.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
  if (view == null || context == null) {
    return;
  }
  // Calculate current bottom inset, factoring in translationY to account for where the
  // view will likely be animating to.
  int currentInsetBottom =
      getScreenHeight() - getViewAbsoluteBottom() + (int) view.getTranslationY();
  if (currentInsetBottom >= extraBottomMarginGestureInset) {
    // No need to add extra offset if view is already outside of bottom gesture area
    return;
  }

  LayoutParams layoutParams = view.getLayoutParams();
  if (!(layoutParams instanceof MarginLayoutParams)) {
    Log.w(
        TAG,
        "Unable to apply gesture inset because layout params are not MarginLayoutParams");
    return;
  }

  // Move view outside of bottom gesture area
  MarginLayoutParams marginParams = (MarginLayoutParams) layoutParams;
  marginParams.bottomMargin += extraBottomMarginGestureInset - currentInsetBottom;
  view.requestLayout();
}
 
Example #19
Source File: VideoEncoderCore.java    From LiveVideoBroadcaster with Apache License 2.0 5 votes vote down vote up
/**
 * Configures encoder and muxer state, and prepares the input Surface.
 */
public VideoEncoderCore(int width, int height, int bitRate, int frameRate, IMediaMuxer writerHandler)
        throws IOException {
    mBufferInfo = new MediaCodec.BufferInfo();

    MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, width, height);

   // this.frameRate = frameRate;

    // Set some properties.  Failing to specify some of these can cause the MediaCodec
    // configure() call to throw an unhelpful exception.
    format.setInteger(MediaFormat.KEY_COLOR_FORMAT,
            MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
    format.setInteger(MediaFormat.KEY_BIT_RATE, bitRate);
    format.setInteger(MediaFormat.KEY_FRAME_RATE, frameRate);
    format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, IFRAME_INTERVAL);

    if (VERBOSE) Log.d(TAG, "format: " + format);

    // Create a MediaCodec encoder, and configure it with our format.  Get a Surface
    // we can use for input and wrap it with a class that handles the EGL work.
    mEncoder = MediaCodec.createEncoderByType(MIME_TYPE);
    mEncoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
    mInputSurface = mEncoder.createInputSurface();
    mEncoder.start();

    mWriterHandler = writerHandler;

}
 
Example #20
Source File: DevicesActivity.java    From bridgefy-android-samples with MIT License 5 votes vote down vote up
@Override
public void onRegistrationFailed(int errorCode, String message) {
    Log.e(TAG, "onRegistrationFailed: failed with ERROR_CODE: " + errorCode + ", MESSAGE: " + message);
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Toast.makeText(DevicesActivity.this, "Bridgefy registration did not succeed.", Toast.LENGTH_LONG).show();
        }
    });
}
 
Example #21
Source File: MainActivity.java    From TextOcrExample with Apache License 2.0 5 votes vote down vote up
/**
 * 获取Camera实例
 */
private Camera getCamera(int id) {
    Camera camera = null;
    try {
        camera = Camera.open(id);
    } catch (Exception e) {
        Log.d(this.getClass().getSimpleName(), e.toString());
    }
    return camera;
}
 
Example #22
Source File: RecyclerBinder.java    From litho with Apache License 2.0 5 votes vote down vote up
private void requestRemeasure() {
  if (SectionsDebug.ENABLED) {
    Log.d(SectionsDebug.TAG, "(" + hashCode() + ") requestRemeasure");
  }

  if (mMountedView != null) {
    mMainThreadHandler.removeCallbacks(mRemeasureRunnable);
    mMountedView.removeCallbacks(mRemeasureRunnable);
    ViewCompat.postOnAnimation(mMountedView, mRemeasureRunnable);
  } else {
    // We are not mounted but we still need to post this. Just post on the main thread.
    mMainThreadHandler.removeCallbacks(mRemeasureRunnable);
    mMainThreadHandler.post(mRemeasureRunnable);
  }
}
 
Example #23
Source File: AnimationEngine.java    From TikTok with Apache License 2.0 5 votes vote down vote up
public void startTogetherByLink(Animator.AnimatorListener listener, AnimatorValue...animatorValues){
	if(animationSet==null){
		Log.d(TAG, "δ�ܳ�ʼ��");
		return;
	}
	animationSet.removeAllListeners();
	if(listener!=null){
		animationSet.addListener(listener);
	}
	if (animatorValues != null) {
		AnimatorSet.Builder lastBuilder=null;
           for (int i = 0; i < animatorValues.length; i++) {
           	AnimatorSet.Builder curBuilder = animationSet.play(animatorValues[i].getAnimator());
               if(animatorValues[i].getBeforeAnimator()!=null){
               	curBuilder.after(animatorValues[i].getBeforeAnimator());
               }else if(lastBuilder!=null){
               	lastBuilder.with(animatorValues[i].getAnimator());		
               }
               	lastBuilder=curBuilder;
           }
       }else{
       	Log.d(TAG, "���������ǿ�");
		return;
       }
	//animationSet.setDuration(duration/animatorValues.length);
	animationSet.setInterpolator(interpolator);
	animationSet.start();
}
 
Example #24
Source File: Solo.java    From AndroidRipper with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Clicks a Button matching the specified index.
 *
 * @param index the index of the {@link Button} to click. {@code 0} if only one is available
 */

public void clickOnButton(int index) {
	if(config.commandLogging){
		Log.d(config.commandLoggingTag, "clickOnButton("+index+")");
	}
	
	clicker.clickOn(Button.class, index);
}
 
Example #25
Source File: TtmlDecoder.java    From K-Sonic with MIT License 5 votes vote down vote up
private static void parseFontSize(String expression, TtmlStyle out) throws
    SubtitleDecoderException {
  String[] expressions = expression.split("\\s+");
  Matcher matcher;
  if (expressions.length == 1) {
    matcher = FONT_SIZE.matcher(expression);
  } else if (expressions.length == 2){
    matcher = FONT_SIZE.matcher(expressions[1]);
    Log.w(TAG, "Multiple values in fontSize attribute. Picking the second value for vertical font"
        + " size and ignoring the first.");
  } else {
    throw new SubtitleDecoderException("Invalid number of entries for fontSize: "
        + expressions.length + ".");
  }

  if (matcher.matches()) {
    String unit = matcher.group(3);
    switch (unit) {
      case "px":
        out.setFontSizeUnit(TtmlStyle.FONT_SIZE_UNIT_PIXEL);
        break;
      case "em":
        out.setFontSizeUnit(TtmlStyle.FONT_SIZE_UNIT_EM);
        break;
      case "%":
        out.setFontSizeUnit(TtmlStyle.FONT_SIZE_UNIT_PERCENT);
        break;
      default:
        throw new SubtitleDecoderException("Invalid unit for fontSize: '" + unit + "'.");
    }
    out.setFontSize(Float.valueOf(matcher.group(1)));
  } else {
    throw new SubtitleDecoderException("Invalid expression for fontSize: '" + expression + "'.");
  }
}
 
Example #26
Source File: MediaPeriodHolder.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public void release() {
  updatePeriodTrackSelectorResult(null);
  try {
    if (info.id.endPositionUs != C.TIME_END_OF_SOURCE) {
      mediaSource.releasePeriod(((ClippingMediaPeriod) mediaPeriod).mediaPeriod);
    } else {
      mediaSource.releasePeriod(mediaPeriod);
    }
  } catch (RuntimeException e) {
    // There's nothing we can do.
    Log.e(TAG, "Period release failed.", e);
  }
}
 
Example #27
Source File: Camera2GLSurfaceView.java    From CameraDemo with Apache License 2.0 5 votes vote down vote up
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    mTextureId = OpenGLUtils.getExternalOESTextureID();
    mSurfaceTexture = new SurfaceTexture(mTextureId);
    mSurfaceTexture.setOnFrameAvailableListener(this);
    mCameraProxy.setPreviewSurface(mSurfaceTexture);
    mDrawer = new CameraDrawer();
    Log.d(TAG, "onSurfaceCreated. width: " + getWidth() + ", height: " + getHeight());
    mCameraProxy.openCamera(getWidth(), getHeight());
}
 
Example #28
Source File: Vpn.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    final Uri data = intent.getData();
    final String packageName = data == null ? null : data.getSchemeSpecificPart();
    if (packageName == null) {
        return;
    }

    synchronized (Vpn.this) {
        // Avoid race where always-on package has been unset
        if (!packageName.equals(getAlwaysOnPackage())) {
            return;
        }

        final String action = intent.getAction();
        Log.i(TAG, "Received broadcast " + action + " for always-on VPN package "
                + packageName + " in user " + mUserHandle);

        switch(action) {
            case Intent.ACTION_PACKAGE_REPLACED:
                // Start vpn after app upgrade
                startAlwaysOnVpn();
                break;
            case Intent.ACTION_PACKAGE_REMOVED:
                final boolean isPackageRemoved = !intent.getBooleanExtra(
                        Intent.EXTRA_REPLACING, false);
                if (isPackageRemoved) {
                    setAlwaysOnPackage(null, false);
                }
                break;
        }
    }
}
 
Example #29
Source File: FragmentManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Marks a fragment as shown to be later animated in with
 * {@link #completeShowHideFragment(Fragment)}.
 *
 * @param fragment The fragment to be shown.
 */
public void showFragment(Fragment fragment) {
    if (DEBUG) Log.v(TAG, "show: " + fragment);
    if (fragment.mHidden) {
        fragment.mHidden = false;
        // Toggle hidden changed so that if a fragment goes through show/hide/show
        // it doesn't go through the animation.
        fragment.mHiddenChanged = !fragment.mHiddenChanged;
    }
}
 
Example #30
Source File: TrackTranscoderException.java    From LiTr with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@NonNull
private String convertMediaCodecInfoToString(@NonNull MediaCodec mediaCodec) {
    try {
        return convertMediaCodecInfoToString(mediaCodec.getCodecInfo());
    } catch (IllegalStateException e) {
        Log.e(TAG, "Failed to retrieve media codec info.");
    }
    return "";
}