Example #1
0
 /**
  * Full size bitmap.
  *
  * @param maxNumberOfPixels the max number of pixels
  * @param rotateAsNeeded the rotate as needed
  * @return the bitmap
  */
 public Bitmap fullSizeBitmap(int maxNumberOfPixels, boolean rotateAsNeeded) {
   Logger.v(TAG, "fullSizeBitmap entry");
   int minSideLength = getProperWindowSize();
   String path = mUri.getPath();
   ParcelFileDescriptor pfdInput = null;
   try {
     pfdInput = ParcelFileDescriptor.open(new File(path), ParcelFileDescriptor.MODE_READ_ONLY);
   } catch (FileNotFoundException e) {
     Logger.e(TAG, "got exception decoding bitmap ");
     e.printStackTrace();
   }
   Bitmap bitmap = null;
   bitmap = makeBitmap(minSideLength, maxNumberOfPixels, null, null, pfdInput, null);
   if (bitmap != null && rotateAsNeeded) {
     Bitmap rotatedBitmap = rotate(bitmap, getDegreesRotated());
     if (rotatedBitmap != null && rotatedBitmap != bitmap) {
       Logger.v(TAG, "fullSizeBitmap rotate");
       bitmap.recycle();
       bitmap = rotatedBitmap;
     } else {
       Logger.d(TAG, "fullSizeBitmap no need to roate");
     }
   }
   Logger.v(TAG, "fullSizeBitmap exit");
   return bitmap;
 }
Example #2
0
 /**
  * Rotate.
  *
  * @param b the b
  * @param degrees the degrees
  * @return the bitmap
  */
 private Bitmap rotate(final Bitmap b, int degrees) {
   Logger.v(TAG, "rotate entry");
   Bitmap bitmap = b;
   if (degrees != 0 && bitmap != null) {
     Matrix m = new Matrix();
     m.setRotate(degrees, (float) bitmap.getWidth() / 2, (float) bitmap.getHeight() / 2);
     try {
       Bitmap bitmapRotated =
           Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true);
       if (bitmap != bitmapRotated) {
         bitmap.recycle();
         bitmap = bitmapRotated;
       } else {
         Logger.d(TAG, "no need to rotate");
       }
     } catch (OutOfMemoryError ex) {
       // We have no memory to rotate. Return the original bitmap.
       ex.printStackTrace();
     }
   } else {
     Logger.d(TAG, "rotate no need to rotate");
   }
   Logger.v(TAG, "rotate exit");
   return bitmap;
 }
  private void analysisAttribute() {
    long videoId = -1;
    String whereClause = MediaStore.Video.Media.DISPLAY_NAME + "='" + mFileName + "'";
    ContentResolver cr = AndroidFactory.getApplicationContext().getContentResolver();
    Cursor cursor = null;
    try {
      cursor =
          cr.query(
              MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
              new String[] {
                MediaStore.Video.VideoColumns._ID, MediaStore.Video.VideoColumns.DURATION
              },
              whereClause,
              null,
              null);
      if (cursor != null && cursor.getCount() != 0) {
        cursor.moveToFirst();
        videoId = cursor.getLong(cursor.getColumnIndex(MediaStore.Video.VideoColumns._ID));
        int duration = cursor.getInt(cursor.getColumnIndex(MediaStore.Video.VideoColumns.DURATION));
        setDuration(duration);
      } else {
        Logger.w(TAG, "analysisAttribute(), cursor is null!");
      }
    } finally {
      if (cursor != null) {
        cursor.close();
        cursor = null;
      }
    }

    if (videoId != -1) {
      whereClause = android.provider.MediaStore.Video.Thumbnails.VIDEO_ID + "='" + videoId + "'";
      try {
        cursor =
            cr.query(
                android.provider.MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI,
                new String[] {android.provider.MediaStore.Video.Thumbnails.DATA},
                whereClause,
                null,
                null);
        if (cursor != null && cursor.getCount() != 0) {
          cursor.moveToFirst();
          String thumbnailPath =
              cursor.getString(
                  cursor.getColumnIndex(android.provider.MediaStore.Video.Thumbnails.DATA));
          setThumbPath(thumbnailPath);
        } else {
          Logger.w(TAG, "analysisAttribute(), cursor is null!");
        }
      } finally {
        if (cursor != null) {
          cursor.close();
          cursor = null;
        }
      }
    } else {
      Logger.w(TAG, "analysisAttribute(), have no this image!");
    }
  }
 /** control the RCS component according to the configuration and active status. */
 private void controlRcseComponent() {
   Context context = getApplicationContext();
   if (Logger.getIsIntegrationMode()) {
     Logger.d(TAG, "controlRcseComponent() is integration mode ");
     setIntegrationModeComponent(context);
   } else {
     setComponentStatus(context, true);
   }
 }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   Logger.d(TAG, "onCreate() entry");
   super.onCreate(savedInstanceState);
   setContentView(R.layout.rcs_more_settings);
   ActionBar bar = getActionBar();
   bar.setDisplayHomeAsUpEnabled(true);
   Logger.d(TAG, "onCreate() exit");
 }
 /**
  * Set component status in packageManager.
  *
  * @param context The context
  * @param status The component status
  */
 public static void setComponentStatus(Context context, boolean status) {
   Logger.d(
       TAG,
       "setComponentStatus() entry with the context is "
           + context
           + " and the status is "
           + status);
   setComponentEnabled(ChatMainActivity.class, status, context);
   setComponentEnabled(PluginProxyActivity.class, status, context);
   Logger.d(TAG, "setComponentStatus() exit");
 }
  /** Test the inner class FileTransferAdapter */
  public void testCase7_FileTransferAdapter() throws Throwable {
    Logger.v(TAG, "testCase7_FileTransferAdapter()");
    One2OneChatWindowAdapter chatWindowAdapter = getOne2OneChatWindowAdapter();
    IRemoteOne2OneChatWindow remoteChatWindow =
        (IRemoteOne2OneChatWindow) chatWindowAdapter.getChatWindow();
    MockRemoteOne2OneChatWindow mockRemoteChatWindow =
        (MockRemoteOne2OneChatWindow) remoteChatWindow;
    FileStruct mockFileStruct = new FileStruct("", "", MOCK_SIZE, new Object(), new Date());
    FileTransferAdapter fileTransferAdapter =
        (FileTransferAdapter) chatWindowAdapter.addReceivedFileTransfer(mockFileStruct);

    // Test FileTransferAdapter#setFilePath()
    mockRemoteChatWindow.mockRemoteFileTransfer.isSetFilePathCalled = false;
    fileTransferAdapter.setFilePath(MOCK_FILEPATH);
    assertTrue(mockRemoteChatWindow.mockRemoteFileTransfer.isSetFilePathCalled);

    // Test FileTransferAdapter#setProgress()
    mockRemoteChatWindow.mockRemoteFileTransfer.isSetProgressCalled = false;
    fileTransferAdapter.setProgress(MOCK_PROGRESS);
    assertTrue(mockRemoteChatWindow.mockRemoteFileTransfer.isSetProgressCalled);

    // Test FileTransferAdapter#setStatus()
    mockRemoteChatWindow.mockRemoteFileTransfer.isSetStatusCalled = false;
    fileTransferAdapter.setStatus(Status.FINISHED);
    assertTrue(mockRemoteChatWindow.mockRemoteFileTransfer.isSetStatusCalled);
  }
  /** Test the inner class SentChatMessageAdapter */
  public void testCase9_SentChatMessageAdapter() throws Throwable {
    Logger.v(TAG, "testCase9_SentChatMessageAdapter()");
    One2OneChatWindowAdapter chatWindowAdapter = getOne2OneChatWindowAdapter();
    IRemoteOne2OneChatWindow remoteChatWindow =
        (IRemoteOne2OneChatWindow) chatWindowAdapter.getChatWindow();
    MockRemoteOne2OneChatWindow mockRemoteChatWindow =
        (MockRemoteOne2OneChatWindow) remoteChatWindow;
    SentChatMessageAdapter sentChatMessageAdapter =
        (SentChatMessageAdapter) chatWindowAdapter.addSentMessage(null, 0);

    // Test SentChatMessageAdapter#getId()
    mockRemoteChatWindow.mockRemoteSentChatMessage.isGetIdCalled = false;
    sentChatMessageAdapter.getId();
    assertTrue(mockRemoteChatWindow.mockRemoteSentChatMessage.isGetIdCalled);

    // Test SentChatMessageAdapter#updateDate()
    mockRemoteChatWindow.mockRemoteSentChatMessage.isUpdateDateCalled = false;
    sentChatMessageAdapter.updateDate(new Date());
    assertTrue(mockRemoteChatWindow.mockRemoteSentChatMessage.isUpdateDateCalled);

    // Test SentChatMessageAdapter#updateStatus()
    mockRemoteChatWindow.mockRemoteSentChatMessage.isUpdateStatusCalled = false;
    sentChatMessageAdapter.updateStatus(ChatView.ISentChatMessage.Status.DISPLAYED);
    assertTrue(mockRemoteChatWindow.mockRemoteSentChatMessage.isUpdateStatusCalled);
  }
Example #9
0
 /**
  * Gets the degrees rotated.
  *
  * @return the degrees rotated
  */
 private int getDegreesRotated() {
   Logger.v(TAG, "getDegreesRotated entry");
   int degreesRotated = 0;
   int orientation = 0;
   String dataPath = mUri.getPath();
   try {
     ExifInterface exif = new ExifInterface(dataPath);
     orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0);
     degreesRotated = getExifRotation(orientation);
   } catch (IOException ex) {
     Logger.d(TAG, "getDegreesRotated cannot read exif");
     ex.printStackTrace();
   }
   Logger.v(TAG, "getDegreesRotated exit with degreesRotated: " + degreesRotated);
   return degreesRotated;
 }
 /** Test the function removeChatWindow() */
 public void testCase4_RemoveChatWindow() throws Throwable {
   Logger.v(TAG, "testCase4_RemoveChatWindow()");
   assertFalse(mRemoteChatWindowManager.removeChatWindow(null));
   // Add One2OneChatWindow
   IOne2OneChatWindow remoteOne2OneChatWindow =
       (IOne2OneChatWindow)
           mRemoteChatWindowManager.addOne2OneChatWindow(
               MOCK_TAG, new Participant(MOCK_NUMBER, MOCK_NAME));
   // Remove One2OneChatWindow
   mMockRemoteChatWindowManager.isRemoveOne2OneChatWindowCalled = false;
   boolean removeOne2OneChatWindowResult =
       mRemoteChatWindowManager.removeChatWindow(remoteOne2OneChatWindow);
   assertTrue(removeOne2OneChatWindowResult);
   assertTrue(mMockRemoteChatWindowManager.isRemoveOne2OneChatWindowCalled);
   mMockRemoteChatWindowManager.isRemoveOne2OneChatWindowCalled = false;
   // Add GroupChatWindow
   IGroupChatWindow remoteGroupChatWindow =
       (IGroupChatWindow)
           mRemoteChatWindowManager.addGroupChatWindow(MOCK_TAG2, getParticipantList());
   // remove GroupChatWindow
   mMockRemoteChatWindowManager.isRemoveGroupChatWindowCalled = false;
   boolean removeGroupChatWindowResult =
       mRemoteChatWindowManager.removeChatWindow(remoteGroupChatWindow);
   assertTrue(removeGroupChatWindowResult);
   assertTrue(mMockRemoteChatWindowManager.isRemoveGroupChatWindowCalled);
   mMockRemoteChatWindowManager.isRemoveGroupChatWindowCalled = false;
 }
 @Override
 public void onCreate() {
   super.onCreate();
   AndroidFactory.setApplicationContext(getApplicationContext());
   Logger.initialize(getApplicationContext());
   Logger.v(TAG, "onCreate() entry");
   if (!ApiManager.initialize(getApplicationContext())) {
     Logger.e(TAG, "onCreate() ApiManager initialization failed!");
   }
   ContactsListManager.initialize(getApplicationContext());
   startService(new Intent(this, ApiService.class));
   // Init UnreadMessageManager
   UnreadMessageManager.getInstance();
   EmoticonsModelImpl.init(getApplicationContext());
   controlRcseComponent();
   Logger.v(TAG, "onCreate() exit");
 }
 /**
  * Test updateStatus
  *
  * @throws NoSuchFieldException
  * @throws IllegalArgumentException
  * @throws IllegalAccessException
  */
 public void testCase01_updateStatus()
     throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
   Logger.d(TAG, "testCase01_updateStatus");
   Field fieldmIsRead = Utils.getPrivateField(mReceivedChatMessage.getClass(), "mIsRead");
   assertFalse(fieldmIsRead.getBoolean(mReceivedChatMessage));
   mReceivedChatMessage.updateStatus(true);
   assertTrue(fieldmIsRead.getBoolean(mReceivedChatMessage));
 }
 /** Test the function switchChatWindowByTag() */
 public void testCase3_SwitchChatWindowByTag() throws Throwable {
   Logger.v(TAG, "testCase3_SwitchChatWindowByTag()");
   mMockRemoteChatWindowManager.isSwitchChatWindowByTagCalled = false;
   ParcelUuid parcelUuid = new ParcelUuid(new UUID(1, 1));
   mRemoteChatWindowManager.switchChatWindowByTag(parcelUuid);
   assertTrue(mMockRemoteChatWindowManager.isSwitchChatWindowByTagCalled);
   mMockRemoteChatWindowManager.isSwitchChatWindowByTagCalled = false;
 }
 /** Test the function addGroupChatWindow() */
 public void testCase2_AddGroupChatWindow() throws Throwable {
   Logger.v(TAG, "testCase2_AddOne2OneChatWindow()");
   mMockRemoteChatWindowManager.isAddGroupChatWindowCalled = false;
   IGroupChatWindow remoteGroupChatWindow =
       (IGroupChatWindow)
           mRemoteChatWindowManager.addGroupChatWindow(MOCK_TAG2, getParticipantList());
   assertNotNull(remoteGroupChatWindow);
   assertTrue(mMockRemoteChatWindowManager.isAddGroupChatWindowCalled);
   mMockRemoteChatWindowManager.isAddGroupChatWindowCalled = false;
 }
 public void tearDown() throws Exception {
   Logger.v(TAG, "tearDown()");
   // Remove RemoteChatWindowManager of binder
   mBinder.removeChatWindowManager(mMockRemoteChatWindowManager);
   mBinder = null;
   mMockRemoteChatWindowManager = null;
   mChatWindowManagerAdapters = null;
   mRemoteChatWindowManager = null;
   super.tearDown();
 }
Example #16
0
 /**
  * Make bitmap.
  *
  * @param minSideLength the min side length
  * @param maxNumOfPixels the max num of pixels
  * @param uri the uri
  * @param cr the cr
  * @param pfd the pfd
  * @param options the options
  * @return the bitmap
  */
 private Bitmap makeBitmap(
     int minSideLength,
     int maxNumOfPixels,
     Uri uri,
     ContentResolver cr,
     ParcelFileDescriptor pfd,
     final BitmapFactory.Options options) {
   Logger.v(TAG, "makeBitmap entry");
   if (pfd == null) {
     Logger.d(TAG, "makeBitmap pfd is null");
     return null;
   }
   try {
     BitmapFactory.Options tempOptions = options;
     if (tempOptions == null) {
       tempOptions = new BitmapFactory.Options();
     }
     FileDescriptor fd = pfd.getFileDescriptor();
     tempOptions.inJustDecodeBounds = true;
     BitmapFactory.decodeFileDescriptor(fd, null, tempOptions);
     if (tempOptions.mCancel || tempOptions.outWidth == -1 || tempOptions.outHeight == -1) {
       return null;
     }
     tempOptions.inSampleSize = computeSampleSize(tempOptions, minSideLength, maxNumOfPixels);
     tempOptions.inJustDecodeBounds = false;
     // for zoom pan performance enhancement,
     // load full size bitmap in format RGB_565, with dither option
     // on
     tempOptions.inDither = false;
     tempOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;
     // options.inDither = true;
     // options.inPreferredConfig = Bitmap.Config.RGB_565;
     Logger.v(TAG, "makeBitmap exit");
     return BitmapFactory.decodeFileDescriptor(fd, null, tempOptions);
   } catch (OutOfMemoryError ex) {
     Logger.e(TAG, "got oom exception");
     ex.printStackTrace();
     return null;
   } finally {
     closeSilently(pfd);
   }
 }
 /** Create a ParticipantList */
 private List<ParticipantInfo> getParticipantList() {
   Logger.v(TAG, "getParticipantList()");
   ParticipantInfo participantInfo1 =
       new ParticipantInfo(new Participant(MOCK_NUMBER, MOCK_NAME), User.STATE_CONNECTED);
   ParticipantInfo participantInfo2 =
       new ParticipantInfo(new Participant(MOCK_NUMBER2, MOCK_NAME2), User.STATE_CONNECTED);
   List<ParticipantInfo> participantList = new ArrayList<ParticipantInfo>();
   participantList.add(participantInfo1);
   participantList.add(participantInfo2);
   return participantList;
 }
 public PluginIpAttachMessage(FileStructForBinder fileStruct, String remote) {
   Logger.d(TAG, "PluginIpAttachMessage(), fileStruct = " + fileStruct + " remote = " + remote);
   setSimId((int) PluginUtils.DUMMY_SIM_ID);
   setSize((int) fileStruct.fileSize / PluginUtils.SIZE_K);
   setPath(fileStruct.filePath);
   setType(IpMessageConsts.IpMessageType.UNKNOWN_FILE);
   setFrom(remote);
   setTo(remote);
   mFileName = fileStruct.fileName;
   mTransferTag = fileStruct.fileTransferTag;
 }
 /** Test the function addOne2OneChatWindow() */
 public void testCase1_AddOne2OneChatWindow() throws Throwable {
   Logger.v(TAG, "testCase1_AddOne2OneChatWindow()");
   mMockRemoteChatWindowManager.isAddOne2OneChatWindowCalled = false;
   IOne2OneChatWindow remoteOne2OneChatWindow =
       (IOne2OneChatWindow)
           mRemoteChatWindowManager.addOne2OneChatWindow(
               MOCK_TAG, new Participant(MOCK_NUMBER, MOCK_NAME));
   assertNotNull(remoteOne2OneChatWindow);
   assertTrue(mMockRemoteChatWindowManager.isAddOne2OneChatWindowCalled);
   mMockRemoteChatWindowManager.isAddOne2OneChatWindowCalled = false;
 }
Example #20
0
 /**
  * Close silently.
  *
  * @param c the c
  */
 private void closeSilently(ParcelFileDescriptor c) {
   Logger.v(TAG, "closeSilently entry");
   if (c == null) {
     return;
   }
   try {
     c.close();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
 @Override
 public IReceivedChatMessage addReceivedMessage(InstantMessage message, boolean isRead) {
   Logger.d(TAG, "addReceivedMessage(): mShouldAddSentMessage = " + mShouldAddSentMessage);
   ReceivedMessage receivedMessage = null;
   if (mShouldAddSentMessage) {
     One2OneChatFragment fragment = new One2OneChatFragment();
     receivedMessage = fragment.new ReceivedMessage(message);
     return receivedMessage;
   } else {
     return receivedMessage;
   }
 }
 public PluginIpVideoMessage(FileStructForBinder fileStruct, String remote) {
   Logger.d(TAG, "PluginIpVideoMessage(), fileStruct = " + fileStruct + " remote = " + remote);
   setSimId((int) PluginUtils.DUMMY_SIM_ID);
   mFileName = fileStruct.fileName;
   setSize((int) (fileStruct.fileSize / PluginUtils.SIZE_K));
   setPath(fileStruct.filePath);
   setType(IpMessageConsts.IpMessageType.VIDEO);
   setFrom(remote);
   setTo(remote);
   mTransferTag = fileStruct.fileTransferTag;
   analysisAttribute();
 }
 /**
  * Set component class enable or disable in packageManager.
  *
  * @param clazz the class need to be set.
  * @param enabled whether to enable or disable the clazz.
  */
 private static void setComponentEnabled(Class<?> clazz, boolean enabled, Context context) {
   Logger.d(TAG, "setComponentEnabled() enable is " + enabled + " and the context is " + context);
   final ComponentName c = new ComponentName(context, clazz.getName());
   context
       .getPackageManager()
       .setComponentEnabledSetting(
           c,
           enabled
               ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
               : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
           PackageManager.DONT_KILL_APP);
 }
 @Override
 public void enterChatMode(String number) {
   Logger.d(TAG, "enterChatMode() entry, number " + number);
   if (PluginUtils.getMessagingMode() == 0) {
     if (number.startsWith(IpMessageConsts.JOYN_START)) {
       number = number.substring(4);
     }
   }
   Message controllerMessage =
       PluginController.obtainMessage(
           ChatController.EVENT_SHOW_WINDOW, PhoneUtils.formatNumberToInternational(number));
   controllerMessage.sendToTarget();
   if ((PluginUtils.getMessagingMode() == 1) && (PluginUtils.translateThreadId(number) == 1)) {
     Logger.v(TAG, "enterChatMode(), open Window = " + number);
     Intent intent = new Intent(InvitationDialog.ACTION);
     intent.putExtra(RcsNotification.CONTACT, number);
     intent.putExtra(InvitationDialog.KEY_STRATEGY, InvitationDialog.STRATEGY_IPMES_SEND_BY_SMS);
     intent.putExtra("showDialog", true);
     intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
     AndroidFactory.getApplicationContext().startActivity(intent);
   }
   super.enterChatMode(number);
 }
 @Override
 public void exitFromChatMode(String number) {
   Logger.d(TAG, "exitFromChatMode() entry, number " + number);
   if (PluginUtils.getMessagingMode() == 0) {
     if (number.startsWith(IpMessageConsts.JOYN_START)) {
       number = number.substring(4);
     }
   }
   Message controllerMessage =
       PluginController.obtainMessage(
           ChatController.EVENT_HIDE_WINDOW, PhoneUtils.formatNumberToInternational(number));
   controllerMessage.sendToTarget();
   super.exitFromChatMode(number);
 }
 /**
  * Test onAddChatWindow
  *
  * @throws IllegalArgumentException
  * @throws NoSuchFieldException
  * @throws IllegalAccessException
  */
 public void testCase02_onAddChatWindow()
     throws IllegalArgumentException, NoSuchFieldException, IllegalAccessException {
   Logger.d(TAG, "testCase02_onAddChatWindow");
   ConcurrentHashMap<IChatWindow, IChatWindowMessage> chatWindowMap = getChatWindowMapFiled();
   chatWindowMap.clear();
   mReceivedChatMessage.onAddChatWindow(null);
   assertTrue(chatWindowMap.size() == 0);
   mOneOneWindow.mShouldAddSentMessage = false;
   mReceivedChatMessage.onAddChatWindow(mOneOneWindow);
   assertTrue(chatWindowMap.size() == 0);
   mOneOneWindow.mShouldAddSentMessage = true;
   mReceivedChatMessage.onAddChatWindow(mOneOneWindow);
   assertTrue(chatWindowMap.containsKey(mOneOneWindow));
   chatWindowMap.clear();
 }
  /** Test the inner class ReceivedChatMessageAdapter */
  public void testCase8_ReceivedChatMessageAdapter() throws Throwable {
    Logger.v(TAG, "testCase8_ReceivedChatMessageAdapter()");
    One2OneChatWindowAdapter chatWindowAdapter = getOne2OneChatWindowAdapter();
    IRemoteOne2OneChatWindow remoteChatWindow =
        (IRemoteOne2OneChatWindow) chatWindowAdapter.getChatWindow();
    MockRemoteOne2OneChatWindow mockRemoteChatWindow =
        (MockRemoteOne2OneChatWindow) remoteChatWindow;
    ReceivedChatMessageAdapter receivedChatMessageAdapter =
        (ReceivedChatMessageAdapter) chatWindowAdapter.addReceivedMessage(null, false);

    // Test FileTransferAdapter#getId()
    mockRemoteChatWindow.mockRemoteReceivedChatMessage.isGetIdCalled = false;
    receivedChatMessageAdapter.getId();
    assertTrue(mockRemoteChatWindow.mockRemoteReceivedChatMessage.isGetIdCalled);
  }
 /** Use reflect to get GroupChatWindowAdapter instance */
 private GroupChatWindowAdapter getGroupChatWindowAdapter() throws Throwable {
   Logger.v(TAG, "getGroupChatWindowAdapter()");
   // Add GroupChatWindow
   mRemoteChatWindowManager.addGroupChatWindow(MOCK_TAG2, getParticipantList());
   // Get WindowBinder#chatWindowManagerAdapters[0]
   ChatWindowManagerAdapter chatWindowManagerAdapter = mChatWindowManagerAdapters.get(0);
   // Get ChatWindowManagerAdapter#mRemoteChatWindows
   Field fieldRemoteChatWindows =
       Utils.getPrivateField(ChatWindowManagerAdapter.class, "mRemoteChatWindows");
   List<BaseChatWindow> mRemoteChatWindows =
       (List<BaseChatWindow>) fieldRemoteChatWindows.get(chatWindowManagerAdapter);
   // Get GroupChatWindowAdapter
   GroupChatWindowAdapter groupChatWindowAdapter =
       (GroupChatWindowAdapter) mRemoteChatWindows.get(0);
   assertNotNull(groupChatWindowAdapter);
   return groupChatWindowAdapter;
 }
 /** Use reflect to get One2OneChatWindowAdapter instance */
 private One2OneChatWindowAdapter getOne2OneChatWindowAdapter() throws Throwable {
   Logger.v(TAG, "getGroupChatWindowAdapter()");
   // Add One2OneChatWindow
   mRemoteChatWindowManager.addOne2OneChatWindow(
       MOCK_TAG, new Participant(MOCK_NUMBER, MOCK_NAME));
   // Get WindowBinder#chatWindowManagerAdapters[0]
   ChatWindowManagerAdapter chatWindowManagerAdapter = mChatWindowManagerAdapters.get(0);
   // Get ChatWindowManagerAdapter#mRemoteChatWindows
   Field fieldRemoteChatWindows =
       Utils.getPrivateField(ChatWindowManagerAdapter.class, "mRemoteChatWindows");
   List<BaseChatWindow> mRemoteChatWindows =
       (List<BaseChatWindow>) fieldRemoteChatWindows.get(chatWindowManagerAdapter);
   // Get GroupChatWindowAdapter
   One2OneChatWindowAdapter one2OneChatWindowAdapter =
       (One2OneChatWindowAdapter) mRemoteChatWindows.get(0);
   assertNotNull(one2OneChatWindowAdapter);
   return one2OneChatWindowAdapter;
 }
 @Override
 public void sendChatMode(String number, int status) {
   Logger.d(TAG, "sendChatMode() the number is " + number + " status is " + status);
   boolean isEmpty = true;
   if (PluginUtils.getMessagingMode() == 0) {
     if (number.startsWith(IpMessageConsts.JOYN_START)) {
       number = number.substring(4);
     }
   }
   if (status == ContactStatus.STOP_TYPING) {
     isEmpty = true;
   } else if (status == ContactStatus.TYPING) {
     isEmpty = false;
   }
   Message controllerMessage =
       PluginController.obtainMessage(
           ChatController.EVENT_TEXT_CHANGED,
           PhoneUtils.formatNumberToInternational(number),
           isEmpty);
   controllerMessage.sendToTarget();
 }