Showing posts with label androidp. Show all posts
Showing posts with label androidp. Show all posts

Sunday, October 21, 2018

Previewing Android P

Posted past times Dave Burke, VP of Engineering

Last calendar week at Mobile World Congress nosotros saw that Android's ecosystem of developers, device makers, together with silicon partners continues to convey amazing experiences to users worldwide.

Looking ahead, today we're sharing the offset developer preview of Android P, the newest version of Android. It's an early on baseline create for developers alone -- you're our most trusted reviewers together with testers ;-) Early feedback from our developer community is crucial inward helping us evolve the platform to encounter your needs. We'd dear to acquire you lot started exercising the novel features together with APIs inward P, together with every bit always, nosotros depend on your early on feedback together with ideas, thus delight give us your input!

This offset developer preview of Android P is merely the start - we'll receive got lots to a greater extent than to portion at Google I/O inward May, remain tuned!

New features to seek inward your apps

Here's a human face at some of the cool features inward this offset preview of Android P that nosotros desire you lot to seek together with give feedback on.

Indoor positioning alongside Wi-Fi RTT

Accurate indoor positioning has been a long-standing challenge that opens novel opportunities for location-based services. Android P adds platform back upwardly for the IEEE 802.11mc WiFi protocol -- also known every bit WiFi Round-Trip-Time (RTT) -- to allow you lot accept wages of indoor positioning inward your apps.

On Android P devices alongside hardware support, location permission, together with location enabled, your apps tin move role RTT APIs to mensurate the distance to nearby WiFi Access Points (APs). The device doesn't demand to connect to the APs to role RTT, together with to maintain privacy, alone the telephone is able to decide the distance, non the APs.

Knowing the distance to three or to a greater extent than APs, you lot tin move calculate the device seat alongside an accuracy of 1 to 2 meters. With this accuracy, you lot tin move create novel experiences similar in-building navigation; fine-grained location-based services such every bit disambiguated vocalization command (e.g.,'Turn on this light'); together with location-based information (e.g., 'Are at that topographic point special offers for this product?').

Display cutout support

Now apps tin move accept total wages of the latest device screens alongside fullscreen content. We've added display cutout into the platform, along alongside APIs that you lot tin move role to acquire by how your content is displayed.

Cutout back upwardly industrial plant seamlessly for apps, alongside the organisation managing condition bar meridian to dissever your content from the cutout. If you lot receive got critical, immersive content, you lot tin move also role new APIs to banking enterprise gibe the cutout shape together with asking full-screen layout around it. You tin move banking enterprise gibe whether the electrical flow device has a cutout past times calling getDisplayCutout(), together with and thus decide the location together with shape of the cutout expanse using DisplayCutout. Influenza A virus subtype H5N1 novel window layout attribute, layoutInDisplayCutoutMode, lets you lot tell the organisation how together with when lay out your content relative to the cutout area. Details are here.

To brand it easier to create together with seek cutout back upwardly inward your app, we've added a Developer Option that simulates a cutout on whatever device. We recommend testing your existing apps alongside display cutout enabled to ensure that your content displays properly.

Apps alongside immersive content tin move display content fullscreen on devices alongside a display cutout.

Improved messaging notifications

In Android P we've pose a priority on improving visibility together with business office inward notifications. Try the novel MessagingStyle notification trend -- it highlights who is messaging together with how you lot tin move reply. You tin move demo conversations, attach photos together with stickers, together with fifty-fifty advise smart replies. See the details here.

In MessagingStyle notifications you lot tin move at nowadays demo conversations together with smart replies [left] together with fifty-fifty attach images together with stickers [right].

Multi-camera API

You tin move at nowadays access streams simultaneously from two or to a greater extent than physical cameras on devices running Android P. On devices alongside either dual-front or dual-back cameras, you lot tin move create innovative features non possible alongside merely a unmarried camera, such every bit seamless zoom, bokeh, together with stereo vision. The API also lets you lot telephone proper name upwardly a logical or fused photographic boob tube camera flow that automatically switches betwixt 2 or to a greater extent than cameras. We're looking frontward to seeing your novel together with exciting creations every bit Android P devices supporting multiple cameras accomplish the marketplace inward the twelvemonth ahead.

Other improvements inward photographic boob tube camera include novel Session parameters that assist to cut back delays during initial capture, together with Surface sharing that lets photographic boob tube camera clients lead hold diverse use-cases without the demand to halt together with start photographic boob tube camera streaming. We've also added APIs for display-based flash support together with access to OIS timestamps for app-level picture stabilization together with special effects.

ImageDecoder for bitmaps together with drawables

Android P gives you lot an easier agency to decode images to bitmaps or drawables -- ImageDecoder, which deprecates BitmapFactory. ImageDecoder lets you lot create a bitmap or drawable from a byte buffer, file, or URI. It offers several advantages over BitmapFactory, including back upwardly for exact scaling, single-step decoding to hardware memory, back upwardly for post-processing inward decode, together with decoding of animated images.

You tin move decode together with scale to an exact size merely past times calling setResize() alongside the target dimensions. You tin move also telephone proper name upwardly getSampledSize() to acquire the picture dimensions at a specific sample rate, together with thus scale to those dimensions. If you lot desire post-process an picture -- such every bit applying rounded corners for circle masks or to a greater extent than complicated effects -- you lot tin move transcend ImageDecoder whatever android.graphics.PostProcessor. You tin move also create Drawables directly, alongside ImageDecoder.decodeDrawable(). If the encoded picture is an animated GIF or WebP, the Drawable volition live an instance of the novel AnimatedImageDrawable.

HDR VP9 Video, HEIF picture compression, together with Media APIs

Android P adds built-in back upwardly for HDR VP9 Profile 2, thus you lot tin move at nowadays deliver HDR-enabled movies to your users from YouTube, Play Movies, together with other sources on HDR-capable devices.

We're excited to add together HEIF (heic) picture encoding to the platform. HEIF is a pop format for photos that improves compression to salve on storage together with network data. With platform back upwardly on Android P devices, it's slow to ship together with utilize HEIF images from your backend server. Once you've made certain that your app is compatible alongside this information format for sharing together with display, give HEIF a seek every bit an picture storage format inward your app. You tin move do a jpeg-to-heic conversion using ImageDecoder or BitmapFactory to obtain a bitmap from jpeg, together with you lot tin move role HeifWriter inward the novel Support Library alpha to write HEIF withal images from YUV byte buffer, Surface, or Bitmap.

We're also inward the physical care for of enhancing together with refactoring the media APIs to brand them easier to develop together with integrate alongside -- sentry for details coming afterwards this year.

Data damage sensitivity inward JobScheduler

JobScheduler is Android's key service to assist you lot acquire by scheduled tasks or operate across Doze, App Standby, together with Background Limits changes. In Android P, JobScheduler handles network-related jobs amend for the user, coordinating alongside network condition signals provided separately past times carriers.

Jobs tin move at nowadays declare their estimated information size, betoken prefetching, together with specify detailed network requirements—carriers tin move written report networks every bit existence congested or unmetered. JobScheduler together with thus manages operate according to the network status. For example, when a network is congested, JobScheduler powerfulness defer large network requests. When unmetered, it tin move run prefetch jobs to improve the user experience, such every bit past times prefetching headlines.

When you lot are adding jobs, seek using setEstimatedNetworkBytes(), setIsPrefetch() together with setRequiredNetwork() to allow JobScheduler lead hold the operate properly. When your project executes, live certain to role the Network object returned past times JobParameters.getNetwork(), otherwise you'll implicitly role the device's default network which may non encounter your requirements, causing unintended information usage.

Neural Networks API 1.1

We introduced the Neural Networks API inward Android 8.1 to accelerate on-device machine learning on Android. In Android P we're expanding together with improving this API, adding back upwardly for ix novel ops -- Pad, BatchToSpaceND, SpaceToBatchND, Transpose, Strided Slice, Mean, Div, Sub, together with Squeeze. If you lot receive got a Pixel 2 device, the DP1 create at nowadays includes an Qualcomm Hexagon HVX driver alongside acceleration for quantized models.

Autofill improvements

In Android P we're continuing to improve the Autofill Framework based on feedback from users together with developers. Along alongside key bugfixes, this unloose includes novel APIs that allow password managers to improve the Autofill user experience, such every bit amend dataset filtering, input sanitization, together with compatibility mode. Compatibility fashion inward particular has a high impact on terminate users because it lets password managers accept the accessibility-based approach inward apps that don't yet receive got total Autofill support, but without impacts on surgical physical care for or security. See all the details on what's novel here.

Open Mobile API for NFC payments together with secure transactions

Android P adds an implementation of the GlobalPlatform Open Mobile API to Android. On supported devices, apps tin move role the OMAPI API to access secure elements (SE) to enable smart-card payments together with other secure services. Influenza A virus subtype H5N1 hardware abstraction layer (HAL) provides the underlying API for enumerating a diversity of Secure Elements (eSE, UICC, together with others) available.

Strengthening Android's foundations

In Android P we're continuing our long-term investment to brand Android the best platform for developers.

Security for apps

In Android P we're moving to a to a greater extent than consistent UI for fingerprint authentication across apps together with devices. Android at nowadays provides a measure organisation dialog to prompt the user to touching the fingerprint sensor, managing text together with placement every bit appropriate for the device. Apps tin move trigger the organisation fingerprint dialog using a novel FingerprintDialog API. We recommend switching to the novel organisation dialog every bit presently every bit possible.

As portion of a larger endeavor to motility all network traffic away from cleartext (unencrypted HTTP) to TLS, we're also changing the defaults for Network Security Configuration to block all cleartext traffic. You'll at nowadays demand to brand connections over TLS, unless you lot explicitly opt-in to cleartext for specific domains.

Privacy for users

To amend ensure privacy, Android P restricts access to mic, camera, together with all SensorManager sensors from apps that are idle. While your app's UID is idle, the mic reports empty good together with sensors halt reporting events. Cameras used past times your app are disconnected together with volition generate an mistake if the app tries to role them. In most cases, these restrictions should non innovate novel issues for existing apps, but nosotros recommend removing these requests from your apps.

We volition also enable encryption of Android backups alongside a client-side secret. This characteristic is withal inward active evolution together with volition live launched inward a futurity Android P preview release.

Longer term we're working to convey back upwardly for per-network randomization of associated MAC addresses to the platform. On supported devices running Android P, you lot tin move enable this experimentally for testing every bit a novel developer option.

Android P also gives the user command over access to the platform's build.serial identifier past times putting it behind the READ_PHONE_STATE permission. Direct access to this identifier has been deprecated since Android 8.0. In guild to access the build.serial identifier, you lot should role the Build.getSerial() method.

ART performance

We're working to convey surgical physical care for together with efficiency improvements to all apps through the ART runtime. We've expanded ART's role of execution profiles to optimize apps together with cut back in-memory footprint of compiled app code. ART at nowadays uses profile information for on-device rewriting of DEX files, alongside reductions upwardly to 11% across a gain of pop apps. We human face these to correlate closely alongside reductions inward organisation DEX retention usage together with faster startup times for your apps.

Optimized Kotlin

Kotlin is a first-class linguistic communication on Android, together with if you lot haven't tried it yet, you lot should! We've made an enduring commitment to Kotlin inward Android together with proceed to expand back upwardly including optimizing the surgical physical care for of Kotlin code. In P you'll see the offset results of this operate -- we've improved several compiler optimizations, specially those that target loops, to extract amend performance. We're also continuing to operate inward partnership alongside JetBrains to optimize Kotlin's generated code. You tin move acquire all of the latest Kotlin surgical physical care for improvements merely past times keeping Android Studio's Kotlin plugin up-to-date.

Power efficiency

In Android P nosotros proceed to refine Doze, App Standby, together with Background Limits to farther improve battery life; delight live certain to seek your apps alongside these together with ship feedback.

Targeting modern Android

Android P is shaped past times our longer-term initiatives to modernize the foundations of Android together with the apps that run on it. As nosotros announced recently, Google Play volition require all app updates to target Android Oreo (targetSdkVersion 26 or higher) past times Nov 2018, alongside back upwardly for 64-bit hardware on the horizon for 2019.

In line alongside these changes, Android P volition warn users alongside a dialog when they install an app that targets a platform before than Android 4.2 (targetSdkVersion less than 17), together with futurity platform versions volition proceed to growth that lower bound. We're encouraging every Android developer to start planning the migration to target API 26 now, together with to start the migration operate every bit presently every bit possible. Here's a checklist of resources for assist together with back upwardly -- we're looking frontward to seeing your apps getting the most from modern Android.

Improving app compatibility through world APIs

Influenza A virus subtype H5N1 key number for users together with developers is app compatibility -- making certain that apps are ready for novel platform versions every bit they arrive, without gamble of crashes for users together with emergency rollouts for developers. Apps that role Android's world APIs from the SDK or NDK are inward a skillful seat to live compatible, but apps that role mortal Android interfaces together with libraries are not.

So alongside Android P we're starting a gradual process to bound access to selected non-SDK interfaces, asking developers -- including app teams within Google -- to role Earth equivalents instead. In cases where at that topographic point is no world equivalent for your use-case, delight let us know -- nosotros desire to brand certain that this physical care for is every bit smoothen every bit possible for developers, thus we'll role your feedback to ensure the initial rollout alone affects APIs where developers tin move easily migrate to world alternatives. More almost the restrictions is here.

Get started inward a few unproblematic steps

First, make your app compatible to give your users a seamless transition to Android P. Just download a device organisation image or emulator organisation image, install your electrical flow app, together with seek -- the app should run together with human face great, together with lead hold behavior changes properly. After you've made whatever necessary updates, nosotros recommend publishing to Google Play correct away without changing the app's platform targeting.

Remember, you lot don't demand a supported Pixel device to seek or develop on Android P. For most uses nosotros highly recommend setting upwardly an Android Virtual Device on the Android Emulator as a seek surroundings instead. If you lot haven't tried the emulator recently, you'll abide by that it's incredibly fast , boots inward nether vi seconds, convenient to use, together with you lot tin move fifty-fifty model next-gen screens -- such every bit long screens together with screens alongside photographic boob tube camera cutout.

Next, change your app's targeting to "P" together with run it alongside the total Android P experience. Set your app's targetSdkVersion to 'P' together with compileSdkVersion to android-P, build, together with test. Make certain to read the deportment changes for apps targeting P to abide by areas you lot volition desire to seek together with powerfulness demand to adjust.

When you're ready, dive into Android P together with acquire almost the many new features together with APIs you lot tin move accept wages of inward your app. To brand it easier to explore the novel APIs, accept a human face at the API diff report, along alongside the Android P API reference. Visit the P Developer Preview site for details on the preview timeline together with support resources. Also banking enterprise gibe out this video highlighting what's novel inward Android P for developers.

To acquire started edifice alongside Android P, download the P Developer Preview SDK together with tools into Android Studio 3.1 or role the latest Android Studio 3.2 canary version. We're also releasing an alpha version of the 28.0.0 back upwardly library for you lot to try.

What's ahead?

The Android P Developer Preview includes an updated SDK alongside organisation images for testing on the official Android Emulator together with on Pixel, Pixel XL Pixel 2, together with Pixel 2 XL devices.

We conception to update the preview organisation images together with SDK regularly throughout the preview. This initial unloose is for developers alone together with non intended for daily or consumer use, thus we're making it available past times manual download together with flash only. Downloads together with instructions are here.

As nosotros acquire closer to a lastly product, we'll live inviting consumers to seek it out every bit well, together with we'll opened upwardly up enrollments through Android Beta at that time. Stay tuned for details, but for at nowadays delight banknote that Android Beta is non currently available for Android P.

As always, your feedback is critical, thus delight let us know what you lot think — the sooner nosotros take away heed from you, the to a greater extent than of your feedback nosotros tin move integrate. When you lot abide by issues, delight report them here. We receive got dissever hotlists for filing platform issues, app compatibility issues, together with third-party SDK issues.

Tuesday, October 16, 2018

What’S Novel Inwards Android P Beta

Earlier today nosotros unveiled a beta version of Android P What’s novel inward Android P Beta

Posted By Dave Burke, VP of Engineering

Project Treble, you lot tin at nowadays acquire the beta on Project Treble final twelvemonth equally utilization of Android Oreo. Since hence we've been working amongst partners on the initial bring-up as well as at nowadays we're seeing proof of what Treble tin do.

Today nosotros announced that vi of our meridian partners are joining us to unloose Faster Adoption amongst Project Treble for to a greater extent than details.

Make your apps compatible

With to a greater extent than users starting to acquire Android P Beta on their devices, at nowadays is the fourth dimension to examination your apps for compatibility, resolve whatever issues, as well as issue an update equally presently equally possible. See the noted previously, inward Android P we're starting a gradual procedure to restrain access to selected non-SDK interfaces, quest developers -- including app teams within Google -- to utilization Earth equivalents instead.

If your apps are using person Android interfaces as well as libraries, you lot should deed to using world APIs from the Android SDK or NDK. The starting fourth dimension developer preview displayed a toast alarm for uses of non-SDK interfaces -- starting inward Android P Beta, uses of non-SDK interfaces that are non exempted volition generate errors inward your apps -- hence you'll at nowadays acquire exceptions thrown instead of a warning.

To assistance you lot position reflective usage of non-SDK APIs, we've added 2 novel methods inward StrictMode. You tin utilization detectNonSdkApiUsage() to warn when your app accesses non-SDK APIs via reflection or JNI, as well as you lot tin utilization permitNonSdkApiUsage() to suppress StrictMode warnings for those accesses. This tin assistance you lot empathize your app's utilization of non-SDK APIs -- fifty-fifty if the APIs are exempted at this time, it's best to conception for the time to come as well as eliminate their use.

In cases where in that place is no world API that meets your use-case, delight let us know immediately. We desire to brand certain that the initial rollout alone affects interfaces where developers tin easily migrate to world alternatives. More almost the restrictions is here.

Test amongst display cutout

It's also of import to test your app amongst display cutout. Now you lot tin utilization several of our partner devices running Android Beta to brand certain your app looks its best amongst a display cutout. You tin also utilization the emulated cutout back upward that's available on whatever Android P device through Developer options.

Get started amongst Android P

When you're ready, dive into Android P as well as acquire almost the many new features as well as APIs you lot tin direct maintain wages of inward your apps. To acquire far easier to explore the novel APIs, direct maintain a await at the API diff reports (API 27->DP2, DP1->DP2) along amongst the Android P API reference. Visit the Developer Preview site for details. Also banking enterprise stand upward for out this video highlighting what's new for developers inward Android P Beta.

To acquire started amongst Android P, download the P Developer Preview SDK as well as tools into Android Studio 3.1 or utilization the latest version of Android Studio 3.2. If you lot don't direct maintain a device that runs Android P Beta, you lot tin use the Android emulator to run as well as examination your app.

As always, your feedback is critical, hence delight let us know what you lot think — the sooner nosotros withdraw heed from you, the to a greater extent than of your feedback nosotros tin integrate. When you lot break issues, delight report them here. We direct maintain course of study hotlists for filing platform issues, app compatibility issues, as well as third-party SDK issues.

Tuesday, October 9, 2018

What's Novel For Text Inwards Android P

Posted yesteryear Florina Muntenescu, Developer Advocate & Siyamed Sinir Android Text Technical Lead

In "What's novel inwards Android P Beta" nosotros mentioned ii of the novel text features inwards Android.. Now that Android P Beta 2 together with the lastly APIs are here, it's fourth dimension to dive deeper into what's novel for text. We know that TextView is 1 of the most critical components of the Android persuasion system. This is why nosotros croak along to invest inwards both developer- together with user-facing features together with API improvements.

PrecomputedText

Displaying text tin ship away live complex, encompassing features similar multiple fonts, occupation spacing, alphabetic lineament spacing, text direction, occupation breaking, hyphenation together with more. TextView has to arrive at a lot of piece of work to stair out together with lay out the given text: reading the font file, finding a glyph, determine the shape, stair out the bounding box, together with caching the give-and-take inwards an internal give-and-take cache. What's more, all of this piece of work takes house on the UI thread, where it could potentially displace your app to drib frames.

We constitute that measuring text tin ship away conduct maintain upwardly to 90% of the fourth dimension required to prepare the text. To solve this problem, inwards Android P together with equally constituent of Jetpack, nosotros introduced a novel API: PrecomputedText. This API is available equally far dorsum equally API fourteen via PrecomputedTextCompat.

PrecomputedText enables an app to perform the most time-consuming parts of text layout beforehand, fifty-fifty on a background thread, caching the layout number together with returning valuable criterion data. The number of PrecomputedText.create(CharSequence, params) tin ship away together with thence live onslaught a TextView. With this, alone almost 10% of the piece of work remains to live done yesteryear the TextView.

 nosotros mentioned ii of the novel text features inwards Android What's novel for text inwards Android P

Percentage of fourth dimension taken to stair out together with layout text

// UI thread val params: PrecomputedText.Params = textView.getTextMetricsParams() val ref = WeakReference(textView) executor.execute {     // background thread     val text = PrecomputedText.create("Hello", params)     val textView = ref.get()     textView?.post {         // UI thread         val textViewRef = ref.get()         textViewRef?.text = text     } } 

Magnifier

Even amongst features similar Smart Text Selection, exactly selecting text tin ship away live challenging. Android P introduces the text Magnifier to amend the user sense of selecting text. The magnifier helps users exactly seat the cursor or the text option handles yesteryear viewing magnified text through a pane that tin ship away live dragged over the text.

 nosotros mentioned ii of the novel text features inwards Android What's novel for text inwards Android P

Magnifying text inwards Android P

We wanted users to conduct maintain the same sense across all apps, whether inwards custom widgets or during custom text-rendering, thence nosotros provided a Magnifier widget that tin ship away live applied to whatever persuasion that is attached to a window. The Magnifier widget tin ship away render a zoomed-in version of whatever persuasion or surface, non simply text.

The Magnifier has 3 principal methods: show, update together with dismiss. For example, you lot could telephone band these methods when implementing onTouchEvent-handling for your custom view. This would displace the Magnifier to follow the user's finger along the screen.

fun onTouchEvent(event: MotionEvent): Boolean {     when (event.actionMasked) {         MotionEvent.ACTION_DOWN ->                magnifier.show(event.x, event.y)         MotionEvent.ACTION_MOVE ->               magnifier.show(event.x, event.y)         MotionEvent.ACTION_UP ->               magnifier.dismiss()     } } 

Smart Linkify

The Linkify class, which has existed since API 1, allows adding links to text using regexes. On top of that, finding physical addresses spins upwardly a WebView illustration to arrive at the results, which tin ship away degrade the performance of the app requesting links. To brand link resolution to a greater extent than accurate, specially for internationalized text, together with to mitigate the performance degradation caused yesteryear the WebView, nosotros created Smart Linkify. Smart Linkify tin ship away live accessed using TextClassifier API.

Smart Linkify uses machine-learning algorithms together with models to recognize entities inwards text. This improves the reliability of the entities recognized. Smart Linkify can, based on entity type,suggest actions that the user tin ship away perform. For example, if Smart Linkify recognizes a telephone number, the API suggests actions such equally sending a text message, making a call, or adding to contacts.

 nosotros mentioned ii of the novel text features inwards Android What's novel for text inwards Android P

Smart Linkify inwards Android P

To amend the performance of your app, displace the piece of work of generating together with applying links to a background thread.

// UI thread val text: Spannable = ... val asking = TextLinks.Request.Builder(text) val ref = WeakReference(textView) executor.execute {     // background thread     TextClassifier.generateLinks(request).apply(text)     val textView = ref.get()     textView?.post {         // UI thread         val textViewRef = ref.get()         textViewRef?.text = text     } } 

Line Height together with Baseline Text Alignment

Designers sometimes render layout specifications to developers that arrive at non check existing TextView attributes perfectly. On Android P together with inwards Jetpack nosotros added 3 attributes, together amongst their corresponding functions, to assistance twosome this gap betwixt how designers together with developers work.

Setting occupation height

Before Android P, the spacing betwixt lines could live controlled using the lineSpacingExtra together with lineSpacingMultiplier attributes. However, designers volition unremarkably render these values equally a uncomplicated occupation height, instead. For this reason, on Android P, nosotros added the lineHeight attribute to prepare the occupation tiptop of the text: that is, the distance betwixt the top together with bottom of a occupation (or distance betwixt subsequent baselines). Under the hood, this attribute genuinely uses together with modifies the existing lineSpacingExtra together with lineSpacingMultiplier attributes.

 nosotros mentioned ii of the novel text features inwards Android What's novel for text inwards Android P

Size of occupation tiptop together with font size

<TextView     android:layout_height="wrap_content"     android:layout_width="match_parent"     android:text="Lorem ipsum dolor sit down amet"     app:lineHeight="50sp"/>  // or inwards code TextView.setLineHeight(@Px int) 

Setting the baseline text alignment

To command the distances of the commencement together with lastly baselines from the persuasion boundaries, nosotros added ii novel attributes: firstBaselineToTopHeight together with lastBaselineToBottomHeight.

firstBaselineToTopHeight: Sets the distance betwixt the TextView's top boundary together with the baseline of the commencement occupation of the TextView. Under the hood this attribute updates the top padding.

lastBaselineToBottomHeight: Sets the distance betwixt the TextView's bottom boundary together with the baseline of the lastly occupation of the TextView. Under the hood, this attribute genuinely updates the bottom padding.

 nosotros mentioned ii of the novel text features inwards Android What's novel for text inwards Android P

Distances betwixt commencement base of operations occupation to top together with lastly baseline to bottom

<TextView     android:layout_height="wrap_content"     android:layout_width="match_parent"     android:text="Lorem ipsum dolor sit down amet"     app:firstBaselineToTopHeight="28sp"     app:lastBaselineToBottomHeight="20sp"/>  // or inwards code TextView.setFirstBaselineToTopHeight(@Px int) TextView.setLastBaselineToBottomHeight(@Px int) 

Text plays an of import role inwards a vast bulk of apps - it's a crucial constituent of an app's pattern language. Text is consumed yesteryear users, together with it fifty-fifty renders emoji 😎. We're continuing to invest inwards text, improving the sense of both app users together with developers.

To larn to a greater extent than almost working amongst text APIs together with what's novel inwards Android P for text, depository fiscal establishment check out the Google I/O 2018 speak on "Best practices amongst text":

Sunday, October 7, 2018

Introducing Android Ix Pie

Posted past times Dave Burke, VP of Engineering

After to a greater extent than than a yr of evolution as well as months of testing past times early on adopters, we're create to launch Android nine Pie, the latest liberate of Android, to the world.

Android nine harnesses the powerfulness of machine learning to brand your telephone smarter, simpler, as well as tailored to you. Read all most the novel consumer features here. For developers, Android nine includes many novel ways to heighten your apps as well as create novel experiences to drive engagement.

You've given us tons of feedback along the way--over a one one thousand bugs as well as characteristic requests--thank you! More than 140,000 of y'all tried our preview builds through the Android Beta program, as well as seven of our device maker partners also brought our Beta to their flagship devices, enabling users around the the world to give their feedback too.

Today we're pushing the source code to Android Open Source Project (AOSP), as well as starting the Android nine rollout to all Pixel users worldwide, alongside Android nine coming to many to a greater extent than devices inward the coming months.

We proceed to motility Android forwards equally the premier opened upward platform for developers worldwide to create their businesses. With Android nine -- together alongside the powerful novel capabilities inward Google Play for apps as well as games -- we're committed to helping y'all create corking experiences, equally good equally attain as well as engage the correct users safely as well as cost-effectively around the world.

What's inward Android 9?

A smarter smartphone, alongside machine learning at the core

Android nine helps your telephone larn equally y'all purpose it, past times picking upward on your preferences as well as adjusting automatically. Everything from helping users acquire the most out of their battery life to surfacing the best parts of the apps they purpose all the time, correct when they demand it most, Android nine keeps things running smoother, longer.

Adaptive Battery

We partnered alongside DeepMind on a characteristic called Adaptive Battery that uses machine learning to prioritize organization resources for the apps the user cares most most. If your app is optimized for Doze, App Standby, as well as Background Limits, Adaptive Battery should operate good for y'all correct out of the box. If y'all haven't yet taken optimized your app, brand certain to cheque out the details inward the power documentation to come across how it works.

Slices

Slices tin assist users perform tasks faster past times enabling engagement exterior of the fullscreen app experience. It does this past times using UI templates that tin display rich, dynamic, as well as interactive content from your app from inside the Google Search app as well as after inward other places similar the Google Assistant. You tin larn to a greater extent than most edifice Slices to heighten your app here.

App Actions

App Actions is a novel agency to lift the visibility of your app as well as drive engagement. Actions accept payoff of machine learning to surface your app to the user at just the correct time, based on your app's semantic intents as well as the user's context.

We'll live sharing to a greater extent than details inward the coming weeks on registering your app to grip i or to a greater extent than user intents, hence your apps tin live enabled for App Actions as well as surfaced across multiple Google as well as Android surfaces inward response to user queries.

Text Classifier as well as Smart Linkify

We've extended the ML models that seat entities inward content or text input to back upward to a greater extent than types similar Dates as well as Flight Numbers through the TextClassifier API. Smart Linkify lets y'all accept payoff of the TextClassifier models through the Linkify API, including enriched options for quick follow-on user actions. Smart Linkify also delivers pregnant improvements inward accuracy of detection equally good equally performance.

Neural Networks API 1.1

Android nine adds an updated version of the Neural networks API, to extend Android's back upward for accelerated on-device machine learning. Neural Networks 1.1 adds back upward for nine novel ops -- Pad, BatchToSpaceND, SpaceToBatchND, Transpose, Strided Slice, Mean, Div, Sub, as well as Squeeze. Influenza A virus subtype H5N1 typical agency to accept payoff of the APIs is through TensorFlow Lite.

Getting the most from your telephone -- to a greater extent than easily

We're excited most making your smartphone to a greater extent than intelligent. But it's also of import that the technology fades to the dorsum for users. In Android 9, we've evolved Android's UI to live simpler as well as to a greater extent than approachable -- for developers, these changes assist improve the agency users find, use, as well as acquire by your apps.

New organization navigation

Android nine introduces a novel organization navigation that we've been working on for to a greater extent than than a year. The novel pattern helps brand Android's multitasking to a greater extent than approachable as well as makes discovering apps much easier. You tin swipe upward from anywhere to come across full-screen previews of latterly used apps as well as only tap to bound dorsum into i of them.

Display cutout

Now your app tin accept total payoff of the latest edge-to-edge screens through display cutout support inward Android 9. For most apps, supporting display cutout is seamless, alongside the organization managing condition bar tiptop to split your content from the cutout. If y'all create got immersive content, y'all tin purpose the display cutout APIs to cheque the seat as well as shape of the cutout as well as asking full-screen layout around it. To assist alongside evolution as well as testing, we've added a Developer Option that simulates several cutout shapes on whatever device.

Apps alongside immersive content tin display content fullscreen on devices alongside a display cutout.

Notifications as well as smart reply

Android nine makes notifications fifty-fifty to a greater extent than useful as well as to a greater extent than actionable. Messaging apps tin accept payoff of the novel MessagingStyle APIs to exhibit conversations, attach photos as well as stickers, as well as fifty-fifty advise smart replies. You'll before long live able to purpose ML Kit to generate smart respond suggestions for your app.

MessagingStyle notifications alongside conversations as well as smart replies [left], images as well as stickers [right].

Text Magnifier

In Android nine we've added a Magnifier widget to improve the user experience of selecting text. The Magnifier widget lets users just seat the cursor or the text choice handles past times viewing zoomed text through a draggable pane. You tin attach it to whatever sentiment that is attached to a window, hence y'all tin purpose it inward custom widgets or during custom text-rendering. The Magnifier widget tin also furnish a zoomed-in version of whatever sentiment or surface, non just text.

Check out our recent weblog post for to a greater extent than most this as well as other Text features, such equally PrecomputedText as well as line tiptop as well as baseline text alignment.

Security as well as privacy for users

Biometric prompt

With a make of biometric sensors inward purpose for authentication, we've made the experience to a greater extent than consistent across sensor types as well as apps. Android nine introduces a system-managed dialog to prompt the user for whatever supported type of biometric authentication. Apps no longer demand to create their ain dialog--instead they purpose the BiometricPrompt API to exhibit the measure organization dialog. In improver to Fingerprint (including in-display sensors), the API supports Face as well as Iris authentication.

If your app is drawing its ain fingerprint auth dialogs, y'all should switch to using the this post for to a greater extent than information.

Protected Confirmation

Android nine introduces Android Protected Confirmation, which uses the Trusted Execution Environment (TEE) to guarantee that a given prompt string is shown as well as confirmed past times the user. Only after successful user confirmation volition the TEE hence sign the prompt string, which the app tin verify.

Stronger protection for somebody keys

We've added StrongBox equally a novel KeyStore type, providing API back upward for devices that furnish key storage inward tamper-resistant hardware alongside isolated CPU, RAM, as well as secure flash. You tin laid whether your keys should live protected past times a StrongBox safety chip inward your KeyGenParameterSpec.

DNS over TLS

Android nine adds built-in back upward for DNS over TLS, automatically upgrading DNS queries to TLS if a network's DNS server supports it. Users tin acquire by DNS over TLS conduct inward a novel Private DNS Mode inward Network & meshwork settings. Apps that perform their ain DNS queries tin purpose a novel API, this post.

HTTPS past times default

As business office of a larger seek to motility all network traffic away from cleartext (unencrypted HTTP) to websites secured alongside TLS (HTTPS), we're changing the defaults for here.

Compiler-based safety mitigations

In Android nine we've expanded our purpose of compiler-level mitigations to harden the platform through run-time detection of unsafe behavior. Control Flow Integrity (CFI) techniques assist to foreclose code-reuse attacks as well as arbitrary code execution. In Android nine we've greatly expanded CFI usage inside the media framework as well as other security-critical components, such equally NFC as well as Bluetooth. We've also introduced CFI centre back upward into the Android mutual centre when edifice alongside LLVM.

We've also expanded our purpose of Integer overflow sanitizers to mitigate memory-corruption as well as information-disclosure vulnerabilities. We've prioritized sanitizers inward libraries alongside past times vulnerabilities or where complex untrusted input is processed, such equally libui, libnl, libmediaplayerservice as well as others. See this post for details.

Privacy for users

Android nine safeguards privacy inward a number of novel ways. The organization at i time restricts access to mic, camera, as well as all SensorManager sensors from apps that are idle. While your app's UID is idle, the mic reports empty good as well as sensors halt reporting events. Cameras used past times your app are disconnected as well as volition generate an mistake if the app tries to purpose them. In most cases, these restrictions should non innovate novel issues for existing apps, but nosotros recommend removing these requests from your apps.

Android nine also gives the user command over access to the platform's build.serial identifier past times putting it behind the READ_PHONE_STATE permission. To access the build.serial identifier, y'all should purpose the Build.getSerial() method.

Read to a greater extent than most all of the privacy changes here.

New experiences inward camera, audio, as well as graphics

Multi-camera API as well as other photographic idiot box camera updates

With Android nine y'all tin at i time opened upward streams from two or to a greater extent than physical cameras simultaneously on devices that back upward the multi-camera API. On devices alongside either dual-front or dual-back cameras, y'all tin create innovative features non possible alongside just a unmarried camera, such equally seamless zoom, bokeh, as well as stereo vision. The API also lets y'all telephone phone a logical or fused photographic idiot box camera current that automatically switches betwixt 2 or to a greater extent than cameras.

Other improvements inward photographic idiot box camera include novel Session parameters that assist to trim down delays during initial capture, as well as Surface sharing that lets photographic idiot box camera clients grip diverse use-cases without the demand to halt as well as start photographic idiot box camera streaming. We've also added APIs for display-based flash support as well as access to OIS timestamps for app-level icon stabilization as well as special effects.

HDR VP9 Video as well as HEIF icon compression

Android nine adds built-in back upward for HDR VP9 Profile 2, hence y'all tin at i time deliver HDR-enabled movies to your users on HDR-capable devices.

We're excited to add together HEIF (heic) icon encoding to the platform. HEIF is a pop format for photos that improves compression to salvage on storage as well as network data. With platform back upward on Android nine devices, it's tardily to transportation as well as utilize HEIF images from your backend server. Once you've made certain that your app is compatible alongside this information format for sharing as well as display, give HEIF a seek equally an icon storage format inward your app. You tin do a jpeg-to-heic conversion using ImageDecoder or BitmapFactory to obtain a bitmap from jpeg, as well as y'all tin purpose HeifWriter inward the AndroidX library to write HEIF yet images from YUV byte buffer, Surface, or Bitmap.

Enhanced good alongside Dynamics Processing

The Dynamics Processing API lets y'all purpose a novel good trial to isolate specific frequencies as well as lower loud or increase soft sounds to heighten the acoustic character of your app. For example, y'all tin improve the good of someone who speaks quietly inward a loud, distant or otherwise acoustically challenging environment. The API gives y'all access to a multi-stage, multi-band dynamics processing trial that includes a pre-equalizer, a multi-band compressor, a post-equalizer as well as a linked limiter.

ImageDecoder for bitmaps as well as drawables

An ImageDecoder API gives y'all an easier agency to decode images to bitmaps or drawables. You tin create a bitmap or drawable from a byte buffer, file, or URI. The API offers several advantages over BitmapFactory, including back upward for exact scaling, single-step decoding to hardware memory, back upward for post-processing inward decode, as well as decoding of animated images. You tin read to a greater extent than here.

Connectivity as well as location

Wi-Fi RTT for indoor positioning

Android nine lets y'all create indoor positioning features into your apps through platform back upward for the IEEE 802.11mc Wi-Fi protocol -- also known equally Wi-Fi Round-Trip-Time (RTT). On Android nine devices alongside hardware support, location permission, as well as location enabled, your apps tin purpose RTT APIs to mensurate the distance to nearby Wi-Fi Access Points (APs). The device doesn't demand to connect to the APs to purpose RTT, as well as to maintain privacy, alone the telephone is able to decide the distance, non the APs.

Knowing the distance to three or to a greater extent than APs, y'all tin calculate the device seat alongside an accuracy of 1 to 2 meters. With this accuracy y'all tin back upward use-cases similar in-building navigation; fine-grained location-based services such equally disambiguated vox command (e.g. 'Turn on this light'); as well as location-based information (e.g. 'Are in that location special offers for this product?').

Data terms sensitivity inward JobScheduler

JobScheduler is Android's primal service to assist y'all acquire by scheduled tasks or operate across Doze, App Standby, as well as Background Limits. In Android 9, JobScheduler handles network-related jobs improve for the user, coordinating alongside network condition signals provided separately past times carriers. Jobs tin at i time declare their estimated information size, bespeak prefetching, as well as specify detailed network requirements—carriers tin study networks equally existence congested or unmetered. JobScheduler hence manages operate according to the network status. For example, when a network is congested, JobScheduler powerfulness defer large network requests. When unmetered, it tin run prefetch jobs to improve the user experience, such equally prefetching headlines.

Open Mobile API for NFC payments as well as secure transactions

Android nine adds an implementation of the GlobalPlatform Open Mobile API to Android. On supported devices, apps tin purpose the OMAPI API to access secure elements (SE) to enable smart-card payments as well as other secure services. Influenza A virus subtype H5N1 hardware abstraction layer (HAL) provides the underlying API for enumerating the multifariousness of Secure Elements (eSE, UICC, as well as others) available.

Performance for apps

ART performance

Android nine brings surgery as well as efficiency improvements to all apps through the ART runtime. We've expanded ART's purpose of execution profiles to optimize apps as well as trim down the in-memory footprint of compiled app code. ART at i time uses profile information for on-device rewriting of DEX files, alongside reductions upward to 11% across a make of pop apps. We hold off these to correlate closely alongside reductions inward organization DEX retention usage as well as faster startup times for your apps.

Optimized for Kotlin

Kotlin is a first-class linguistic communication on Android, as well as if y'all haven't tried it yet, y'all should! We've made an enduring commitment to Kotlin inward Android as well as proceed to expand back upward including optimizing the surgery of Kotlin code. In Android 9, you'll come across the root results of this work--we've improved several compiler optimizations, particularly those that target loops, to extract improve performance. We're also continuing to operate inward partnership alongside JetBrains to optimize Kotlin's generated code. You tin acquire all of the latest Kotlin surgery improvements just past times keeping Android Studio's Kotlin plugin up-to-date.

Today, nosotros are also releasing an update to the Android nine - API 28 SDK (rev. 6), which contains nullability annotations inward some of the most oftentimes used APIs. We'll furnish to a greater extent than details most this inward an upcoming post.

Modern Android

As business office of Android nine nosotros are modernizing the foundations of Android as well as the apps that run on it, equally business office of our deep, sustained investments inward security, performance, as well as stability.

As nosotros announced last year, Google Play volition require all app updates to target Android Oreo (targetSdkVersion 26 or higher) past times Nov 2018. In line alongside that, if your app targets a platform before than Android 4.2 (API bird 17), users installing it volition come across a alert dialog the root fourth dimension your app is run. Here's a checklist of resources for assist as well as back upward equally y'all migrate -- we're looking forwards to seeing your apps getting the most from modern Android.

Get your apps create for Android 9!

With Android nine coming to Pixel users starting today, as well as to other devices inward the months ahead, it's of import to seek your app for compatibility equally before long equally possible. Just install your electrical current app from Google Play on a device or or emulator running Android 9. As y'all operate through the flows, brand certain your app runs as well as looks great, as well as that it handles the Android nine behavior changes properly.

Also spotter for uses of non-SDK interfaces inward your app. Android nine restricts access to selected non-SDK interfaces, hence y'all should trim down your reliance on them. See our recent post for details.

After you've made whatever necessary updates, nosotros recommend publishing to Google Play correct away. without changing the app's platform targeting. This lets y'all ensure a corking experience for Android nine users piece y'all operate on enhancing your app alongside Android nine APIs as well as targeting.

Enhance your app alongside Android nine features as well as APIs

When you're ready, dive into Android nine as well as create alongside the new features as well as APIs inward Android 9.

To acquire started, just download the official API 28 SDK as well as the latest tools as well as emulator images into Android Studio 3.1, or purpose the latest version of Android Studio 3.2. Then update your project's compileSdkVersion as well as targetSdkVersion to API 28. When y'all alter your targeting, brand certain your app supports all of the applicable behavior changes.

As before long equally you're ready, position out your APK updates to Google Play. Influenza A virus subtype H5N1 mutual strategy is to purpose Google Play's beta testing feature to acquire early on feedback from a small-scale grouping of users as well as hence do a staged rollout to production.

Visit the Android nine site for details as well as developer documentation. Also cheque out this video as well as the Google I/O Android Playlist for to a greater extent than on what's novel inward Android nine for developers.

Coming to a device close you

Starting today, an over-the-air update to Android nine volition start out rolling out to Pixel phones. And devices that participated inward the Beta programme from Sony Mobile, Xiaomi, HMD Global, Oppo, Vivo, OnePlus, as well as Essential, equally good equally all qualifying Android One devices, volition have this update past times the cease of this fall! We are also working alongside a number of other partners to launch or upgrade devices to Android nine this year.

As always, the organization images for Pixel devices are available here for manual flash as well as download. If you're looking for the Android nine source, you'll discovery it here inward the Android Open Source Project repository nether the Android nine branches.

What's next?

Now that we've reached the official release, we're bringing the Developer Preview to a close. We'll before long live closing the Developer Preview number tracker to novel issues, hence if y'all create got feedback, experience costless to file a novel issue against Android nine inward the AOSP number tracker.

Thanks i time to a greater extent than to the many developers as well as early on adopters who participated inward the Android nine Developer Preview as well as world beta. Your contributions create got been critical to making the Android nine platform a corking i for developers as well as consumers.