Example usage for android.os RemoteException printStackTrace

List of usage examples for android.os RemoteException printStackTrace

Introduction

In this page you can find the example usage for android.os RemoteException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.dzt.musicplay.player.AudioService.java

private void executeUpdate(Boolean updateWidget) {
    for (IAudioServiceCallback callback : mCallback.keySet()) {
        try {//w w w .  j a  v a 2s . com
            callback.update();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
    if (updateWidget)
        updateWidget(this);
}

From source file:org.musicmod.android.app.MusicPlaybackActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {

    int repcnt = event.getRepeatCount();

    switch (keyCode) {

    case KeyEvent.KEYCODE_DPAD_LEFT:
        if (!useDpadMusicControl()) {
            break;
        }/*from www.j av  a 2 s.  co  m*/
        if (!mPrevButton.hasFocus()) {
            mPrevButton.requestFocus();
        }
        scanBackward(repcnt, event.getEventTime() - event.getDownTime());
        return true;
    case KeyEvent.KEYCODE_DPAD_RIGHT:
        if (!useDpadMusicControl()) {
            break;
        }
        if (!mNextButton.hasFocus()) {
            mNextButton.requestFocus();
        }
        scanForward(repcnt, event.getEventTime() - event.getDownTime());
        return true;

    //         case KeyEvent.KEYCODE_R:
    //            toggleRepeat();
    //            return true;
    //
    //         case KeyEvent.KEYCODE_S:
    //            toggleShuffle();
    //            return true;

    case KeyEvent.KEYCODE_N:
        if (mService != null) {
            try {
                mService.next();
                return true;
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        } else {
            return false;
        }

    case KeyEvent.KEYCODE_P:
        if (mService != null) {
            try {
                mService.prev();
                return true;
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        } else {
            return false;
        }

    case KeyEvent.KEYCODE_DPAD_CENTER:
    case KeyEvent.KEYCODE_SPACE:
        doPauseResume();
        return true;
    }
    return super.onKeyDown(keyCode, event);
}

From source file:cm.aptoide.pt.ApkInfo.java

@Override
protected void onDestroy() {
    super.onDestroy();

    if (download != null && !download.isNull()) {
        try {/*from ww  w .  jav a 2 s  . co m*/
            serviceDownloadManager.callUnregisterDownloadObserver(viewApk.hashCode());
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
    unbindService(serviceManagerConnection);
    handler = null;
    mAdView.destroy();
}

From source file:cm.aptoide.pt.ApkInfo.java

/**
 *
 *///from  www  .j  av a 2  s .c o m
private void checkDownloadStatus() {
    try {
        download = serviceDownloadManager.callGetAppDownloading(viewApk.hashCode());

    } catch (RemoteException e1) {
        e1.printStackTrace();
    }

    Log.d("Aptoide-ApkInfo", "getAppDownloading: " + download);

    if (download.getDownloadStatus().equals(EnumDownloadStatus.DOWNLOADING)) {
        ImageView manage = (ImageView) findViewById(R.id.icon_manage);
        //            manage.setVisibility(View.GONE);
        manage.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                setupQuickActions(view);
            }
        });
        try {
            serviceDownloadManager.callRegisterDownloadObserver(viewApk.hashCode(),
                    serviceDownloadManagerCallback);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        findViewById(R.id.download_progress).setVisibility(View.VISIBLE);
        //            findViewById(R.id.icon_manage).setVisibility(View.VISIBLE);
        findViewById(R.id.downloading_name).setVisibility(View.INVISIBLE);
        ((ProgressBar) findViewById(R.id.downloading_progress)).setProgress(download.getProgress());
        ((TextView) findViewById(R.id.speed)).setText(download.getSpeedInKBpsString(this));
        ((TextView) findViewById(R.id.speed)).setTextColor(Color.WHITE);
        ((TextView) findViewById(R.id.progress)).setText(download.getProgressString());
        ((TextView) findViewById(R.id.progress)).setTextColor(Color.WHITE);

    }
}

From source file:cm.aptoide.pt.ApkInfo.java

private void download(ViewCache cache, ViewObb obb) {
    if (category.equals(Category.ITEMBASED) || category.equals(Category.TOP)
            || category.equals(Category.TOPFEATURED) || category.equals(Category.EDITORSCHOICE)) {

        download = new ViewDownloadManagement(viewApk.getPath(), viewApk, cache, obb);

    } else {// w  w  w . j av  a2 s. c o m

        download = new ViewDownloadManagement(viewApk.getPath(), viewApk, cache,
                db.getServer(viewApk.getRepo_id(), false).getLogin(), obb);

    }

    runOnUiThread(new Runnable() {

        @Override
        public void run() {
            ImageView manage = (ImageView) findViewById(R.id.icon_manage);
            ////                                    manage.setVisibility(View.GONE);
            manage.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View view) {
                    setupQuickActions(view);
                }
            });
            findViewById(R.id.download_progress).setVisibility(View.VISIBLE);
            //                                    findViewById(R.id.icon_manage).setVisibility(View.VISIBLE);
            findViewById(R.id.downloading_name).setVisibility(View.INVISIBLE);
        }
    });

    try {

        serviceDownloadManager.callStartDownloadAndObserve(download, serviceDownloadManagerCallback);

        //                                if(mainObbUrl!=null){
        //                                    ViewApk apk = new ViewApk(viewApk.getId(), viewApk.getApkid(), viewApk.getName() + " - MainOBB", 0, "", "0", "0", "", "", viewApk.getRepo_id());
        //                                    ViewDownloadManagement download = new ViewDownloadManagement(mainObbUrl, apk, mainObbCache, true, true);
        //                                    serviceDownloadManager.callStartDownload(download);
        //                                }
        //                                serviceDownloadManager.callStartDownload();
        //                                serviceDownloadManager.callStartDownload();
    } catch (RemoteException e) {
        e.printStackTrace();
    }

    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            findViewById(R.id.btinstall).setOnClickListener(installListener);
        }
    });
}

From source file:cm.aptoide.pt.ApkInfo.java

/**
 *
 *///  w w  w . j a va 2 s.  co  m
private void loadApkVersions() {
    if (category.equals(Category.INFOXML)) {
        spinner = (Spinner) findViewById(R.id.spinnerMultiVersion);
        adapter = new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, null,
                new String[] { "vername", "repo_id" }, new int[] { android.R.id.text1 },
                CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
        adapter.setViewBinder(new ViewBinder() {

            @Override
            public boolean setViewValue(View textView, Cursor cursor, int position) {
                ((android.widget.TextView) textView)
                        .setText(getString(R.string.version) + " " + cursor.getString(position) + " - "
                                + RepoUtils.split(db.getServer(cursor.getLong(3), false).url));
                return true;
            }
        });
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);
        spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

            @Override
            public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
                if (spinnerInstanciated) {
                    if (!download.isNull()) {
                        try {
                            serviceDownloadManager.callUnregisterDownloadObserver(viewApk.hashCode());
                        } catch (RemoteException e) {
                            e.printStackTrace();
                        }
                    }
                    loadElements(arg3);
                } else {
                    spinnerInstanciated = true;
                }
            }

            @Override
            public void onNothingSelected(AdapterView<?> arg0) {

            }
        });

        getSupportLoaderManager().initLoader(0, null, ApkInfo.this);

    }
}

From source file:cm.aptoide.pt.ApkInfo.java

private void setupQuickActions(View view) {
    actionBar = new QuickAction(context);
    ActionItem playItem = new ActionItem(EnumQuickActions.PLAY.ordinal(), "Resume",
            context.getResources().getDrawable(R.drawable.ic_media_play));
    ActionItem pauseItem = new ActionItem(EnumQuickActions.PAUSE.ordinal(), "Pause",
            context.getResources().getDrawable(R.drawable.ic_media_pause));
    ActionItem stopItem = new ActionItem(EnumQuickActions.STOP.ordinal(), "Stop",
            context.getResources().getDrawable(R.drawable.ic_media_stop));

    switch (download.getDownloadStatus()) {
    case SETTING_UP:
    case RESTARTING:
    case RESUMING:
        break;//w  w w  . j  av a  2s  .  co m

    case DOWNLOADING:
        actionBar.addActionItem(pauseItem);
        break;

    default:
        actionBar.addActionItem(playItem);
        break;
    }
    actionBar.addActionItem(stopItem);
    actionBar.show(view);

    actionBar.setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() {
        @Override
        public void onItemClick(QuickAction quickAction, int pos, final int actionId) {
            new Thread(new Runnable() {
                public void run() {
                    try {
                        switch (EnumQuickActions.reverseOrdinal(actionId)) {
                        case PLAY:
                            serviceDownloadManager.callResumeDownload(download.hashCode());
                            break;

                        case PAUSE:
                            serviceDownloadManager.callPauseDownload(download.hashCode());
                            break;

                        case STOP:
                            serviceDownloadManager.callStopDownload(download.hashCode());
                            break;

                        default:
                            break;
                        }
                    } catch (RemoteException e) {
                        e.printStackTrace();
                    }
                }
            }).start();

        }
    });
}

From source file:androidx.media.MediaController2.java

private void connectToSession(MediaSessionCompat.Token sessionCompatToken) {
    MediaControllerCompat controllerCompat = null;
    try {/*  w ww  .j a va2 s. c  om*/
        controllerCompat = new MediaControllerCompat(mContext, sessionCompatToken);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    synchronized (mLock) {
        mControllerCompat = controllerCompat;
        mControllerCompatCallback = new ControllerCompatCallback();
        mControllerCompat.registerCallback(mControllerCompatCallback, mHandler);
    }

    if (controllerCompat.isSessionReady()) {
        sendCommand(CONTROLLER_COMMAND_CONNECT, new ResultReceiver(mHandler) {
            @Override
            protected void onReceiveResult(int resultCode, Bundle resultData) {
                if (!mHandlerThread.isAlive()) {
                    return;
                }
                switch (resultCode) {
                case CONNECT_RESULT_CONNECTED:
                    onConnectedNotLocked(resultData);
                    break;
                case CONNECT_RESULT_DISCONNECTED:
                    mCallback.onDisconnected(MediaController2.this);
                    close();
                    break;
                }
            }
        });
    }
}

From source file:com.owncloud.android.datamodel.FileDataStorageManager.java

public void removeShare(OCShare share) {
    Uri share_uri = ProviderTableMeta.CONTENT_URI_SHARE;
    String where = ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?" + " AND " + ProviderTableMeta._ID + "=?";
    String[] whereArgs = new String[] { mAccount.name, Long.toString(share.getId()) };
    if (getContentProviderClient() != null) {
        try {//w  ww .j  a  va 2s .  co m
            getContentProviderClient().delete(share_uri, where, whereArgs);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    } else {
        getContentResolver().delete(share_uri, where, whereArgs);
    }
}

From source file:com.owncloud.android.datamodel.FileDataStorageManager.java

private boolean removeFolderInDb(OCFile folder) {
    Uri folder_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_DIR, "" + folder.getFileId()); // URI for recursive deletion
    String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?" + " AND " + ProviderTableMeta.FILE_PATH + "=?";
    String[] whereArgs = new String[] { mAccount.name, folder.getRemotePath() };
    int deleted = 0;
    if (getContentProviderClient() != null) {
        try {// ww  w .  j  a v a2 s  .  c o m
            deleted = getContentProviderClient().delete(folder_uri, where, whereArgs);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    } else {
        deleted = getContentResolver().delete(folder_uri, where, whereArgs);
    }
    return deleted > 0;
}