Java Code Examples for org.telegram.messenger.BuildVars#LOGS_ENABLED
The following examples show how to use
org.telegram.messenger.BuildVars#LOGS_ENABLED .
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: ForegroundDetector.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onActivityStarted(Activity activity) { if (++refs >= 1) { if (System.currentTimeMillis() - enterBackgroundTime < 200) wasInBackground = false; if (BuildVars.LOGS_ENABLED) FileLog.d("switch to foreground"); for (Listener listener : listeners) { try { listener.onBecameForeground(); } catch (Exception e) { FileLog.e(e); } } } }
Example 2
Source File: ForegroundDetector.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void onActivityStarted(Activity activity) { if (++refs == 1) { if (SystemClock.elapsedRealtime() - enterBackgroundTime < 200) { wasInBackground = false; } if (BuildVars.LOGS_ENABLED) { FileLog.d("switch to foreground"); } for (Listener listener : listeners) { try { listener.onBecameForeground(); } catch (Exception e) { FileLog.e(e); } } } }
Example 3
Source File: TelegramConnectionService.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public Connection onCreateIncomingConnection(PhoneAccountHandle connectionManagerPhoneAccount, ConnectionRequest request){ if(BuildVars.LOGS_ENABLED) FileLog.d("onCreateIncomingConnection "/*+request*/); Bundle extras=request.getExtras(); if(extras.getInt("call_type")==1){ // private VoIPService svc=VoIPService.getSharedInstance(); if(svc==null) return null; if(svc.isOutgoing()) return null; return svc.getConnectionAndStartCall(); }else if(extras.getInt("call_type")==2){ // group /*VoIPGroupService svc=VoIPGroupService.getSharedInstance(); if(svc==null) return null; return svc.getConnectionAndStartCall();*/ } return null; }
Example 4
Source File: SerializedData.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public double readDouble(boolean exception) { try { return Double.longBitsToDouble(readInt64(exception)); } catch (Exception e) { if (exception) { throw new RuntimeException("read double error", e); } else { if (BuildVars.LOGS_ENABLED) { FileLog.e("read double error"); } } } return 0; }
Example 5
Source File: TelegramConnectionService.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public Connection onCreateOutgoingConnection(PhoneAccountHandle connectionManagerPhoneAccount, ConnectionRequest request){ if(BuildVars.LOGS_ENABLED) FileLog.d("onCreateOutgoingConnection "/*+request*/); Bundle extras=request.getExtras(); if(extras.getInt("call_type")==1){ // private VoIPService svc=VoIPService.getSharedInstance(); if(svc==null) return null; return svc.getConnectionAndStartCall(); }else if(extras.getInt("call_type")==2){ // group /*VoIPGroupService svc=VoIPGroupService.getSharedInstance(); if(svc==null) return null; if(!svc.isOutgoing()) return null; return svc.getConnectionAndStartCall();*/ } return null; }
Example 6
Source File: VoIPService.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.O) @Override public CallConnection getConnectionAndStartCall(){ if(systemCallConnection==null){ if(BuildVars.LOGS_ENABLED) FileLog.d("creating call connection"); systemCallConnection=new CallConnection(); systemCallConnection.setInitializing(); if(isOutgoing){ delayedStartOutgoingCall=new Runnable(){ @Override public void run(){ delayedStartOutgoingCall=null; startOutgoingCall(); } }; AndroidUtilities.runOnUIThread(delayedStartOutgoingCall, 2000); } systemCallConnection.setCallerDisplayName(ContactsController.formatName(user.first_name, user.last_name), TelecomManager.PRESENTATION_ALLOWED); } return systemCallConnection; }
Example 7
Source File: CameraController.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void openRound(final CameraSession session, final SurfaceTexture texture, final Runnable callback, final Runnable configureCallback) { if (session == null || texture == null) { if (BuildVars.LOGS_ENABLED) { FileLog.d("failed to open round " + session + " tex = " + texture); } return; } threadPool.execute(() -> { Camera camera = session.cameraInfo.camera; try { if (BuildVars.LOGS_ENABLED) { FileLog.d("start creating round camera session"); } if (camera == null) { camera = session.cameraInfo.camera = Camera.open(session.cameraInfo.cameraId); } Camera.Parameters params = camera.getParameters(); session.configureRoundCamera(); if (configureCallback != null) { configureCallback.run(); } camera.setPreviewTexture(texture); camera.startPreview(); if (callback != null) { AndroidUtilities.runOnUIThread(callback); } if (BuildVars.LOGS_ENABLED) { FileLog.d("round camera session created"); } } catch (Exception e) { session.cameraInfo.camera = null; if (camera != null) { camera.release(); } FileLog.e(e); } }); }
Example 8
Source File: Shader.java From Telegram with GNU General Public License v2.0 | 5 votes |
private int linkProgram(int program) { GLES20.glLinkProgram(program); int[] linkStatus = new int[1]; GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0); if (linkStatus[0] == GLES20.GL_FALSE) { if (BuildVars.LOGS_ENABLED) { FileLog.e(GLES20.glGetProgramInfoLog(program)); } } return linkStatus[0]; }
Example 9
Source File: SerializedData.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void writeString(String s) { try { writeByteArray(s.getBytes("UTF-8")); } catch (Exception e) { if (BuildVars.LOGS_ENABLED) { FileLog.e("write string error"); FileLog.e(e); } } }
Example 10
Source File: SerializedData.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void writeByte(byte b) { try { if (!justCalc) { out.writeByte(b); } else { len += 1; } } catch (Exception e) { if (BuildVars.LOGS_ENABLED) { FileLog.e("write byte error"); FileLog.e(e); } } }
Example 11
Source File: ChatListItemAnimator.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public void endAnimation(RecyclerView.ViewHolder item) { Animator animator = animators.remove(item); if (animator != null) { animator.cancel(); } super.endAnimation(item); if (BuildVars.LOGS_ENABLED) { FileLog.d("end animation"); } }
Example 12
Source File: NativeByteBuffer.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void writeInt32(int x) { try { if (!justCalc) { buffer.putInt(x); } else { len += 4; } } catch (Exception e) { if (BuildVars.LOGS_ENABLED) { FileLog.e("write int32 error"); } } }
Example 13
Source File: VoIPBaseService.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
protected void dispatchStateChanged(int state) { if (BuildVars.LOGS_ENABLED) { FileLog.d("== Call " + getCallID() + " state changed to " + state + " =="); } currentState = state; if(USE_CONNECTION_SERVICE && state==STATE_ESTABLISHED /*&& !wasEstablished*/ && systemCallConnection!=null){ systemCallConnection.setActive(); } for (int a = 0; a < stateListeners.size(); a++) { StateListener l = stateListeners.get(a); l.onStateChanged(state); } }
Example 14
Source File: NativeByteBuffer.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public double readDouble(boolean exception) { try { return Double.longBitsToDouble(readInt64(exception)); } catch (Exception e) { if (exception) { throw new RuntimeException("read double error", e); } else { if (BuildVars.LOGS_ENABLED) { FileLog.e("read double error"); FileLog.e(e); } } } return 0; }
Example 15
Source File: NativeByteBuffer.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void readBytes(byte[] b, boolean exception) { try { buffer.get(b); } catch (Exception e) { if (exception) { throw new RuntimeException("read raw error", e); } else { if (BuildVars.LOGS_ENABLED) { FileLog.e("read raw error"); } } } }
Example 16
Source File: SerializedData.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void writeFloat(float d) { try { writeInt32(Float.floatToIntBits(d)); } catch (Exception e) { if (BuildVars.LOGS_ENABLED) { FileLog.e("write float error"); FileLog.e(e); } } }
Example 17
Source File: InstantCameraView.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
private void onDraw(Integer cameraId) { if (!initied) { return; } if (!eglContext.equals(egl10.eglGetCurrentContext()) || !eglSurface.equals(egl10.eglGetCurrentSurface(EGL10.EGL_DRAW))) { if (!egl10.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) { if (BuildVars.LOGS_ENABLED) { FileLog.e("eglMakeCurrent failed " + GLUtils.getEGLErrorString(egl10.eglGetError())); } return; } } cameraSurface.updateTexImage(); if (!recording) { videoEncoder.startRecording(cameraFile, EGL14.eglGetCurrentContext()); recording = true; int orientation = currentSession.getCurrentOrientation(); if (orientation == 90 || orientation == 270) { float temp = scaleX; scaleX = scaleY; scaleY = temp; } } videoEncoder.frameAvailable(cameraSurface, cameraId, System.nanoTime()); cameraSurface.getTransformMatrix(mSTMatrix); GLES20.glUseProgram(drawProgram); GLES20.glActiveTexture(GLES20.GL_TEXTURE0); GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, cameraTexture[0]); GLES20.glVertexAttribPointer(positionHandle, 3, GLES20.GL_FLOAT, false, 12, vertexBuffer); GLES20.glEnableVertexAttribArray(positionHandle); GLES20.glVertexAttribPointer(textureHandle, 2, GLES20.GL_FLOAT, false, 8, textureBuffer); GLES20.glEnableVertexAttribArray(textureHandle); GLES20.glUniformMatrix4fv(textureMatrixHandle, 1, false, mSTMatrix, 0); GLES20.glUniformMatrix4fv(vertexMatrixHandle, 1, false, mMVPMatrix, 0); GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4); GLES20.glDisableVertexAttribArray(positionHandle); GLES20.glDisableVertexAttribArray(textureHandle); GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, 0); GLES20.glUseProgram(0); egl10.eglSwapBuffers(eglDisplay, eglSurface); }
Example 18
Source File: SettingsActivity.java From Telegram with GNU General Public License v2.0 | 4 votes |
private void updateRows() { rowCount = 0; emptyRow = rowCount++; numberSectionRow = rowCount++; numberRow = rowCount++; usernameRow = rowCount++; bioRow = rowCount++; settingsSectionRow = rowCount++; settingsSectionRow2 = rowCount++; notificationRow = rowCount++; privacyRow = rowCount++; dataRow = rowCount++; chatRow = rowCount++; if (getMessagesController().filtersEnabled || !getMessagesController().dialogFilters.isEmpty()) { filtersRow = rowCount++; } else { filtersRow = -1; } devicesRow = rowCount++; languageRow = rowCount++; devicesSectionRow = rowCount++; helpHeaderRow = rowCount++; questionRow = rowCount++; faqRow = rowCount++; policyRow = rowCount++; if (BuildVars.LOGS_ENABLED || BuildVars.DEBUG_VERSION) { helpSectionCell = rowCount++; debugHeaderRow = rowCount++; } else { helpSectionCell = -1; debugHeaderRow = -1; } if (BuildVars.LOGS_ENABLED) { sendLogsRow = rowCount++; clearLogsRow = rowCount++; } else { sendLogsRow = -1; clearLogsRow = -1; } if (BuildVars.DEBUG_VERSION) { switchBackendRow = rowCount++; } else { switchBackendRow = -1; } versionRow = rowCount++; if (listAdapter != null) { listAdapter.notifyDataSetChanged(); } }
Example 19
Source File: InstantCameraView.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
private void onDraw(Integer cameraId) { if (!initied) { return; } if (!eglContext.equals(egl10.eglGetCurrentContext()) || !eglSurface.equals(egl10.eglGetCurrentSurface(EGL10.EGL_DRAW))) { if (!egl10.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) { if (BuildVars.LOGS_ENABLED) { FileLog.e("eglMakeCurrent failed " + GLUtils.getEGLErrorString(egl10.eglGetError())); } return; } } cameraSurface.updateTexImage(); if (!recording) { videoEncoder.startRecording(cameraFile, EGL14.eglGetCurrentContext()); recording = true; int orientation = currentSession.getCurrentOrientation(); if (orientation == 90 || orientation == 270) { float temp = scaleX; scaleX = scaleY; scaleY = temp; } } videoEncoder.frameAvailable(cameraSurface, cameraId, System.nanoTime()); cameraSurface.getTransformMatrix(mSTMatrix); GLES20.glUseProgram(drawProgram); GLES20.glActiveTexture(GLES20.GL_TEXTURE0); GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, cameraTexture[0]); GLES20.glVertexAttribPointer(positionHandle, 3, GLES20.GL_FLOAT, false, 12, vertexBuffer); GLES20.glEnableVertexAttribArray(positionHandle); GLES20.glVertexAttribPointer(textureHandle, 2, GLES20.GL_FLOAT, false, 8, textureBuffer); GLES20.glEnableVertexAttribArray(textureHandle); GLES20.glUniformMatrix4fv(textureMatrixHandle, 1, false, mSTMatrix, 0); GLES20.glUniformMatrix4fv(vertexMatrixHandle, 1, false, mMVPMatrix, 0); GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4); GLES20.glDisableVertexAttribArray(positionHandle); GLES20.glDisableVertexAttribArray(textureHandle); GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, 0); GLES20.glUseProgram(0); egl10.eglSwapBuffers(eglDisplay, eglSurface); }
Example 20
Source File: VoIPService.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@SuppressLint("MissingPermission") @Override public int onStartCommand(Intent intent, int flags, int startId) { if(sharedInstance!=null){ if (BuildVars.LOGS_ENABLED) { FileLog.e("Tried to start the VoIP service when it's already started"); } return START_NOT_STICKY; } currentAccount=intent.getIntExtra("account", -1); if(currentAccount==-1) throw new IllegalStateException("No account specified when starting VoIP service"); int userID=intent.getIntExtra("user_id", 0); isOutgoing = intent.getBooleanExtra("is_outgoing", false); user = MessagesController.getInstance(currentAccount).getUser(userID); if(user==null){ if (BuildVars.LOGS_ENABLED) { FileLog.w("VoIPService: user==null"); } stopSelf(); return START_NOT_STICKY; } sharedInstance = this; if (isOutgoing) { dispatchStateChanged(STATE_REQUESTING); if(USE_CONNECTION_SERVICE){ TelecomManager tm=(TelecomManager) getSystemService(TELECOM_SERVICE); Bundle extras=new Bundle(); Bundle myExtras=new Bundle(); extras.putParcelable(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, addAccountToTelecomManager()); myExtras.putInt("call_type", 1); extras.putBundle(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, myExtras); ContactsController.getInstance(currentAccount).createOrUpdateConnectionServiceContact(user.id, user.first_name, user.last_name); tm.placeCall(Uri.fromParts("tel", "+99084"+user.id, null), extras); }else{ delayedStartOutgoingCall=new Runnable(){ @Override public void run(){ delayedStartOutgoingCall=null; startOutgoingCall(); } }; AndroidUtilities.runOnUIThread(delayedStartOutgoingCall, 2000); } if (intent.getBooleanExtra("start_incall_activity", false)) { startActivity(new Intent(this, VoIPActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } } else { NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.closeInCallActivity); call = callIShouldHavePutIntoIntent; callIShouldHavePutIntoIntent = null; if(USE_CONNECTION_SERVICE){ acknowledgeCall(false); showNotification(); }else{ acknowledgeCall(true); } } initializeAccountRelatedThings(); return START_NOT_STICKY; }