Search in sources :

Example 41 with Point

use of android.graphics.Point in project Conversations by siacs.

the class XmppActivity method showQrCode.

protected void showQrCode() {
    String uri = getShareableUri();
    if (uri != null) {
        Point size = new Point();
        getWindowManager().getDefaultDisplay().getSize(size);
        final int width = (size.x < size.y ? size.x : size.y);
        Bitmap bitmap = BarcodeProvider.create2dBarcodeBitmap(uri, width);
        ImageView view = new ImageView(this);
        view.setBackgroundColor(Color.WHITE);
        view.setImageBitmap(bitmap);
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setView(view);
        builder.create().show();
    }
}
Also used : AlertDialog(android.app.AlertDialog) Bitmap(android.graphics.Bitmap) Builder(android.app.AlertDialog.Builder) Builder(android.app.AlertDialog.Builder) Point(android.graphics.Point) ImageView(android.widget.ImageView) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 42 with Point

use of android.graphics.Point in project Reachability by sakebook.

the class Reachability method getHalfWindow.

private float getHalfWindow() {
    WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    return (size.y / 5) * 2;
}
Also used : Point(android.graphics.Point) WindowManager(android.view.WindowManager) Display(android.view.Display)

Example 43 with Point

use of android.graphics.Point in project platform_frameworks_base by android.

the class MainActivity method updateDimens.

public void updateDimens() {
    Point minDims = new Point();
    Point maxDims = new Point();
    mWindowManager.getDefaultDisplay().getCurrentSizeRange(minDims, maxDims);
    mWallpaperManager.suggestDesiredDimensions(loadPropIntText(mDimenWidthView, maxDims.x), loadPropIntText(mDimenHeightView, maxDims.y));
}
Also used : Point(android.graphics.Point)

Example 44 with Point

use of android.graphics.Point in project platform_frameworks_base by android.

the class LaunchingTaskPositioner method setDisplay.

void setDisplay(Display display) {
    Point size = new Point();
    display.getSize(size);
    mDisplayWidth = size.x;
    mDisplayHeight = size.y;
}
Also used : Point(android.graphics.Point)

Example 45 with Point

use of android.graphics.Point in project platform_frameworks_base by android.

the class ActivityManagerService method addErrorToDropBox.

/**
     * Write a description of an error (crash, WTF, ANR) to the drop box.
     * @param eventType to include in the drop box tag ("crash", "wtf", etc.)
     * @param process which caused the error, null means the system server
     * @param activity which triggered the error, null if unknown
     * @param parent activity related to the error, null if unknown
     * @param subject line related to the error, null if absent
     * @param report in long form describing the error, null if absent
     * @param dataFile text file to include in the report, null if none
     * @param crashInfo giving an application stack trace, null if absent
     */
public void addErrorToDropBox(String eventType, ProcessRecord process, String processName, ActivityRecord activity, ActivityRecord parent, String subject, final String report, final File dataFile, final ApplicationErrorReport.CrashInfo crashInfo) {
    // NOTE -- this must never acquire the ActivityManagerService lock,
    // otherwise the watchdog may be prevented from resetting the system.
    final String dropboxTag = processClass(process) + "_" + eventType;
    final DropBoxManager dbox = (DropBoxManager) mContext.getSystemService(Context.DROPBOX_SERVICE);
    // Exit early if the dropbox isn't configured to accept this report type.
    if (dbox == null || !dbox.isTagEnabled(dropboxTag))
        return;
    // Rate-limit how often we're willing to do the heavy lifting below to
    // collect and record logs; currently 5 logs per 10 second period.
    final long now = SystemClock.elapsedRealtime();
    if (now - mWtfClusterStart > 10 * DateUtils.SECOND_IN_MILLIS) {
        mWtfClusterStart = now;
        mWtfClusterCount = 1;
    } else {
        if (mWtfClusterCount++ >= 5)
            return;
    }
    final StringBuilder sb = new StringBuilder(1024);
    appendDropBoxProcessHeaders(process, processName, sb);
    if (process != null) {
        sb.append("Foreground: ").append(process.isInterestingToUserLocked() ? "Yes" : "No").append("\n");
    }
    if (activity != null) {
        sb.append("Activity: ").append(activity.shortComponentName).append("\n");
    }
    if (parent != null && parent.app != null && parent.app.pid != process.pid) {
        sb.append("Parent-Process: ").append(parent.app.processName).append("\n");
    }
    if (parent != null && parent != activity) {
        sb.append("Parent-Activity: ").append(parent.shortComponentName).append("\n");
    }
    if (subject != null) {
        sb.append("Subject: ").append(subject).append("\n");
    }
    sb.append("Build: ").append(Build.FINGERPRINT).append("\n");
    if (Debug.isDebuggerConnected()) {
        sb.append("Debugger: Connected\n");
    }
    sb.append("\n");
    // Do the rest in a worker thread to avoid blocking the caller on I/O
    // (After this point, we shouldn't access AMS internal data structures.)
    Thread worker = new Thread("Error dump: " + dropboxTag) {

        @Override
        public void run() {
            if (report != null) {
                sb.append(report);
            }
            String setting = Settings.Global.ERROR_LOGCAT_PREFIX + dropboxTag;
            int lines = Settings.Global.getInt(mContext.getContentResolver(), setting, 0);
            int maxDataFileSize = DROPBOX_MAX_SIZE - sb.length() - lines * RESERVED_BYTES_PER_LOGCAT_LINE;
            if (dataFile != null && maxDataFileSize > 0) {
                try {
                    sb.append(FileUtils.readTextFile(dataFile, maxDataFileSize, "\n\n[[TRUNCATED]]"));
                } catch (IOException e) {
                    Slog.e(TAG, "Error reading " + dataFile, e);
                }
            }
            if (crashInfo != null && crashInfo.stackTrace != null) {
                sb.append(crashInfo.stackTrace);
            }
            if (lines > 0) {
                sb.append("\n");
                // Merge several logcat streams, and take the last N lines
                InputStreamReader input = null;
                try {
                    java.lang.Process logcat = new ProcessBuilder("/system/bin/timeout", "-k", "15s", "10s", "/system/bin/logcat", "-v", "threadtime", "-b", "events", "-b", "system", "-b", "main", "-b", "crash", "-t", String.valueOf(lines)).redirectErrorStream(true).start();
                    try {
                        logcat.getOutputStream().close();
                    } catch (IOException e) {
                    }
                    try {
                        logcat.getErrorStream().close();
                    } catch (IOException e) {
                    }
                    input = new InputStreamReader(logcat.getInputStream());
                    int num;
                    char[] buf = new char[8192];
                    while ((num = input.read(buf)) > 0) sb.append(buf, 0, num);
                } catch (IOException e) {
                    Slog.e(TAG, "Error running logcat", e);
                } finally {
                    if (input != null)
                        try {
                            input.close();
                        } catch (IOException e) {
                        }
                }
            }
            dbox.addText(dropboxTag, sb.toString());
        }
    };
    if (process == null) {
        // If process is null, we are being called from some internal code
        // and may be about to die -- run this synchronously.
        worker.run();
    } else {
        worker.start();
    }
}
Also used : DropBoxManager(android.os.DropBoxManager) InputStreamReader(java.io.InputStreamReader) IOException(java.io.IOException) Point(android.graphics.Point) IApplicationThread(android.app.IApplicationThread) BackgroundThread(com.android.internal.os.BackgroundThread) ServiceThread(com.android.server.ServiceThread) ActivityThread(android.app.ActivityThread)

Aggregations

Point (android.graphics.Point)1151 Display (android.view.Display)217 Rect (android.graphics.Rect)194 Paint (android.graphics.Paint)170 WindowManager (android.view.WindowManager)138 RemoteException (android.os.RemoteException)76 RectF (android.graphics.RectF)62 Bitmap (android.graphics.Bitmap)54 Resources (android.content.res.Resources)41 View (android.view.View)41 ArrayList (java.util.ArrayList)40 ImageView (android.widget.ImageView)37 Camera (android.hardware.Camera)36 Canvas (android.graphics.Canvas)31 Matrix (android.graphics.Matrix)29 Animator (android.animation.Animator)27 SuppressLint (android.annotation.SuppressLint)27 Configuration (android.content.res.Configuration)26 IOException (java.io.IOException)24 Message (android.os.Message)22