public boolean resume() {
   int i = Process.getThreadPriority(Process.myTid());
   Process.setThreadPriority(Process.THREAD_PRIORITY_URGENT_AUDIO);
   if (audioResume(ctx)) paused = false;
   Process.setThreadPriority(i);
   return paused == false;
 }
 public boolean inc_vol() {
   int i = Process.getThreadPriority(Process.myTid());
   Process.setThreadPriority(Process.THREAD_PRIORITY_URGENT_AUDIO);
   if (volume <= 0x2000) {
     volume += 0x400;
     audioSetVolume(ctx, volume);
   }
   Process.setThreadPriority(i);
   return true;
 }
 public boolean dec_vol() {
   int i = Process.getThreadPriority(Process.myTid());
   Process.setThreadPriority(Process.THREAD_PRIORITY_URGENT_AUDIO);
   if (volume >= 0x400) {
     volume -= 0x400;
     audioSetVolume(ctx, volume);
   } else if (volume != 0) audioSetVolume(ctx, 0);
   Process.setThreadPriority(i);
   return true;
 }
 @Override
 public void onCancel() {
   int pri = Process.getThreadPriority(Process.myTid());
   try {
     Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
     mSession.onCancel();
   } finally {
     Process.setThreadPriority(pri);
   }
 }
 @Override
 public void onGetSuggestionsMultiple(
     TextInfo[] textInfos, int suggestionsLimit, boolean sequentialWords) {
   int pri = Process.getThreadPriority(Process.myTid());
   try {
     Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
     mListener.onGetSuggestions(
         mSession.onGetSuggestionsMultiple(textInfos, suggestionsLimit, sequentialWords));
   } catch (RemoteException e) {
   } finally {
     Process.setThreadPriority(pri);
   }
 }
Esempio n. 6
0
 /**
  * Checks whether Thread priority is THREAD_PRIORITY_AUDIO or not.
  *
  * @param tid Thread id.
  * @return true for THREAD_PRIORITY_AUDIO and false otherwise.
  */
 @CalledByNative
 private static boolean isThreadPriorityAudio(int tid) {
   return Process.getThreadPriority(tid) == Process.THREAD_PRIORITY_AUDIO;
 }