List of usage examples for android.os Build DISPLAY
String DISPLAY
To view the source code for android.os Build DISPLAY.
Click Source Link
From source file:com.imagine.BaseActivity.java
static boolean gbAnimatesRotation() { // Check if Gingerbread OS provides rotation animation return android.os.Build.DISPLAY.contains("cyano"); // Disable our rotation animation on CM7 }
From source file:name.setup.dance.DanceStepApp.java
/** Called when the activity is first created. */ @Override/* w w w .j ava2 s. c om*/ public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "[ACTIVITY] onCreate"); super.onCreate(savedInstanceState); //mStepValue = 0; mPaceValue = 0; setContentView(R.layout.main); mUtils = Utils.getInstance(); String m_szDevIDShort = "35" + //we make this look like a valid IMEI Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10 + Build.USER.length() % 10; //13 digits mUtils.DeviceName = m_szDevIDShort; Log.v(TAG, "ID: " + m_szDevIDShort); Log.v(TAG, "UTILS: " + mUtils.DeviceName); // user name mTextField = (EditText) findViewById(R.id.name_area); mTextField.setCursorVisible(false); if (!(mUtils.UserName == "My Name")) { mTextField.setText(mUtils.UserName); } mTextField.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); // only will trigger it if no physical keyboard is open mgr.showSoftInput(mTextField, InputMethodManager.SHOW_IMPLICIT); mTextField.requestFocus(); mTextField.setCursorVisible(true); mOkayButton.setVisibility(View.VISIBLE); } }); // init okay Button mOkayButton = (Button) findViewById(R.id.okay_button); mOkayButton.setVisibility(View.INVISIBLE); mOkayButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mgr.hideSoftInputFromWindow(getWindow().getCurrentFocus().getWindowToken(), 0); mTextField.setCursorVisible(false); mTextField.clearFocus(); mUtils.UserName = mTextField.getText().toString(); // post name via HHTP new Thread(new Runnable() { public void run() { if (mIsMetric) { postHTTP(mUtils.DeviceName, mUtils.UserName, mStepValue, mDistanceValue); } else { postHTTP(mUtils.DeviceName, mUtils.UserName, mStepValue, mDistanceValue * 1.609344f); } } }).start(); mOkayButton.setVisibility(View.INVISIBLE); // Post TOAST MESSAGE Toast.makeText(getApplicationContext(), getText(R.string.name_saved), Toast.LENGTH_SHORT).show(); } }); // init Score Button mScoreButton = (Button) findViewById(R.id.scoreButton); mScoreButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click String url = "http://www.setup.nl/tools/dancestep_app/index.php?id=" + mUtils.DeviceName + "&time=" + System.currentTimeMillis(); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } }); }
From source file:io.kristal.appinfos.AppInfosPlugin.java
private synchronized static String getUniqueId(Context context) { String uniqueID = null;/* w w w . j ava 2s. c om*/ SharedPreferences sharedPrefs = context.getSharedPreferences(PREF_UNIQUE_ID, Context.MODE_PRIVATE); uniqueID = sharedPrefs.getString(PREF_UNIQUE_ID, null); if (uniqueID == null) { uniqueID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); if (uniqueID == null || uniqueID.length() == 0 || "9774d56d682e549c".equals(uniqueID)) { // old version of reto meier //uniqueID = UUID.randomUUID().toString(); uniqueID = "35" + //we make this look like a valid IMEI Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10 + Build.USER.length() % 10; //13 digits } SharedPreferences.Editor editor = sharedPrefs.edit(); editor.putString(PREF_UNIQUE_ID, uniqueID); editor.commit(); } return uniqueID; }
From source file:org.OneEducation.HarvestClient.HarvestReporter.java
private List<String> getBuildInfo() { List info = new ArrayList<String>(); // send this in the first report only if (settings.getLastReported() == 0) { info.add(Build.MODEL);/*from w w w . ja va2 s . co m*/ info.add(Build.DISPLAY); info.add(Integer.toString(Build.VERSION.SDK_INT)); info.add(System.getProperty("os.version")); } return info; }
From source file:de.schildbach.wallet.util.CrashReporter.java
public static void appendDeviceInfo(final Appendable report, final Context context) throws IOException { final Resources res = context.getResources(); final android.content.res.Configuration config = res.getConfiguration(); final ActivityManager activityManager = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); final DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context .getSystemService(Context.DEVICE_POLICY_SERVICE); report.append("Device Model: " + Build.MODEL + "\n"); report.append("Android Version: " + Build.VERSION.RELEASE + "\n"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) report.append("Android security patch level: ").append(Build.VERSION.SECURITY_PATCH).append("\n"); report.append("ABIs: ").append(Joiner.on(", ").skipNulls().join(Strings.emptyToNull(Build.CPU_ABI), Strings.emptyToNull(Build.CPU_ABI2))).append("\n"); report.append("Board: " + Build.BOARD + "\n"); report.append("Brand: " + Build.BRAND + "\n"); report.append("Device: " + Build.DEVICE + "\n"); report.append("Display: " + Build.DISPLAY + "\n"); report.append("Finger Print: " + Build.FINGERPRINT + "\n"); report.append("Host: " + Build.HOST + "\n"); report.append("ID: " + Build.ID + "\n"); report.append("Product: " + Build.PRODUCT + "\n"); report.append("Tags: " + Build.TAGS + "\n"); report.append("Time: " + Build.TIME + "\n"); report.append("Type: " + Build.TYPE + "\n"); report.append("User: " + Build.USER + "\n"); report.append("Configuration: " + config + "\n"); report.append("Screen Layout: size " + (config.screenLayout & android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK) + " long " + (config.screenLayout & android.content.res.Configuration.SCREENLAYOUT_LONG_MASK) + "\n"); report.append("Display Metrics: " + res.getDisplayMetrics() + "\n"); report.append("Memory Class: " + activityManager.getMemoryClass() + "/" + activityManager.getLargeMemoryClass() + (ActivityManagerCompat.isLowRamDevice(activityManager) ? " (low RAM device)" : "") + "\n"); report.append("Storage Encryption Status: " + devicePolicyManager.getStorageEncryptionStatus() + "\n"); report.append("Bluetooth MAC: " + bluetoothMac() + "\n"); report.append("Runtime: ").append(System.getProperty("java.vm.name")).append(" ") .append(System.getProperty("java.vm.version")).append("\n"); }
From source file:com.error.hunter.ListenService.java
private void generateBugReport(ActivityManager.ProcessErrorStateInfo entry) { String condition;//from w ww . j a v a 2 s .c om badProcess = entry.processName; String build = Build.DISPLAY; String fingerprint = Build.FINGERPRINT; String serial = Build.SERIAL; String product = Build.PRODUCT; String model = Build.MODEL; File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); @SuppressWarnings("deprecation") long blockSize = stat.getBlockSize(); @SuppressWarnings("deprecation") long availableBlocks = stat.getAvailableBlocks(); String memory = Formatter.formatFileSize(this, availableBlocks * blockSize).toString(); MemoryInfo mi = new MemoryInfo(); ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); long availableMegs = mi.availMem / 1048576L; strBuf.append("Problem detected in: ").append(badProcess); if (entry.tag != null) { strBuf.append(" (").append(entry.tag).append(")"); } strBuf.append("\nDevice product: " + product); strBuf.append("\nDevice model: " + model); strBuf.append("\nDevice build: " + build); strBuf.append("\nDevice fingerprint: " + fingerprint); strBuf.append("\nDevice SN: " + serial); strBuf.append("\nDevice available RAM (MB): " + availableMegs); strBuf.append("\nDevice free phisical memory: " + memory + "\n"); strBuf.append(getNetworkInfo()); strBuf.append("\n"); ActivityManager actvityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE); List<ActivityManager.RunningServiceInfo> procInfos = actvityManager.getRunningServices(1000); Iterator<RunningServiceInfo> taskIter = procInfos.iterator(); RunningServiceInfo info; while (taskIter.hasNext()) { info = taskIter.next(); if (info.process.equals(badProcess)) { strBuf.append("\nService " + info.service + " crash count: " + info.crashCount + " active since: " + info.activeSince + " process: " + info.process); } } strBuf.append("\n"); //android.os.Debug.MemoryInfo[] miPid = activityManager.getProcessMemoryInfo(new int[]{entry.pid}); //String memoryProc = miPid[0].toString(); //strBuf.append("\nRAM used by process (Process: " + entry.processName + " PID: " + entry.pid +"): " + memoryProc + "MB\n"); switch (entry.condition) { case ActivityManager.ProcessErrorStateInfo.CRASHED: condition = "CRASHED"; getDeviceProcessInfo(badProcess, entry.stackTrace); writeLogsToFile(condition, badProcess); break; case ActivityManager.ProcessErrorStateInfo.NOT_RESPONDING: condition = "ANR"; getDeviceProcessInfo(badProcess, ""); writeLogsToFile(condition, badProcess); break; default: condition = "<unknown>"; getDeviceProcessInfo(badProcess, entry.stackTrace); writeLogsToFile(condition, badProcess); break; } }
From source file:de.akquinet.android.androlog.reporter.Report.java
/** * Adds the device data to the report./*from ww w.j av a2s.c o m*/ * @param context * @throws JSONException if the device data cannot be added */ private void buildDeviceData(Context context) throws JSONException { device = new JSONObject(); device.put("device", Build.DEVICE); device.put("brand", Build.BRAND); Object windowService = context.getSystemService(Context.WINDOW_SERVICE); if (windowService instanceof WindowManager) { Display display = ((WindowManager) windowService).getDefaultDisplay(); device.put("resolution", display.getWidth() + "x" + display.getHeight()); device.put("orientation", display.getOrientation()); } device.put("display", Build.DISPLAY); device.put("manufacturer", Build.MANUFACTURER); device.put("model", Build.MODEL); device.put("product", Build.PRODUCT); device.put("build.type", Build.TYPE); device.put("android.version", Build.VERSION.SDK_INT); }
From source file:org.cook_e.cook_e.BugReportActivity.java
/** * Gathers information about the device running the application and returns it as a JSONObject * @return information about the system/* w w w . j a v a2s. co m*/ */ private JSONObject getSystemInformation() { final JSONObject json = new JSONObject(); try { final JSONObject build = new JSONObject(); build.put("version_name", BuildConfig.VERSION_NAME); build.put("version_code", BuildConfig.VERSION_CODE); build.put("build_type", BuildConfig.BUILD_TYPE); build.put("debug", BuildConfig.DEBUG); json.put("build", build); final JSONObject device = new JSONObject(); device.put("board", Build.BOARD); device.put("bootloader", Build.BOOTLOADER); device.put("brand", Build.BRAND); device.put("device", Build.DEVICE); device.put("display", Build.DISPLAY); device.put("fingerprint", Build.FINGERPRINT); device.put("hardware", Build.HARDWARE); device.put("host", Build.HOST); device.put("id", Build.ID); device.put("manufacturer", Build.MANUFACTURER); device.put("model", Build.MODEL); device.put("product", Build.PRODUCT); device.put("radio", Build.getRadioVersion()); device.put("serial", Build.SERIAL); device.put("tags", Build.TAGS); device.put("time", Build.TIME); device.put("type", Build.TYPE); device.put("user", Build.USER); json.put("device", device); } catch (JSONException e) { // Ignore } return json; }
From source file:com.stoutner.privacybrowser.AboutTabFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View tabLayout;/*www. j a va2 s .c o m*/ // Load the about tab layout. Tab numbers start at 0. if (tabNumber == 0) { // Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container. // The fragment will take care of attaching the root automatically. tabLayout = inflater.inflate(R.layout.about_tab_version, container, false); // Version. TextView versionNumberText = (TextView) tabLayout.findViewById(R.id.about_version_number_text); String version = getString(R.string.version) + " " + BuildConfig.VERSION_NAME + " (" + getString(R.string.version_code) + " " + Integer.toString(BuildConfig.VERSION_CODE) + ")"; versionNumberText.setText(version); // Brand. TextView versionBrandText = (TextView) tabLayout.findViewById(R.id.about_version_brand_text); versionBrandText.setText(Build.BRAND); // Manufacturer. TextView versionManufacturerText = (TextView) tabLayout .findViewById(R.id.about_version_manufacturer_text); versionManufacturerText.setText(Build.MANUFACTURER); // Model. TextView versionModelText = (TextView) tabLayout.findViewById(R.id.about_version_model_text); versionModelText.setText(Build.MODEL); // Device. TextView versionDeviceText = (TextView) tabLayout.findViewById(R.id.about_version_device_text); versionDeviceText.setText(Build.DEVICE); // Bootloader. TextView versionBootloaderText = (TextView) tabLayout.findViewById(R.id.about_version_bootloader_text); versionBootloaderText.setText(Build.BOOTLOADER); // Radio. TextView versionRadioText = (TextView) tabLayout.findViewById(R.id.about_version_radio_text); // Hide versionRadioTextView if there is no radio. if (Build.getRadioVersion().equals("")) { TextView versionRadioTitle = (TextView) tabLayout.findViewById(R.id.about_version_radio_title); versionRadioTitle.setVisibility(View.GONE); versionRadioText.setVisibility(View.GONE); } else { // Else, set the text. versionRadioText.setText(Build.getRadioVersion()); } // Android. TextView versionAndroidText = (TextView) tabLayout.findViewById(R.id.about_version_android_text); String android = Build.VERSION.RELEASE + " (" + getString(R.string.api) + " " + Integer.toString(Build.VERSION.SDK_INT) + ")"; versionAndroidText.setText(android); // Build. TextView versionBuildText = (TextView) tabLayout.findViewById(R.id.about_version_build_text); versionBuildText.setText(Build.DISPLAY); // Security Patch. TextView versionSecurityPatchText = (TextView) tabLayout .findViewById(R.id.about_version_securitypatch_text); // Build.VERSION.SECURITY_PATCH is only available for SDK_INT >= 23. if (Build.VERSION.SDK_INT >= 23) { versionSecurityPatchText.setText(Build.VERSION.SECURITY_PATCH); } else { // Hide versionSecurityPatchTextView. TextView versionSecurityPatchTitle = (TextView) tabLayout .findViewById(R.id.about_version_securitypatch_title); versionSecurityPatchTitle.setVisibility(View.GONE); versionSecurityPatchText.setVisibility(View.GONE); } // webViewLayout is only used to get the default user agent from about_tab_webview. It is not used to render content on the screen. View webViewLayout = inflater.inflate(R.layout.about_tab_webview, container, false); WebView tabLayoutWebView = (WebView) webViewLayout.findViewById(R.id.about_tab_webview); String userAgentString = tabLayoutWebView.getSettings().getUserAgentString(); // WebKit. TextView versionWebKitText = (TextView) tabLayout.findViewById(R.id.about_version_webkit_text); // Select the substring that begins after "Safari/" and goes to the end of the string. String webkitVersion = userAgentString.substring(userAgentString.indexOf("Safari/") + 7); versionWebKitText.setText(webkitVersion); // Chrome. TextView versionChromeText = (TextView) tabLayout.findViewById(R.id.about_version_chrome_text); // Select the substring that begins after "Chrome/" and goes until the next " ". String chromeVersion = userAgentString.substring(userAgentString.indexOf("Chrome/") + 7, userAgentString.indexOf(" ", userAgentString.indexOf("Chrome/"))); versionChromeText.setText(chromeVersion); } else { // load a WebView for all the other tabs. Tab numbers start at 0. // Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container. // The fragment will take care of attaching the root automatically. tabLayout = inflater.inflate(R.layout.about_tab_webview, container, false); WebView tabWebView = (WebView) tabLayout; switch (tabNumber) { case 1: tabWebView.loadUrl("file:///android_asset/about_permissions.html"); break; case 2: tabWebView.loadUrl("file:///android_asset/about_privacy_policy.html"); break; case 3: tabWebView.loadUrl("file:///android_asset/about_changelog.html"); break; case 4: tabWebView.loadUrl("file:///android_asset/about_license.html"); break; case 5: tabWebView.loadUrl("file:///android_asset/about_contributors.html"); break; case 6: tabWebView.loadUrl("file:///android_asset/about_links.html"); default: break; } } return tabLayout; }
From source file:org.ciasaboark.tacere.activity.fragment.BugReportDialogFragment.java
@Nullable @Override//from ww w .j a v a 2 s.c om public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.activity_bug_report, container, false); final Spinner spinner = (Spinner) rootView.findViewById(R.id.spinner); // Create an ArrayAdapter using the string array and a default spinner layout ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.report_types, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner spinner.setAdapter(adapter); Button closeButton = (Button) rootView.findViewById(R.id.bug_report_button_cancel); closeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { BugReportDialogFragment.this.dismiss(); } }); final Button sendButton = (Button) rootView.findViewById(R.id.bug_report_button_send); sendButton.setEnabled(false); sendButton.setVisibility(View.INVISIBLE); sendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { sendButton.setEnabled(false); final ProgressBar busySpinner = (ProgressBar) rootView.findViewById(R.id.bug_report_progressbar); busySpinner.setVisibility(View.VISIBLE); EditText messageEditText = (EditText) rootView.findViewById(R.id.bug_report_message); final String messageText = messageEditText.getText().toString(); EditText emailEditText = (EditText) rootView.findViewById(R.id.bug_report_email); String emailText = emailEditText.getText().toString(); final String emailString = emailText.length() == 0 ? "no email address given" : emailText; final String spinnerSelection = spinner.getSelectedItem() == null ? "bug" : spinner.getSelectedItem().toString(); new Thread(new Runnable() { @Override public void run() { boolean reportSent = false; GitHubClient client = new GitHubClient(); client.setOAuth2Token(GitHubKeySet.GITHUB_OAUTH); RepositoryService repositoryService = new RepositoryService(client); try { Repository repository = repositoryService.getRepository("ciasaboark", "Tacere"); IssueService issueService = new IssueService(); issueService.getClient().setOAuth2Token(GitHubKeySet.GITHUB_OAUTH); Issue issue = new Issue(); issue.setTitle("Tacere issue submit"); String bodyText = ""; bodyText += messageText; bodyText += "\n\nEmail : " + emailString; bodyText += "\nAndroid Version: " + Build.VERSION.RELEASE; bodyText += "\nTacere version: " + Versioning.getVersionCode(); bodyText += "\nDevice: " + Build.MANUFACTURER + " - " + Build.MODEL; bodyText += "\nRom: " + Build.DISPLAY; issue.setBody(bodyText); Label label = new Label(); label.setName("autosubmit"); List<Label> labels = new ArrayList<Label>(); labels.add(label); String reportTypeLabel; switch (spinnerSelection.toLowerCase()) { case "bug": reportTypeLabel = "bug"; break; case "wishlist": reportTypeLabel = "wishlist"; break; default: Log.w(TAG, "unknown reportType " + spinnerSelection + ", assuming to " + "be a bug report"); reportTypeLabel = "bug"; } Label reportLabel = new Label(); reportLabel.setName(reportTypeLabel); labels.add(reportLabel); issue.setLabels(labels); UserService userService = new UserService(client); User user = userService.getUser("ciasaboark"); issue.setAssignee(user); try { issueService.createIssue(repository, issue); reportSent = true; } catch (IOException e) { Log.e(TAG, "unable to create issue in repository"); } } catch (IOException e) { Log.e(TAG, "unable to get list of user repositories"); } if (reportSent) { getActivity().runOnUiThread(new Runnable() { public void run() { Toast.makeText(getActivity(), R.string.bug_report_toast_sent, Toast.LENGTH_LONG) .show(); BugReportDialogFragment.this.dismiss(); } }); } else { getActivity().runOnUiThread(new Runnable() { public void run() { Toast.makeText(getActivity(), R.string.bug_report_toast_failed, Toast.LENGTH_LONG).show(); busySpinner.setVisibility(View.INVISIBLE); sendButton.setEnabled(true); sendButton.setVisibility(View.VISIBLE); } }); } } }).start(); } }); EditText messageEditText = (EditText) rootView.findViewById(R.id.bug_report_message); messageEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { //nothing to do here } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { //nothing to do here } @Override public void afterTextChanged(Editable s) { if (s.length() > 0) { sendButton.setVisibility(View.VISIBLE); sendButton.setEnabled(true); } else { sendButton.setVisibility(View.INVISIBLE); sendButton.setEnabled(false); } } }); return rootView; }