org.telegram.messenger.BuildVars Java Examples
The following examples show how to use
org.telegram.messenger.BuildVars.
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: NativeByteBuffer.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public boolean readBool(boolean exception) { int consructor = readInt32(exception); if (consructor == 0x997275b5) { return true; } else if (consructor == 0xbc799737) { return false; } if (exception) { throw new RuntimeException("Not bool value!"); } else { if (BuildVars.LOGS_ENABLED) { FileLog.e("Not bool value!"); } } return false; }
Example #2
Source File: NativeByteBuffer.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public boolean readBool(boolean exception) { int consructor = readInt32(exception); if (consructor == 0x997275b5) { return true; } else if (consructor == 0xbc799737) { return false; } if (exception) { throw new RuntimeException("Not bool value!"); } else { if (BuildVars.LOGS_ENABLED) { FileLog.e("Not bool value!"); } } return false; }
Example #3
Source File: ConnectionsManager.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override protected void onPostExecute(final NativeByteBuffer result) { Utilities.stageQueue.postRunnable(() -> { currentTask = null; if (result != null) { native_applyDnsConfig(currentAccount, result.address, AccountInstance.getInstance(currentAccount).getUserConfig().getClientPhone(), responseDate); } else { if (BuildVars.LOGS_ENABLED) { FileLog.d("failed to get google result"); FileLog.d("start mozilla task"); } MozillaDnsLoadTask task = new MozillaDnsLoadTask(currentAccount); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null); currentTask = task; } }); }
Example #4
Source File: VoIPBaseService.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@SuppressLint("NewApi") @Override public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_PROXIMITY) { AudioManager am=(AudioManager) getSystemService(AUDIO_SERVICE); if (isHeadsetPlugged || am.isSpeakerphoneOn() || (isBluetoothHeadsetConnected() && am.isBluetoothScoOn())) { return; } boolean newIsNear = event.values[0] < Math.min(event.sensor.getMaximumRange(), 3); if (newIsNear != isProximityNear) { if (BuildVars.LOGS_ENABLED) { FileLog.d("proximity " + newIsNear); } isProximityNear = newIsNear; try{ if(isProximityNear){ proximityWakelock.acquire(); }else{ proximityWakelock.release(1); // this is non-public API before L } }catch(Exception x){ FileLog.e(x); } } } }
Example #5
Source File: ConnectionsManager.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override protected void onPostExecute(final NativeByteBuffer result) { Utilities.stageQueue.postRunnable(() -> { currentTask = null; if (result != null) { native_applyDnsConfig(currentAccount, result.address, AccountInstance.getInstance(currentAccount).getUserConfig().getClientPhone(), responseDate); } else { if (BuildVars.LOGS_ENABLED) { FileLog.d("failed to get dns txt result"); FileLog.d("start google task"); } GoogleDnsLoadTask task = new GoogleDnsLoadTask(currentAccount); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null); currentTask = task; } }); }
Example #6
Source File: ConnectionsManager.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override protected void onPostExecute(final NativeByteBuffer result) { Utilities.stageQueue.postRunnable(() -> { if (result != null) { currentTask = null; native_applyDnsConfig(currentAccount, result.address, UserConfig.getInstance(currentAccount).getClientPhone()); } else { if (BuildVars.LOGS_ENABLED) { FileLog.d("failed to get dns txt result"); FileLog.d("start azure task"); } AzureLoadTask task = new AzureLoadTask(currentAccount); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null); currentTask = task; } }); }
Example #7
Source File: WebPlayerView.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override protected void onPostExecute(String[] result) { if (result[0] != null) { if (BuildVars.LOGS_ENABLED) { FileLog.d("start play youtube video " + result[1] + " " + result[0]); } initied = true; playVideoUrl = result[0]; playVideoType = result[1]; if (playVideoType.equals("hls")) { isStream = true; } if (isAutoplay) { preparePlayer(); } showProgress(false, true); controlsView.show(true, true); } else if (!isCancelled()) { onInitFailed(); } }
Example #8
Source File: ConnectionsManager.java From Telegram with GNU General Public License v2.0 | 6 votes |
public static void onUnparsedMessageReceived(long address, final int currentAccount) { try { NativeByteBuffer buff = NativeByteBuffer.wrap(address); buff.reused = true; int constructor = buff.readInt32(true); final TLObject message = TLClassStore.Instance().TLdeserialize(buff, constructor, true); if (message instanceof TLRPC.Updates) { if (BuildVars.LOGS_ENABLED) { FileLog.d("java received " + message); } KeepAliveJob.finishJob(); Utilities.stageQueue.postRunnable(() -> AccountInstance.getInstance(currentAccount).getMessagesController().processUpdates((TLRPC.Updates) message, false)); } else { if (BuildVars.LOGS_ENABLED) { FileLog.d(String.format("java received unknown constructor 0x%x", constructor)); } } } catch (Exception e) { FileLog.e(e); } }
Example #9
Source File: TelegramConnectionService.java From Telegram-FOSS 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 #10
Source File: SerializedData.java From Telegram with GNU General Public License v2.0 | 6 votes |
public boolean readBool(boolean exception) { int consructor = readInt32(exception); if (consructor == 0x997275b5) { return true; } else if (consructor == 0xbc799737) { return false; } if (exception) { throw new RuntimeException("Not bool value!"); } else { if (BuildVars.LOGS_ENABLED) { FileLog.e("Not bool value!"); } } return false; }
Example #11
Source File: VoIPService.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override protected void onControllerPreRelease(){ if(needSendDebugLog){ String debugLog=controller.getDebugLog(); TLRPC.TL_phone_saveCallDebug req=new TLRPC.TL_phone_saveCallDebug(); req.debug=new TLRPC.TL_dataJSON(); req.debug.data=debugLog; req.peer=new TLRPC.TL_inputPhoneCall(); req.peer.access_hash=call.access_hash; req.peer.id=call.id; ConnectionsManager.getInstance(currentAccount).sendRequest(req, new RequestDelegate(){ @Override public void run(TLObject response, TLRPC.TL_error error){ if (BuildVars.LOGS_ENABLED) { FileLog.d("Sent debug logs, response=" + response); } } }); } }
Example #12
Source File: SerializedData.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void writeByte(int i) { try { if (!justCalc) { out.writeByte((byte) i); } else { len += 1; } } catch (Exception e) { if (BuildVars.LOGS_ENABLED) { FileLog.e("write byte error"); } } }
Example #13
Source File: ConnectionsManager.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override protected void onPostExecute(final NativeByteBuffer result) { Utilities.stageQueue.postRunnable(() -> { if (result != null) { currentTask = null; native_applyDnsConfig(currentAccount, result.address, UserConfig.getInstance(currentAccount).getClientPhone()); } else { if (BuildVars.LOGS_ENABLED) { FileLog.d("failed to get dns txt result"); FileLog.d("start azure task"); } AzureLoadTask task = new AzureLoadTask(currentAccount); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null); currentTask = task; } }); }
Example #14
Source File: AlertsCreator.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public static AlertDialog showUpdateAppAlert(final Context context, final String text, boolean updateApp) { if (context == null || text == null) { return null; } AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setMessage(text); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); if (updateApp) { builder.setNegativeButton(LocaleController.getString("UpdateApp", R.string.UpdateApp), (dialog, which) -> Browser.openUrl(context, BuildVars.PLAYSTORE_APP_URL)); } return builder.show(); }
Example #15
Source File: SerializedData.java From Telegram with GNU General Public License v2.0 | 6 votes |
public int readInt32(boolean exception) { try { int i = 0; for (int j = 0; j < 4; j++) { i |= (in.read() << (j * 8)); len++; } return i; } catch (Exception e) { if (exception) { throw new RuntimeException("read int32 error", e); } else { if (BuildVars.LOGS_ENABLED) { FileLog.e("read int32 error"); FileLog.e(e); } } } return 0; }
Example #16
Source File: SQLiteCursor.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public boolean next() throws SQLiteException { int res = preparedStatement.step(preparedStatement.getStatementHandle()); if (res == -1) { int repeatCount = 6; while (repeatCount-- != 0) { try { if (BuildVars.LOGS_ENABLED) { FileLog.d("sqlite busy, waiting..."); } Thread.sleep(500); res = preparedStatement.step(); if (res == 0) { break; } } catch (Exception e) { FileLog.e(e); } } if (res == -1) { throw new SQLiteException("sqlite busy"); } } inRow = (res == 0); return inRow; }
Example #17
Source File: ForegroundDetector.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onActivityStopped(Activity activity) { if (--refs <= 0) { enterBackgroundTime = System.currentTimeMillis(); wasInBackground = true; if (BuildVars.LOGS_ENABLED) FileLog.d("switch to background"); for (Listener listener : listeners) { try { listener.onBecameBackground(); } catch (Exception e) { FileLog.e(e); } } } }
Example #18
Source File: ConnectionsManager.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override protected void onPostExecute(final NativeByteBuffer result) { Utilities.stageQueue.postRunnable(() -> { currentTask = null; if (result != null) { native_applyDnsConfig(currentAccount, result.address, AccountInstance.getInstance(currentAccount).getUserConfig().getClientPhone(), responseDate); } else { if (BuildVars.LOGS_ENABLED) { FileLog.d("failed to get google result"); FileLog.d("start mozilla task"); } MozillaDnsLoadTask task = new MozillaDnsLoadTask(currentAccount); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null); currentTask = task; } }); }
Example #19
Source File: VoIPService.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override protected void onControllerPreRelease(){ if(needSendDebugLog){ String debugLog=controller.getDebugLog(); TLRPC.TL_phone_saveCallDebug req=new TLRPC.TL_phone_saveCallDebug(); req.debug=new TLRPC.TL_dataJSON(); req.debug.data=debugLog; req.peer=new TLRPC.TL_inputPhoneCall(); req.peer.access_hash=call.access_hash; req.peer.id=call.id; ConnectionsManager.getInstance(currentAccount).sendRequest(req, new RequestDelegate(){ @Override public void run(TLObject response, TLRPC.TL_error error){ if (BuildVars.LOGS_ENABLED) { FileLog.d("Sent debug logs, response=" + response); } } }); } }
Example #20
Source File: SerializedData.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private void writeInt64(long x, DataOutputStream out) { try { for (int i = 0; i < 8; i++) { out.write((int) (x >> (i * 8))); } } catch (Exception e) { if (BuildVars.LOGS_ENABLED) { FileLog.e("write int64 error"); } } }
Example #21
Source File: SerializedData.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void readBytes(byte[] b, boolean exception) { try { in.read(b); len += b.length; } catch (Exception e) { if (exception) { throw new RuntimeException("read bytes error", e); } else { if (BuildVars.LOGS_ENABLED) { FileLog.e("read bytes error"); } } } }
Example #22
Source File: InstantCameraView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void frameAvailable(SurfaceTexture st, Integer cameraId, long timestampInternal) { synchronized (sync) { if (!ready) { return; } } long timestamp = st.getTimestamp(); if (timestamp == 0) { zeroTimeStamps++; if (zeroTimeStamps > 1) { if (BuildVars.LOGS_ENABLED) { FileLog.d("fix timestamp enabled"); } timestamp = timestampInternal; } else { return; } } else { zeroTimeStamps = 0; } handler.sendMessage(handler.obtainMessage(MSG_VIDEOFRAME_AVAILABLE, (int) (timestamp >> 32), (int) timestamp, cameraId)); }
Example #23
Source File: ForegroundDetector.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void onActivityStopped(Activity activity) { if (--refs == 0) { enterBackgroundTime = SystemClock.elapsedRealtime(); wasInBackground = true; if (BuildVars.LOGS_ENABLED) { FileLog.d("switch to background"); } for (Listener listener : listeners) { try { listener.onBecameBackground(); } catch (Exception e) { FileLog.e(e); } } } }
Example #24
Source File: WebPlayerView.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override protected void onPostExecute(String[] result) { if (result[0] != null) { if (BuildVars.LOGS_ENABLED) { FileLog.d("start play youtube video " + result[1] + " " + result[0]); } initied = true; playVideoUrl = result[0]; playVideoType = result[1]; if (playVideoType.equals("hls")) { isStream = true; } if (isAutoplay) { preparePlayer(); } showProgress(false, true); controlsView.show(true, true); } else if (!isCancelled()) { onInitFailed(); } }
Example #25
Source File: InstantCameraView.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public void frameAvailable(SurfaceTexture st, Integer cameraId, long timestampInternal) { synchronized (sync) { if (!ready) { return; } } long timestamp = st.getTimestamp(); if (timestamp == 0) { zeroTimeStamps++; if (zeroTimeStamps > 1) { if (BuildVars.LOGS_ENABLED) { FileLog.d("fix timestamp enabled"); } timestamp = timestampInternal; } else { return; } } else { zeroTimeStamps = 0; } handler.sendMessage(handler.obtainMessage(MSG_VIDEOFRAME_AVAILABLE, (int) (timestamp >> 32), (int) timestamp, cameraId)); }
Example #26
Source File: NativeByteBuffer.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void writeBytes(byte[] b) { try { if (!justCalc) { buffer.put(b); } else { len += b.length; } } catch (Exception e) { if (BuildVars.LOGS_ENABLED) { FileLog.e("write raw error"); FileLog.e(e); } } }
Example #27
Source File: VoIPBaseService.java From Telegram-FOSS 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 #28
Source File: NativeByteBuffer.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void writeBytes(byte[] b, int offset, int count) { try { if (!justCalc) { buffer.put(b, offset, count); } else { len += count; } } catch (Exception e) { if (BuildVars.LOGS_ENABLED) { FileLog.e("write raw error"); FileLog.e(e); } } }
Example #29
Source File: Shader.java From TelePlus-Android 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 #30
Source File: TelegramConnectionService.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public void onCreateIncomingConnectionFailed(PhoneAccountHandle connectionManagerPhoneAccount, ConnectionRequest request){ if(BuildVars.LOGS_ENABLED) FileLog.e("onCreateIncomingConnectionFailed "/*+request*/); if(VoIPBaseService.getSharedInstance()!=null){ VoIPBaseService.getSharedInstance().callFailedFromConnectionService(); } }