public static java.lang.Exception ToJavaException(this Exception exception) { java.lang.Exception je; if (exception is IOException) { je = new java.io.IOException(); } else if (exception is EndOfStreamException) { je = new java.io.EOFException(); } else if (exception is ArgumentException) { je = new java.lang.IllegalArgumentException(); } else if (exception is UnauthorizedAccessException) { je = new java.lang.IllegalThreadStateException(); } else if (exception is FormatException) { je = new java.lang.NumberFormatException(); } else if (exception is NullReferenceException) { je = new java.lang.NullPointerException(); } else if (exception is ArithmeticException) { je = new java.lang.ArithmeticException(); } else if (exception is IndexOutOfRangeException) { je = new java.lang.ArrayIndexOutOfBoundsException(); } else if (exception is InvalidCastException) { je = new java.lang.ClassCastException(); } else { je = new java.lang.RuntimeException(); } java.lang.String message = new java.lang.String(); message.@this(new org.xmlvm._nArrayAdapter<char>(exception.ToString().ToCharArray())); je.@this(message); // TODO strack trace // TODO cause return je; }
private void getSizeInternal(android.graphics.Point outSize, bool doCompat) { try { android.view.IWindowManager wm = getWindowManager(); if (wm != null) { wm.getDisplaySize(outSize); android.content.res.CompatibilityInfo ci; if (doCompat && (ci = mCompatibilityInfo.getIfNeeded()) != null) { lock (mTmpMetrics) { mTmpMetrics.noncompatWidthPixels = outSize.x; mTmpMetrics.noncompatHeightPixels = outSize.y; mTmpMetrics.density = mDensity; ci.applyToDisplayMetrics(mTmpMetrics); outSize.x = mTmpMetrics.widthPixels; outSize.y = mTmpMetrics.heightPixels; } } } else { // This is just for boot-strapping, initializing the // system process before the window manager is up. outSize.x = getRawWidth(); outSize.y = getRawHeight(); } if (false) { java.lang.RuntimeException here = new java.lang.RuntimeException("here"); XobotOS.Runtime.Util.FillInStackTrace(here); android.util.Slog.v(TAG, "Returning display size: " + outSize, here); } if (DEBUG_DISPLAY_SIZE && doCompat) { android.util.Slog.v(TAG, "Returning display size: " + outSize); } } catch (android.os.RemoteException e) { android.util.Slog.w("Display", "Unable to get display size", e); } }
internal void setUnbindLocation(java.lang.RuntimeException ex) { mUnbindLocation = ex; }
public static void SetStackTrace(java.lang.RuntimeException e, object o) { throw new NotImplementedException(); }
internal static void FillInStackTrace(java.lang.RuntimeException e) { ; // Do nothing }
/// <summary>Core implementation of stopping an activity.</summary> /// <remarks> /// Core implementation of stopping an activity. Note this is a little /// tricky because the server's meaning of stop is slightly different /// than our client -- for the server, stop means to save state and give /// it the result when it is done, but the window may still be visible. /// For the client, we want to call onStop()/onStart() to indicate when /// the activity's UI visibillity changes. /// </remarks> private void performStopActivityInner(android.app.ActivityThread.ActivityClientRecord r, android.app.ActivityThread.StopInfo info, bool keepShown, bool saveState) { android.os.Bundle state = null; if (r != null) { if (!keepShown && r.stopped) { if (r.activity.mFinished) { // If we are finishing, we won't call onResume() in certain // cases. So here we likewise don't want to call onStop() // if the activity isn't resumed. return; } java.lang.RuntimeException e = new java.lang.RuntimeException("Performing stop of activity that is not resumed: " + r.intent.getComponent().toShortString()); android.util.Slog.e(TAG, e.Message, e); } if (info != null) { try { // First create a thumbnail for the activity... info.thumbnail = createThumbnailBitmap(r); info.description = r.activity.onCreateDescription(); } catch (System.Exception e) { if (!mInstrumentation.onException(r.activity, e)) { throw new java.lang.RuntimeException("Unable to save state of activity " + r.intent .getComponent().toShortString() + ": " + e.ToString(), e); } } } // Next have the activity save its current state and managed dialogs... if (!r.activity.mFinished && saveState) { if (r.state == null) { state = new android.os.Bundle(); state.setAllowFds(false); mInstrumentation.callActivityOnSaveInstanceState(r.activity, state); r.state = state; } else { state = r.state; } } if (!keepShown) { try { // Now we are idle. r.activity.performStop(); } catch (System.Exception e) { if (!mInstrumentation.onException(r.activity, e)) { throw new java.lang.RuntimeException("Unable to stop activity " + r.intent.getComponent ().toShortString() + ": " + e.ToString(), e); } } r.stopped = true; } r.paused = true; } }
internal android.os.Bundle performPauseActivity(android.app.ActivityThread.ActivityClientRecord r, bool finished, bool saveState) { if (r.paused) { if (r.activity.mFinished) { // If we are finishing, we won't call onResume() in certain cases. // So here we likewise don't want to call onPause() if the activity // isn't resumed. return null; } java.lang.RuntimeException e = new java.lang.RuntimeException("Performing pause of activity that is not resumed: " + r.intent.getComponent().toShortString()); android.util.Slog.e(TAG, e.Message, e); } android.os.Bundle state = null; if (finished) { r.activity.mFinished = true; } try { // Next have the activity save its current state and managed dialogs... if (!r.activity.mFinished && saveState) { state = new android.os.Bundle(); state.setAllowFds(false); mInstrumentation.callActivityOnSaveInstanceState(r.activity, state); r.state = state; } // Now we are idle. r.activity.mCalled = false; mInstrumentation.callActivityOnPause(r.activity); android.util.EventLog.writeEvent(LOG_ON_PAUSE_CALLED, r.activity.getComponentName ().getClassName()); if (!r.activity.mCalled) { throw new android.app.SuperNotCalledException("Activity " + r.intent.getComponent ().toShortString() + " did not call through to super.onPause()"); } } catch (android.app.SuperNotCalledException e) { throw; } catch (System.Exception e) { if (!mInstrumentation.onException(r.activity, e)) { throw new java.lang.RuntimeException("Unable to pause activity " + r.intent.getComponent ().toShortString() + ": " + e.ToString(), e); } } r.paused = true; // Notify any outstanding on paused listeners java.util.ArrayList<android.app.OnActivityPausedListener> listeners; lock (mOnPauseListeners) { listeners = mOnPauseListeners.remove(r.activity); } int size = (listeners != null ? listeners.size() : 0); { for (int i = 0; i < size; i++) { listeners.get(i).onPaused(r.activity); } } return state; }
public override android.graphics.drawable.Drawable getDrawable(string packageName , int resid, android.content.pm.ApplicationInfo appInfo) { android.app.ApplicationPackageManager.ResourceName name = new android.app.ApplicationPackageManager .ResourceName(packageName, resid); android.graphics.drawable.Drawable dr = getCachedIcon(name); if (dr != null) { return dr; } if (appInfo == null) { try { appInfo = getApplicationInfo(packageName, 0); } catch (android.content.pm.PackageManager.NameNotFoundException) { return null; } } try { android.content.res.Resources r = getResourcesForApplication(appInfo); dr = r.getDrawable(resid); if (false) { java.lang.RuntimeException e = new java.lang.RuntimeException("here"); XobotOS.Runtime.Util.FillInStackTrace(e); android.util.Log.w(TAG, "Getting drawable 0x" + Sharpen.Util.IntToHexString(resid ) + " from package " + packageName + ": app scale=" + r.getCompatibilityInfo().applicationScale + ", caller scale=" + mContext.getResources().getCompatibilityInfo().applicationScale , e); } putCachedIcon(name, dr); return dr; } catch (android.content.pm.PackageManager.NameNotFoundException) { android.util.Log.w("PackageManager", "Failure retrieving resources for" + appInfo .packageName); } catch (android.content.res.Resources.NotFoundException e) { android.util.Log.w("PackageManager", "Failure retrieving resources for" + appInfo .packageName + ": " + e.Message); } catch (java.lang.RuntimeException e) { // If an exception was thrown, fall through to return // default icon. android.util.Log.w("PackageManager", "Failure retrieving icon 0x" + Sharpen.Util.IntToHexString (resid) + " in package " + packageName, e); } return null; }
internal void setUnregisterLocation(java.lang.RuntimeException ex) { throw new System.NotImplementedException(); }