예제 #1
0
 public void onCreate() {
   super.onCreate();
   Log.m11091e("dddd", "Call SipLibService onCreate");
   Log.m11095i(START_LINPHONE_LOGS);
   this.mNM = (NotificationManager) getSystemService("notification");
   LinphoneManager.createAndStart(this, this);
   this.mWifiManager = (WifiManager) getSystemService("wifi");
   if (Version.sdkAboveOrEqual(12)) {
     startWifiLock();
   }
   instance = this;
   if (Version.sdkStrictlyBelow(5)) {
     try {
       getClass().getMethod("setForeground", mSetFgSign);
     } catch (Throwable e) {
       Log.m11090e(e, "Couldn't find foreground method");
     }
   } else {
     try {
       getClass().getMethod("startForeground", mStartFgSign);
       getClass().getMethod("stopForeground", mStopFgSign);
     } catch (Throwable e2) {
       Log.m11090e(e2, "Couldn't find startGoreground or stopForeground");
     }
   }
   if (!this.mTestDelayElapsed) {
     this.mHandler.postDelayed(new C27971(), 5000);
   }
   this.mKeepAlivePendingIntent =
       PendingIntent.getBroadcast(
           this, IC_LEVEL_ORANGE, new Intent(this, KeepAliveHandler.class), 1073741824);
   ((AlarmManager) getSystemService("alarm"))
       .setRepeating(2, SystemClock.elapsedRealtime() + 1000, 60000, this.mKeepAlivePendingIntent);
 }
예제 #2
0
 private synchronized void notifyWrapper(int i, Notification notification) {
   if (instance == null || notification == null) {
     Log.m11095i("Service not ready, discarding notification");
   } else {
     this.mNM.notify(i, notification);
   }
 }
예제 #3
0
 public void onCallStateChanged(LinphoneCall linphoneCall, State state, String str) {
   if (instance == null) {
     Log.m11095i("Service not ready, discarding call state change to ", state.toString());
     return;
   }
   if (state == State.IncomingReceived) {
     onIncomingReceived();
   }
   if (state == State.CallUpdatedByRemote) {
     boolean videoEnabled = linphoneCall.getRemoteParams().getVideoEnabled();
     boolean videoEnabled2 = linphoneCall.getCurrentParamsCopy().getVideoEnabled();
     boolean shouldAutomaticallyAcceptVideoRequests =
         LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests();
     if (!(!videoEnabled
         || videoEnabled2
         || shouldAutomaticallyAcceptVideoRequests
         || LinphoneManager.getLc().isInConference())) {
       try {
         LinphoneManager.getLc().deferCallUpdate(linphoneCall);
       } catch (Throwable e) {
         C1104b.m6368b((Object) this, e);
       }
     }
   }
   if (state == State.StreamsRunning) {
     if (getResources().getBoolean(C1134b.enable_call_notification)) {}
     if (Version.sdkAboveOrEqual(12)) {
       this.mWifiLock.acquire();
     }
   } else if (getResources().getBoolean(C1134b.enable_call_notification)) {
   }
   if ((state == State.CallEnd || state == State.Error)
       && LinphoneManager.getLc().getCallsNb() < 1
       && Version.sdkAboveOrEqual(12)) {
     this.mWifiLock.release();
   }
   this.mHandler.post(new C28015(linphoneCall, state, str));
 }