Exemplo n.º 1
1
 private void proceedIntent(Intent intent) {
   if (intent != null) {
     String link = intent.getStringExtra("link");
     if (!StringUtil.isEmpty(link)) {
       Intents.openBrowser(this, link);
       finish();
       return;
     }
     Uri data = intent.getData();
     if (data != null && data.getScheme().equalsIgnoreCase("tel")) {
       String path = data.getSchemeSpecificPart();
       showPhone(path);
       getTracker().track("onShowPhone:intent");
     }
     String action = intent.getAction();
     String type = intent.getType();
     if (action != null && "com.android.phone.action.RECENT_CALLS".equals(action)) {
       mViewPager.setCurrentItem(1);
     } else if ("android.intent.action.VIEW".equals(action)
         && "vnd.android.cursor.dir/calls".equals(type)) {
       mViewPager.setCurrentItem(1);
     } else if (type != null && "vnd.android.cursor.dir/calls".equals(type)) {
       mViewPager.setCurrentItem(1);
       onBackPressed();
     }
     removeMissedCallNotifications(this);
   }
 }
Exemplo n.º 2
0
  @Override
  protected void processImport() throws SudokuInvalidFormatException {
    try {
      InputStreamReader streamReader;
      if (mUri.getScheme().equals("content")) {
        ContentResolver contentResolver = mContext.getContentResolver();
        streamReader = new InputStreamReader(contentResolver.openInputStream(mUri));
      } else {
        java.net.URI juri;
        juri = new java.net.URI(mUri.getScheme(), mUri.getSchemeSpecificPart(), mUri.getFragment());
        streamReader = new InputStreamReader(juri.toURL().openStream());
      }

      try {
        importXml(streamReader);
      } finally {
        streamReader.close();
      }
    } catch (MalformedURLException e) {
      throw new RuntimeException(e);
    } catch (IOException e) {
      throw new RuntimeException(e);
    } catch (URISyntaxException e) {
      throw new RuntimeException(e);
    }
  }
 private OpenForReadResult readDataUri(Uri paramUri) {
   Object localObject = paramUri.getSchemeSpecificPart();
   int k = ((String) localObject).indexOf(',');
   if (k == -1) {
     return null;
   }
   String[] arrayOfString = ((String) localObject).substring(0, k).split(";");
   String str = null;
   int j = 0;
   if (arrayOfString.length > 0) {
     str = arrayOfString[0];
   }
   int i = 1;
   while (i < arrayOfString.length) {
     if ("base64".equalsIgnoreCase(arrayOfString[i])) {
       j = 1;
     }
     i += 1;
   }
   localObject = ((String) localObject).substring(k + 1);
   if (j != 0) {}
   for (localObject = Base64.decode((String) localObject, 0);
       ;
       localObject = EncodingUtils.getBytes((String) localObject, "UTF-8")) {
     return new OpenForReadResult(
         paramUri, new ByteArrayInputStream((byte[]) localObject), str, localObject.length, null);
   }
 }
Exemplo n.º 4
0
 @Override
 protected void onNewIntent(Intent intent) {
   if (progress != null) {
     // Sorry, cancelling is hard. :-p Require explicit user action.
     return;
   }
   String s = intent.getStringExtra("game");
   Uri u = intent.getData();
   if (s != null && s.length() > 0) {
     Log.d(TAG, "starting game from Intent, " + s.length() + " bytes");
     startGame(-1, s);
     return;
   } else if (u != null) {
     Log.d(TAG, "URI is: \"" + u + "\"");
     String g = u.getSchemeSpecificPart();
     if (games.length < 2) games = getResources().getStringArray(R.array.games);
     for (int i = 0; i < games.length; i++) {
       if (games[i].equals(g)) {
         startGame(i, null);
         return;
       }
     }
     Log.e(TAG, "Unhandled URL! \"" + u + "\" -> g = \"" + g + "\", games = " + games);
     // TODO! Other URLs, including game states...
   }
   if (state.contains("savedGame") && state.getString("savedGame", "").length() > 0) {
     Log.d(TAG, "restoring last state");
     startGame(-1, state.getString("savedGame", ""));
   } else {
     Log.d(TAG, "no state, starting chooser");
     startChooser();
     finish();
   }
 }
  public static String piiHandle(Object pii) {
    if (pii == null || VERBOSE) {
      return String.valueOf(pii);
    }

    StringBuilder sb = new StringBuilder();
    if (pii instanceof Uri) {
      Uri uri = (Uri) pii;
      String scheme = uri.getScheme();

      if (!TextUtils.isEmpty(scheme)) {
        sb.append(scheme).append(":");
      }

      String textToObfuscate = uri.getSchemeSpecificPart();
      if (PhoneAccount.SCHEME_TEL.equals(scheme)) {
        for (int i = 0; i < textToObfuscate.length(); i++) {
          char c = textToObfuscate.charAt(i);
          sb.append(PhoneNumberUtils.isDialable(c) ? "*" : c);
        }
      } else if (PhoneAccount.SCHEME_SIP.equals(scheme)) {
        for (int i = 0; i < textToObfuscate.length(); i++) {
          char c = textToObfuscate.charAt(i);
          if (c != '@' && c != '.') {
            c = '*';
          }
          sb.append(c);
        }
      } else {
        sb.append(pii(pii));
      }
    }

    return sb.toString();
  }
 private OpenForReadResult readDataUri(Uri uri) {
   String uriAsString = uri.getSchemeSpecificPart();
   int commaPos = uriAsString.indexOf(',');
   if (commaPos == -1) {
     return null;
   }
   String[] mimeParts = uriAsString.substring(0, commaPos).split(";");
   String contentType = null;
   boolean base64 = false;
   if (mimeParts.length > 0) {
     contentType = mimeParts[0];
   }
   for (int i = 1; i < mimeParts.length; ++i) {
     if ("base64".equalsIgnoreCase(mimeParts[i])) {
       base64 = true;
     }
   }
   String dataPartAsString = uriAsString.substring(commaPos + 1);
   byte[] data =
       base64
           ? Base64.decode(dataPartAsString, Base64.DEFAULT)
           : EncodingUtils.getBytes(dataPartAsString, "UTF-8");
   InputStream inputStream = new ByteArrayInputStream(data);
   return new OpenForReadResult(uri, inputStream, contentType, data.length, null);
 }
        public void onReceive(Context context, Intent intent) {
          String action = intent.getAction();
          if (Intent.ACTION_PACKAGE_CHANGED.equals(action)
              || Intent.ACTION_PACKAGE_ADDED.equals(action)
              || Intent.ACTION_PACKAGE_REMOVED.equals(action)) {
            // Get the package name from the intent.
            Uri uri = intent.getData();
            final String packageName = uri != null ? uri.getSchemeSpecificPart() : null;
            if (packageName == null) {
              return;
            }

            // Check if icons from the searched package are present.
            // If yes remove them.
            final ArrayList<String> keysToRemove = new ArrayList<String>();
            for (String key : mKeys) {
              if (key.toLowerCase().contains(packageName.toLowerCase())) {
                keysToRemove.add(key);
              }
            }
            for (String key : keysToRemove) {
              Log.d(TAG, "application icon removed for uri= " + key);
              setKeyExcludeRecycle(key);
              removeBitmapFromMemCache(key);
            }
            if (Intent.ACTION_PACKAGE_REMOVED.equals(action)) {
              mayBeRemoveFavoriteEntry(packageName);
            }
          }
        }
Exemplo n.º 8
0
 public static String getPackageName(Intent intent) {
   Uri data = intent.getData();
   if (data != null) {
     return data.getSchemeSpecificPart();
   } else {
     return null;
   }
 }
 private String getDataUriMimeType(Uri paramUri) {
   paramUri = paramUri.getSchemeSpecificPart();
   int i = paramUri.indexOf(',');
   if (i == -1) {}
   do {
     return null;
     paramUri = paramUri.substring(0, i).split(";");
   } while (paramUri.length <= 0);
   return paramUri[0];
 }
Exemplo n.º 10
0
 /**
  * Verify the intent that was passed to this activity for any note's ID. If there are any ID, then
  * it is returned as a String.
  *
  * <p>Otherwise NULL is returned
  *
  * @return The received ID, or NULL
  */
 private String checkIntentForID() {
   String id = null;
   Uri data = getIntent().getData();
   String ssp = data.getSchemeSpecificPart();
   String[] ssp_split = ssp.split("/");
   if (ssp_split.length > 0) {
     id = ssp_split[ssp_split.length - 1];
   }
   return id;
 }
Exemplo n.º 11
0
 public void onReceive(Context context, Intent intent) {
   Uri data = intent.getData();
   Object obj = null;
   if (data != null) {
     obj = data.getSchemeSpecificPart();
   }
   if ("com.google.android.gms".equals(obj)) {
     m9168a();
     m9169b();
   }
 }
Exemplo n.º 12
0
 @Override
 public boolean shouldOverrideUrlLoading(WebViewClient client, WebView view, String url) {
   Uri uri = Uri.parse(url);
   if (U.equals(uri.getScheme(), PROTOCOL)) {
     Intent data = new Intent();
     data.putExtra(EXTRA_ref, uri.getSchemeSpecificPart());
     setResult(RESULT_gotoScripture, data);
     finish();
     return true;
   }
   return false;
 }
Exemplo n.º 13
0
 @Override
 public void onReceive(Context context, Intent intent) {
   // TODO: This method is called when the BroadcastReceiver is receiving
   // an Intent broadcast.
   Log.d(TAG, "onReceiver StaticInstallReceiver " + intent.getAction());
   if (intent.getAction() == Intent.ACTION_PACKAGE_ADDED) {
     Uri data = intent.getData();
     String packageName;
     if (data != null) {
       packageName = data.getSchemeSpecificPart();
       Log.d(TAG, "StaticInstallReceiver  " + packageName);
     }
   }
 }
        @Override
        public void onReceive(Context context, Intent intent) {
          String action = intent.getAction();

          boolean queryRestart = false;

          if (action.equals(Intent.ACTION_PACKAGE_REMOVED)
              || action.equals(Intent.ACTION_PACKAGE_RESTARTED)
              || action.equals(Intent.ACTION_PACKAGE_CHANGED)
              || (queryRestart = action.equals(Intent.ACTION_QUERY_PACKAGE_RESTART))
              || action.equals(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE)) {
            String pkgList[] = null;
            if (action.equals(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE)) {
              pkgList = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_PACKAGE_LIST);
            } else if (queryRestart) {
              pkgList = intent.getStringArrayExtra(Intent.EXTRA_PACKAGES);
            } else {
              Uri uri = intent.getData();
              if (uri == null) {
                return;
              }
              String pkgName = uri.getSchemeSpecificPart();
              if (pkgName == null) {
                return;
              }
              pkgList = new String[] {pkgName};
            }
            if (pkgList != null && (pkgList.length > 0)) {
              for (String pkgName : pkgList) {
                cancelAllNotificationsInt(pkgName, 0, 0, !queryRestart);
              }
            }
          } else if (action.equals(Intent.ACTION_SCREEN_ON)) {
            // Keep track of screen on/off state, but do not turn off the notification light
            // until user passes through the lock screen or views the notification.
            mScreenOn = true;
          } else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
            mScreenOn = false;
          } else if (action.equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) {
            mInCall =
                (intent
                    .getStringExtra(TelephonyManager.EXTRA_STATE)
                    .equals(TelephonyManager.EXTRA_STATE_OFFHOOK));
            updateNotificationPulse();
          } else if (action.equals(Intent.ACTION_USER_PRESENT)) {
            // turn off LED when user passes through lock screen
            mNotificationLight.turnOff();
          }
        }
Exemplo n.º 15
0
  /**
   * Translates Content ID urls (CID urls) into provider queries for the associated attachment. With
   * the attachment in hand, it's trivial to open a stream to the file containing the content of the
   * attachment.
   *
   * @param uri the raw URI from the HTML document in the Webview
   * @param message the message containing the HTML that is being rendered
   * @return a response if a stream to the attachment file can be created from the CID URL;
   *     <tt>null</tt> if it cannot for any reason
   */
  protected final WebResourceResponse loadCIDUri(Uri uri, ConversationMessage message) {
    // if the url is not a CID url, we do nothing
    if (!"cid".equals(uri.getScheme())) {
      return null;
    }

    // cid urls can be translated to content urls
    final String cid = uri.getSchemeSpecificPart();
    if (cid == null) {
      return null;
    }

    if (message.attachmentByCidUri == null) {
      return null;
    }

    final Uri queryUri = Uri.withAppendedPath(message.attachmentByCidUri, cid);
    if (queryUri == null) {
      return null;
    }

    // query for the attachment using its cid
    final ContentResolver cr = getActivity().getContentResolver();
    final Cursor c = cr.query(queryUri, UIProvider.ATTACHMENT_PROJECTION, null, null, null);
    if (c == null) {
      return null;
    }

    // create the attachment from the cursor, if one was found
    final Attachment target;
    try {
      if (!c.moveToFirst()) {
        return null;
      }
      target = new Attachment(c);
    } finally {
      c.close();
    }

    // try to return a response that includes a stream to the attachment data
    try {
      final ParcelFileDescriptor fd = cr.openFileDescriptor(target.contentUri, "r");
      final InputStream stream = new FileInputStream(fd.getFileDescriptor());
      return new WebResourceResponse(target.getContentType(), null, stream);
    } catch (FileNotFoundException e) {
      // if no attachment file was found return null to let webview handle it
      return null;
    }
  }
Exemplo n.º 16
0
  private boolean resolveIntent(Intent intent) {
    Uri data = intent.getData();
    String host = data.getHost();

    if (Log.isLoggable(ImApp.LOG_TAG, Log.DEBUG)) {
      log("resolveIntent: host=" + host);
    }

    if (TextUtils.isEmpty(host)) {
      Set<String> categories = intent.getCategories();
      if (categories != null) {
        Iterator<String> iter = categories.iterator();
        if (iter.hasNext()) {
          String category = iter.next();
          String providerName = getProviderNameForCategory(category);
          mProviderName = findMatchingProvider(providerName);
          if (mProviderName == null) {
            Log.w(ImApp.LOG_TAG, "resolveIntent: IM provider " + category + " not supported");
            return false;
          }
        }
      }
      mToAddress = data.getSchemeSpecificPart();
    } else {
      mProviderName = findMatchingProvider(host);

      if (mProviderName == null) {
        Log.w(ImApp.LOG_TAG, "resolveIntent: IM provider " + host + " not supported");
        return false;
      }

      String path = data.getPath();

      if (Log.isLoggable(ImApp.LOG_TAG, Log.DEBUG)) log("resolveIntent: path=" + path);

      if (!TextUtils.isEmpty(path)) {
        int index;
        if ((index = path.indexOf('/')) != -1) {
          mToAddress = path.substring(index + 1);
        }
      }
    }

    if (Log.isLoggable(ImApp.LOG_TAG, Log.DEBUG)) {
      log("resolveIntent: provider=" + mProviderName + ", to=" + mToAddress);
    }

    return true;
  }
    @Override
    public void onStart(Intent intent, int startId) {
      // TODO Auto-generated method stub
      super.onStart(intent, startId);
      Log.i(TAG, "intent=" + intent);
      if (intent == null) {
        return;
      }
      int widgetId = intent.getIntExtra("widgetId", -1);
      if (widgetId == -1) {
        return;
      }

      entity = queryEntityById(widgetId);
      if (entity != null) {}
      if (entity == null) {
        return;
      }
      if (mTokenizer == null) {
        mTokenizer = new CalculatorExpressionTokenizer(this);
      }
      if (mSymbols == null) {
        mSymbols = new Symbols();
      }

      Uri data = intent.getData();
      if (data != null) {
        int index = Integer.parseInt(data.getSchemeSpecificPart());
        if (isEvalClick) {
          if (index <= BUTTON_INDEX_9) {
            entity.setFormula("");
          }
          isEvalClick = false;
        }
        checkInput(index);
        if (index == BUTTON_INDEX_EQUAL) return;
      }
      if (entity.getView() != null) {
        int res = evaluate(entity.getFormula());
        entity.getView().setTextViewText(R.id.widget_formula, entity.getFormula());
        if (res == RESULT) {
          entity.getView().setTextViewText(R.id.widget_result, entity.getResult());
        } else {
          entity.getView().setTextViewText(R.id.widget_result, "");
        }
        AppWidgetManager.getInstance(this).updateAppWidget(widgetId, entity.getView());
      }
    }
Exemplo n.º 18
0
 /**
  * Returns a ContactList for the corresponding recipient URIs passed in. This method will always
  * block to query provider. The given URIs could be the phone data URIs or tel URI for the numbers
  * don't belong to any contact.
  *
  * @param uris phone URI to create the ContactList
  */
 public static ContactList blockingGetByUris(Parcelable[] uris) {
   ContactList list = new ContactList();
   if (uris != null && uris.length > 0) {
     for (Parcelable p : uris) {
       Uri uri = (Uri) p;
       if ("tel".equals(uri.getScheme())) {
         Contact contact = Contact.get(uri.getSchemeSpecificPart(), true);
         list.add(contact);
       }
     }
     final List<Contact> contacts = Contact.getByPhoneUris(uris);
     if (contacts != null) {
       list.addAll(contacts);
     }
   }
   return list;
 }
 private byte[] parseDataUri(final Uri uri) {
   final String ssp = uri.getSchemeSpecificPart();
   try {
     if (ssp.startsWith(BASE64_URI_PREFIX)) {
       final String base64 = ssp.substring(BASE64_URI_PREFIX.length());
       return Base64.decode(base64, Base64.URL_SAFE);
     } else if (BASE64_IMAGE_URI_PATTERN.matcher(ssp).matches()) {
       final String base64 =
           ssp.substring(ssp.indexOf(BASE64_URI_PREFIX) + BASE64_URI_PREFIX.length());
       return Base64.decode(base64, Base64.DEFAULT);
     } else {
       return null;
     }
   } catch (IllegalArgumentException ex) {
     Log.e(TAG, "Mailformed data URI: " + ex);
     return null;
   }
 }
Exemplo n.º 20
0
 public static String getPathFromUri(Context context, Uri uri) {
   String path = null;
   String uriScheme = uri.getScheme();
   if (ContentResolver.SCHEME_FILE.equals(uriScheme)) {
     path = uri.getSchemeSpecificPart();
   } else if (ContentResolver.SCHEME_CONTENT.equals(uriScheme)) {
     String[] projection = {MediaStore.Images.Media.DATA};
     Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null);
     if (cursor != null) {
       if (cursor.moveToFirst()) {
         path = cursor.getString(0);
       }
       cursor.close();
     }
   } else {
     path = uri.getPath();
   }
   return path;
 }
Exemplo n.º 21
0
  @SuppressLint("InlinedApi")
  protected Builder buildAttendee(Builder builder, Attendee attendee) {
    Uri member = Uri.parse(attendee.getValue());
    String email = member.getSchemeSpecificPart();

    Cn cn = (Cn) attendee.getParameter(Parameter.CN);
    if (cn != null) builder = builder.withValue(Attendees.ATTENDEE_NAME, cn.getValue());

    int type = Attendees.TYPE_NONE;

    CuType cutype = (CuType) attendee.getParameter(Parameter.CUTYPE);
    if (cutype == CuType.RESOURCE) type = Attendees.TYPE_RESOURCE;
    else {
      Role role = (Role) attendee.getParameter(Parameter.ROLE);
      int relationship;
      if (role == Role.CHAIR) relationship = Attendees.RELATIONSHIP_ORGANIZER;
      else {
        relationship = Attendees.RELATIONSHIP_ATTENDEE;
        if (role == Role.OPT_PARTICIPANT) type = Attendees.TYPE_OPTIONAL;
        else if (role == Role.REQ_PARTICIPANT) type = Attendees.TYPE_REQUIRED;
      }
      builder = builder.withValue(Attendees.ATTENDEE_RELATIONSHIP, relationship);
    }

    int status = Attendees.ATTENDEE_STATUS_NONE;
    PartStat partStat = (PartStat) attendee.getParameter(Parameter.PARTSTAT);
    if (partStat == null || partStat == PartStat.NEEDS_ACTION)
      status = Attendees.ATTENDEE_STATUS_INVITED;
    else if (partStat == PartStat.ACCEPTED) status = Attendees.ATTENDEE_STATUS_ACCEPTED;
    else if (partStat == PartStat.DECLINED) status = Attendees.ATTENDEE_STATUS_DECLINED;
    else if (partStat == PartStat.TENTATIVE) status = Attendees.ATTENDEE_STATUS_TENTATIVE;

    return builder
        .withValue(Attendees.ATTENDEE_EMAIL, email)
        .withValue(Attendees.ATTENDEE_TYPE, type)
        .withValue(Attendees.ATTENDEE_STATUS, status);
  }
Exemplo n.º 22
0
  protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    Uri data = intent.getData();
    entrance = data.getSchemeSpecificPart();

    // get the super and parent-child's password.
    superPwd = android.provider.Settings.System.getString(getContentResolver(), "password");
    if (null == superPwd) {
      superPwd = Config.PROGRAMME_LOCK;
    }

    bootDefaultStatus = intent.getIntExtra("service_id", 0);
    if (bootDefaultStatus == 0) {
      if (null != entrance) {
        parserLastProgram();
        parserEntrance();
      }
    }
    // start to play boot default channel.
    else {
      LogUtils.printLog(1, 3, TAG, "--- start to play default channel " + bootDefaultStatus);
      go2BootDefaultChannel(bootDefaultStatus);
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dialpad_main_list);
    // setTitle(R.string.dialpad);

    PimStart.start(this.getApplicationContext());

    PimEngine pimEng = PimEngine.getInstance(this);
    pimEng.loadCallLogs(false);
    mPhotoLoader =
        new ContactPhotoLoader(
            this, R.drawable.ic_contact_list_picture, R.drawable.ic_contact_header_unknow);
    mNumLocationLoader = new NumberLocationLoader(this);
    final List<DialpadItem> logGroups = PimEngine.getInstance(this).loadDialpadItems(false);

    final int count = logGroups.size();
    if (count > 0) {
      final ArrayList<DialpadItem> newValues = new ArrayList<DialpadItem>(count);
      for (int i = 0; i < count; i++) {
        final DialpadItem item = logGroups.get(i);
        if (DialpadItem.CALLLOG_TYPE == item.getType()) {
          newValues.add(item);
        }
      }
      mItemAdapter =
          new DialpadListAdapter(this, newValues, mPhotoLoader, mNumLocationLoader, false);
    } else {
      mItemAdapter = new DialpadListAdapter(this, null, mPhotoLoader, mNumLocationLoader, false);
    }

    // mItemAdapter = new DialpadListAdapter(this, pimEng.loadCallLogItems(false),
    //        mPhotoLoader, mNumLocationLoader);
    setListAdapter(mItemAdapter);

    ListView lv = getListView();
    lv.setOnScrollListener(this);
    registerForContextMenu(lv);

    View dialpadView = findViewById(R.id.dialpad_keyboard);
    mDialpad = new DialpadView(dialpadView, this);

    Intent dialIntent = getIntent();
    if (null != dialIntent) {
      Uri telUri = dialIntent.getData();
      if (null != telUri) {
        mDialpad.setNumber(telUri.getSchemeSpecificPart());
        mDialpad.showNumberUI();
      }
    }

    mHandler = new Handler(Looper.myLooper(), this);

    /*IntentFilter intentFilter = new IntentFilter("android.intent.action.NEW_OUTGOING_CALL");
    intentFilter.addCategory("android.intent.category.DEFAULT");
    mOutgoingCallReceiver = new OutgoingCallReceiver();
    registerReceiver(mOutgoingCallReceiver, intentFilter);

    mCallListener = new CallListener();
    TelephonyManager telephonyMgr = (TelephonyManager )getSystemService(Context.TELEPHONY_SERVICE);
    telephonyMgr.listen(mCallListener, PhoneStateListener.LISTEN_CALL_STATE);*/

    pimEng.addDataListenner(this);
  }
Exemplo n.º 24
0
 String getPackageName(Intent intent) {
   Uri uri = intent.getData();
   String pkg = uri != null ? uri.getSchemeSpecificPart() : null;
   return pkg;
 }
Exemplo n.º 25
0
    public void run() {
      // parser the entrance of dvb.
      Uri data = getIntent().getData();
      entrance = data.getSchemeSpecificPart();

      bootDefaultStatus = getIntent().getIntExtra("service_id", 0);

      synchronized (LoadDriveService.class) {
        // load drive and init the CA.
        nativeDrive = new NativeDrive(SplashActivity.this);
        nativeDrive.pvwareDRVInit();
        nativeDrive.CAInit();

        NativeSystemInfo SystemInfo = new NativeSystemInfo();
        SystemInfo.SystemInfoInit(SplashActivity.this);
      }
      // load player
      NativePlayer dvbPlayer = NativePlayer.getInstance();
      dvbPlayer.DVBPlayerInit(null);
      dvbPlayer.DVBPlayerSetStopMode(1);

      // parser the last play program.
      parserLastProgram();

      // process rec logic.
      synchronized (SplashActivity.class) {
        PVR_Rec_Status_t recFile = dvbPlayer.new PVR_Rec_Status_t();
        dvbPlayer.DVBPlayerPvrRecGetStatus(recFile);
        int status = recFile.getEnState();
        LogUtils.printLog(1, 3, TAG, "-----Rec File return value----->>>" + status);
        if (status == 2 || status == 3) {
          recStatus = true;
          recBundle = parserRecProgram();
        }
      }

      // delete the time.ts.
      StorageUtils util = new StorageUtils(SplashActivity.this);
      MountInfoBean mountInfoBean = util.getMobileHDDInfo();
      if (null != mountInfoBean) {
        // set ts file's name.
        String tmsFilePath = mountInfoBean.getPath() + "/time.ts";
        LogUtils.printLog(1, 3, TAG, "------time file path------->>>" + tmsFilePath);
        File file = new File(tmsFilePath);
        if (file.exists()) {
          dvbPlayer.DVBPlayerPvrRemoveFile(tmsFilePath);
        }
      }

      // get the super and parent-child's password.
      superPwd = android.provider.Settings.System.getString(getContentResolver(), "password");
      if (null == superPwd) {
        superPwd = Config.SUPER_PASSWORD;
      }

      // get programme grade.
      try {
        grade = android.provider.Settings.System.getInt(getContentResolver(), "eit_grade");
      } catch (SettingNotFoundException e) {
        // get the eit grade exception, set the default value.
        grade = 1;
        e.printStackTrace();
      }
      handler.sendEmptyMessage(Config.CONNECTION_SUCCESS);
    }
Exemplo n.º 26
0
  /**
   * This can be used by telecom to either create a new outgoing call or attach to an existing
   * incoming call. In either case, telecom will cycle through a set of services and call
   * createConnection util a connection service cancels the process or completes it successfully.
   */
  private void createConnection(
      final PhoneAccountHandle callManagerAccount,
      final String callId,
      final ConnectionRequest request,
      boolean isIncoming,
      boolean isUnknown) {
    Log.d(
        this,
        "createConnection, callManagerAccount: %s, callId: %s, request: %s, "
            + "isIncoming: %b, isUnknown: %b",
        callManagerAccount,
        callId,
        request,
        isIncoming,
        isUnknown);

    Connection connection =
        isUnknown
            ? onCreateUnknownConnection(callManagerAccount, request)
            : isIncoming
                ? onCreateIncomingConnection(callManagerAccount, request)
                : onCreateOutgoingConnection(callManagerAccount, request);
    Log.d(this, "createConnection, connection: %s", connection);
    if (connection == null) {
      connection = Connection.createFailedConnection(new DisconnectCause(DisconnectCause.ERROR));
    }

    if (connection.getState() != Connection.STATE_DISCONNECTED) {
      addConnection(callId, connection);
    }

    Uri address = connection.getAddress();
    String number = address == null ? "null" : address.getSchemeSpecificPart();
    Log.v(
        this,
        "createConnection, number: %s, state: %s, capabilities: %s",
        Connection.toLogSafePhoneNumber(number),
        Connection.stateToString(connection.getState()),
        Connection.capabilitiesToString(connection.getConnectionCapabilities()));

    Log.d(this, "createConnection, calling handleCreateConnectionSuccessful %s", callId);
    mAdapter.handleCreateConnectionComplete(
        callId,
        request,
        new ParcelableConnection(
            request.getAccountHandle(),
            connection.getState(),
            connection.getConnectionCapabilities(),
            connection.getAddress(),
            connection.getAddressPresentation(),
            connection.getCallerDisplayName(),
            connection.getCallerDisplayNamePresentation(),
            connection.getVideoProvider() == null
                ? null
                : connection.getVideoProvider().getInterface(),
            connection.getVideoState(),
            connection.isRingbackRequested(),
            connection.getAudioModeIsVoip(),
            connection.getStatusHints(),
            connection.getDisconnectCause(),
            createIdList(connection.getConferenceables())));
  }
  private void handleGeoUri(final Uri uri) throws URISyntaxException {
    final String[] parts = uri.getSchemeSpecificPart().split("\\?", 2);
    Double lat = null, lon = null;
    Integer z = null;
    String search = null;

    // parts[0] may contain an 'uncertainty' parameter, delimited by a semicolon
    final String[] pos = parts[0].split(";", 2)[0].split(",", 2);
    if (pos.length == 2) {
      try {
        lat = Double.valueOf(pos[0]);
        lon = Double.valueOf(pos[1]);
      } catch (final NumberFormatException e) {
        lat = null;
        lon = null;
      }
    }

    if (parts.length > 1) { // query string present
      // search for z=
      for (final String param : parts[1].split("&")) {
        if (param.startsWith("z=")) {
          try {
            z = Integer.valueOf(param.substring(2));
          } catch (final NumberFormatException e) {
          }
        }
        if (param.startsWith("q=")) {
          search = param.substring(2);
          final Pattern pattern =
              Pattern.compile("^(-?\\d+(\\.\\d+)?),(-?\\d+(\\.\\d+)?)\\s*\\(.+\\)");
          final Matcher matcher = pattern.matcher(search);
          if (matcher.matches()) {
            try {
              lat = Double.valueOf(matcher.group(1));
              lon = Double.valueOf(matcher.group(3));
              search = null; // if we have a position, we don't need the search term
            } catch (final NumberFormatException e) {
              lat = null;
              lon = null;
            }
          }
        }
      }
    }

    if (lat != null && lon != null) {
      String url = mIntelUrl + "?ll=" + lat + "," + lon;
      if (z != null) {
        url += "&z=" + z;
      }
      loadUrl(url);
      return;
    }

    if (search != null) {
      if (mIsLoading) {
        mSearchTerm = search;
        loadUrl(mIntelUrl);
      } else {
        switchToPane(Pane.MAP);
        mIitcWebView.loadUrl("javascript:search('" + search + "');");
      }
      return;
    }

    throw new URISyntaxException(uri.toString(), "position could not be parsed");
  }
Exemplo n.º 28
0
  private void handleSearchOrAppViewIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      String query = intent.getStringExtra(SearchManager.QUERY);
      performSearch(query);
      return;
    }

    final Uri data = intent.getData();
    if (data == null) {
      return;
    }

    final String scheme = data.getScheme();
    final String path = data.getPath();
    String packageName = null;
    String query = null;
    if (data.isHierarchical()) {
      final String host = data.getHost();
      if (host == null) {
        return;
      }
      switch (host) {
        case "f-droid.org":
          if (path.startsWith("/repository/browse")) {
            // http://f-droid.org/repository/browse?fdfilter=search+query
            query = UriCompat.getQueryParameter(data, "fdfilter");

            // http://f-droid.org/repository/browse?fdid=packageName
            packageName = UriCompat.getQueryParameter(data, "fdid");
          } else if (path.startsWith("/app")) {
            // http://f-droid.org/app/packageName
            packageName = data.getLastPathSegment();
            if ("app".equals(packageName)) {
              packageName = null;
            }
          }
          break;
        case "details":
          // market://details?id=app.id
          packageName = UriCompat.getQueryParameter(data, "id");
          break;
        case "search":
          // market://search?q=query
          query = UriCompat.getQueryParameter(data, "q");
          break;
        case "play.google.com":
          if (path.startsWith("/store/apps/details")) {
            // http://play.google.com/store/apps/details?id=app.id
            packageName = UriCompat.getQueryParameter(data, "id");
          } else if (path.startsWith("/store/search")) {
            // http://play.google.com/store/search?q=foo
            query = UriCompat.getQueryParameter(data, "q");
          }
          break;
        case "apps":
        case "amazon.com":
        case "www.amazon.com":
          // amzn://apps/android?p=app.id
          // http://amazon.com/gp/mas/dl/android?s=app.id
          packageName = UriCompat.getQueryParameter(data, "p");
          query = UriCompat.getQueryParameter(data, "s");
          break;
      }
    } else if ("fdroid.app".equals(scheme)) {
      // fdroid.app:app.id
      packageName = data.getSchemeSpecificPart();
    } else if ("fdroid.search".equals(scheme)) {
      // fdroid.search:query
      query = data.getSchemeSpecificPart();
    }

    if (!TextUtils.isEmpty(query)) {
      // an old format for querying via packageName
      if (query.startsWith("pname:")) packageName = query.split(":")[1];

      // sometimes, search URLs include pub: or other things before the query string
      if (query.contains(":")) query = query.split(":")[1];
    }

    if (!TextUtils.isEmpty(packageName)) {
      Utils.debugLog(TAG, "FDroid launched via app link for '" + packageName + "'");
      Intent intentToInvoke = new Intent(this, AppDetails.class);
      intentToInvoke.putExtra(AppDetails.EXTRA_APPID, packageName);
      startActivity(intentToInvoke);
      finish();
    } else if (!TextUtils.isEmpty(query)) {
      Utils.debugLog(TAG, "FDroid launched via search link for '" + query + "'");
      performSearch(query);
    }
  }