cswitch.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. #define LOG_TAG "GuiExt"
  2. #include <cutils/log.h>
  3. #include <binder/BinderService.h>
  4. #include "ICellsPrivateService.h"
  5. using namespace android;
  6. int main(int argc, char** argv)
  7. {
  8. const sp<IServiceManager> sm = defaultServiceManager();
  9. if (sm != NULL) {
  10. sp<IBinder> binder = sm->checkService(String16("CellsPrivateService"));
  11. if (binder != NULL) {
  12. sp<ICellsPrivateService> pCellsPrivateService = interface_cast<ICellsPrivateService>(binder);
  13. if(pCellsPrivateService == NULL){
  14. ALOGE("could not get service CellsPrivateService \n");
  15. return 0;
  16. }
  17. char value[PROPERTY_VALUE_MAX];
  18. property_get("ro.boot.vm", value, "1");
  19. if((strcmp(value, "0") == 0)){
  20. if(argc == 2){
  21. pCellsPrivateService->switchCellsVM(android::String16(argv[1]));
  22. }
  23. }else{
  24. pCellsPrivateService->switchCellsVM(android::String16("host"));
  25. }
  26. }
  27. }
  28. return 0;
  29. }