
Previewing Android P - ingve
http://android-developers.googleblog.com/2018/03/previewing-android-p.html
======
drdaeman
> _To better ensure privacy, Android P restricts access to mic, camera, and
> all SensorManager sensors from apps that are idle._

Good. Now, if only permissions could be granted temporarily (e.g. "allow for
this session", which auto-revokes after 5-60 minutes of not using the
application), it'll be perfect.

> _We will also enable encryption of Android backups with a client-side
> secret._

Is this about BackupManager? Awesome if so. (BTW, have anyone ever heard of
any alternative BackupTransports, besides Google Drive?)

> _Android P also gives the user control over access to the platform 's
> build.serial identifier by putting it behind the READ_PHONE_STATE
> permission._

IMHO, they should've really split that in two different permissions and
deprecate READ_PHONE_STATE. Device identifiers (including SIM card identities)
and phone state ("someone's calling") are two different things.

~~~
ehsankia
I'm curious, does anyone have a list of apps that would have legitimate use of
sensor data in the background?

~~~
OkGoDoIt
1\. Apps that track sensor data to determine sleep quality or other
nonstandard movement calculation (and thus can't use alternative step counting
API's)

2\. I'm working on an app that constantly records audio in the background and
later allows me to search for things I might have said throughout the day

3\. Apps that track location long-term, like the defunct Moves app. Sure it
kills the battery and is a major privacy concern so it should be opt-in, but I
personally love this functionality and I'm sad there doesn't seem to be a
modern equivalent (Google Maps location history is less accurate and there's
no good API). Apps that record location short-term like MapMyRun do not solve
the same problem.

... I'm sure there's other use cases. I kind of feel like the only developers
allowed to really innovate on mobile anymore are Google (and Apple)
themselves. Bad developers abusing privacy/battery/data have made it so
Google/Apple have to lock down anything interesting. It's frustrating, because
the current state of affairs is definitely better than the free-for-all it
used to be, but I wish I had more control to override what my own device is
able to do.

~~~
on_and_off
Sounds like all these apps can use a foreground service to do that.

Am I missing something ?

The only case I see this change not covering is apps like Cerberus. They would
need to ask their users to go to settings and hide their notification. Not the
nicest UX, but that's a pretty rare use case.

~~~
nl
Define foreground/background.

If I’m using Strava and Spotify I don’t want either to stop working when I
switch to the user interface of the other one.

~~~
on_and_off
A foreground service needs to display a notification.

Not really an issue for Spotify since media apps want to display the media
notification anyway.

For other apps, the idea is that foreground services should be visible to the
user. One of the reasons would be this very capability to access sensors.

Another difference between foreground and background is that a background
service is eligible to be killed on low memory events.

------
pedrocr
One thing I'd really like to see Google try and fix is upstream kernel support
for the phone platforms. Right now there's no chance for an open-source
project like LineageOS to be able to support all devices properly when each
and every single device is stuck on an old kernel often with a bunch of
important CVEs unpatched. It's as if Ubuntu needed to do independent
development for each and every laptop. Without something like that buying an
Android phone is a mine field of various states of broken software provided by
phone manufacturers. It's like trying to buy a consumer wifi router without
the knowledge that if it's supported by OpenWRT you can just ignore whatever
broken software the particular manufacturer put into it and will never support
going forward. The first rule of hardware is that hardware makers can't do
software and Google seems to have mostly given up.

~~~
bri3d
[https://source.android.com/devices/architecture/treble](https://source.android.com/devices/architecture/treble)

This is Google's attempt to do this, in a sense, but as the sibling post
points out, vendors are so resistant to adoption that it's just slowing Oreo
uptake. And yes, Treble just abstracts the framework from the kernel - but it
requires a much more modern baseline and the common HAL interface should make
kernel front-porting much easier and therefore allow manufacturers to ship
less broken kernels.

~~~
pjmlp
Not really, it would a real attempt if it was actually enforced, but given
that Nougat updates to Oreo don't require Treble certification, and the OEMs
are the ones expected to deliver any kind of updates, it is pretty useless to
change the current state of affairs.

~~~
arrivance
I mean, Google are requiring it for all Oreo launch devices, which they all
must be after the P release (you can't get certification for Nougat after P
releases).

It's at least something that'll work long term.

~~~
pjmlp
Still if the updates aren't enforced, all we will get are Oreo devices without
updates, Treble or not.

~~~
wmf
Once you have Treble you can get third-party updates (e.g. LineageOS).

~~~
pjmlp
That doesn't work for regular phone users.

~~~
Mindless2112
Regular phone users don't care, which is why we're in this situation at all.

~~~
pjmlp
They do care on iOS.

------
sandGorgon
_Optimized Kotlin

Kotlin is a first-class language on Android, and if you haven't tried it yet,
you should! We've made an enduring commitment to Kotlin in Android and
continue to expand support including optimizing the performance of Kotlin
code. In P you'll see the first results of this work -- we've improved several
compiler optimizations, especially those that target loops, to extract better
performance. We're also continuing to work in partnership with JetBrains to
optimize Kotlin's generated code. You can get all of the latest Kotlin
performance improvements just by keeping Android Studio's Kotlin plugin up-to-
date. _

How is Google looking at Java vs Kotlin vs Dart. If Flutter is indeed a long
term strategic investment by Google, then why not Kotlin ?

~~~
kjksf
Flutter guys explained why Dart: at the time they were making decision they
looked at bunch of languages and Dart came at the top. At the time Kotlin
either didn't exist or was at extremely early stages.

Regardless of history, Kotlin is, in the end, a JVM language. If you want to
ship a Kotlin app, you need to ship JVM. Getting JVM to a reasonable size is a
great technical challenge not to mention Oracle made it clear what they think
about other companies reimplementing "their" APIs.

(I do know about Kotlin Native but that's far, far future).

Also, Google is not a Borg or centrally planned economy with 5 year plan.

Flutter happened because a bunch of Chrome devs wanted to experiment with a
better way to write mobile apps, not because Larry dictated that "Flutter is
now long term strategic investment, so go and do it".

Flutter happened to be a promising technology so it's getting increased
attention and funding. But it could just as well fail, like AtScript did.

~~~
k__
Hu?

I thought the JVM isn't an issue on Android, becaue it's ingrained in the OS
itself. (Dalvik/ART)

~~~
jayd16
Its not but Flutter is meant to be a cross platform solution.

------
kuschku
One of the largest issues of Android P is that the Nexus devices will never
get it.

So if you as developer want to get the developer preview, the cost for that
just went from 270€ (Nexus 5X) to over 759€ (Pixel 1), and the Pixel 1 isn't
even available in major markets such as France.

So now a huge number of developers has no ability to test their apps on the
latest version of Android.

For me, personally, this means I won't be able to support Android P, I won't
be able to replicate bugs, and in worse case (as happened before once) I'll
have significant bugs in my app, no way to replicate them, and no way to fix
them, because the bug doesn't show in the emulator, and I have no device to
test on.

Google's really shooting themselves in the foot by offering no way for
developers to get an affordable testing device anymore.

~~~
blinkingled
What about the Android One devices like the Moto X4 or any one of the ones
from Nokia that will end up getting P?

~~~
kuschku
None of those devices get the developer preview. All Android One devices get
updates from the manufacturer, usually several weeks after release.

A developer with a Pixel can test their app on P in spring. A developer on a
Moto X4 or a Nokia can test their device in late autumn.

That's 6 months extra time to fix bugs and adjust to new APIs.

~~~
blinkingled
Oh ok - that sucks from a developer standpoint. Google should think of selling
previous gen Pixels at lower price point.

------
mtgx
> _As part of a larger effort to move 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._

Finally! I know Apple originally promised this for iOS9, but I believe it
eventually went back on its word? Is HTTPS mandatory for all iOS apps now?

> _We will also enable encryption of Android backups with a client-side
> secret._

Did they just one-up iOS11 here? This one almost seems like a shot at Apple's
recent security degradation for iOS.

> _In Android P we continue to refine Doze, App Standby, and Background Limits
> to further improve battery life; please be sure to try your apps with these
> and send feedback._

How about you start showing me the apps that are actually draining my phone's
battery, and stop allowing them to hide behind Android OS and System. Battery
stats are virtually useless these days because they don't even tell you half
the story.

~~~
kllrnohj
> How about you start showing me the apps that are actually draining my
> phone's battery, and stop allowing them to hide behind Android OS and
> System.

Nobody is "allowed" to hide. It's simply an estimate based on a crude model.
Power tracking is not an exact thing, it's guesses by the system on observed
patterns with attempts to weight the blame for certain actions.

One of those categories is also the "we have no idea where the power went,
there's just this big gap between our estimate and what the battery says is
left, so... put it there"

~~~
Klathmon
To expand on this a bit, look at location services on a phone.

A "fine" location access event is a "high power" event, it takes a lot of
battery and should be done as infrequently as possible.

Apps on android have the ability to say "i want to get location at least once
every 30 minutes". A naive implementation would give every app that asks for
this a timer, and when that timer ticks off, that app gets location
information. For 5 apps, that could mean 5 times every 30 minutes!

But android is a bit "smarter", it will do it once in the 30 minute period,
then give that same info to all 5 apps.

But then the question is, who caused that battery usage? None of them? All of
them? Should adding a 6th app into the mix cause all of the battery usage of
the other 5 to go down proportionally? Technically that 6th app is pretty much
"free" in terms of actual power usage...

What about if an app says "I want location whenever you get it, but I never
want to trigger it on my own", where do you allocate it's usage?

And that's just one API. Now imagine that with wakelocks, radio usage,
accelerometer/gyroscope usage, etc...

~~~
kllrnohj
Or even CPUs & GPUs also power-gate chunks of their internal features. A CPU's
power draw at a given voltage & frequency is not fixed. It depends on the
actual instructions being executed. Taken to the extreme you end up with
things like Intel's AVX512. So how do you calculate the app's CPU power draw?
If they are using highly optimized SIMD power draw is going to be much higher
than that of a CPU that's constantly stalled out waiting on dependent memory
loads (aka, typical Java code)

------
matthberg
"Indoor positioning with Wi-Fi RTT" a hacker group I've worked with was
working on this same problem! Glad to hear there will be an official api for
it all, their work was some fascinating albeit somewhat jank stuff with
building maps and marker beacons.

~~~
qrv3w
I've also been working on this for a couple of years. I am just about to
release a new version too! [1] Glad to see Android is putting their own out
there, I am excited to try it.

[1] [https://github.com/schollz/find3](https://github.com/schollz/find3)

------
zitterbewegung
Is Tensorflow Lite compatible with the Neural networks API? I don't see that
it is. EDIT thanks child comment it is :)

[https://www.tensorflow.org/mobile/tflite/](https://www.tensorflow.org/mobile/tflite/)

[https://developer.android.com/ndk/guides/neuralnetworks/inde...](https://developer.android.com/ndk/guides/neuralnetworks/index.html)

~~~
mngk1
Citing from
[https://www.tensorflow.org/mobile/tflite/](https://www.tensorflow.org/mobile/tflite/):

"On select Android devices, the Interpreter will use the Android Neural
Networks API for hardware acceleration, or default to CPU execution if none
are available."

------
skybrian
To me, the privacy stuff stands out the most:

"To better ensure privacy, Android P restricts access to mic, camera, and all
SensorManager sensors from apps that are idle."

"Longer term we're working to bring support for per-network randomization of
associated MAC addresses to the platform."

------
Osiris
> As we announced recently, Google Play will require all app updates to target
> Android Oreo (targetSdkVersion 26 or higher) by November 2018

Android Oreo is only running on 1.1% of devices [1]. Will targeting the newest
API prevent the app from being available for in the market for devices running
Nougat or earlier or does it just limit the functionality?

[1] [https://www.androidauthority.com/android-version-
distributio...](https://www.androidauthority.com/android-version-
distribution-748439/)

~~~
dukoid
There are two API levels for Android Apps: The minimal API level and the
target API level. Perhaps it makes sense to see the target API level as the
"maximum" API level the App fully understands.

For instance, Android can't enforce dynamic permissions on older Apps not
designed for this, and people have been exploiting this by keeping the target
API level low.

------
nathanaldensr
_Neural Networks API 1.1

We introduced the Neural Networks API in Android 8.1 to accelerate on-device
machine learning on Android. In Android P we're expanding and improving this
API, adding support for nine new ops -- Pad, BatchToSpaceND, SpaceToBatchND,
Transpose, Strided Slice, Mean, Div, Sub, and Squeeze. If you have a Pixel 2
device, the DP1 build now includes an Qualcomm Hexagon HVX driver with
acceleration for quantized models._

Can someone tell me what this will most likely be used for? I'm not familiar
with the field.

~~~
duckfruit
Very briefly: operations like Transpose, Strided Slice, Padding, and batching
are standard operations used to build Convolutional Neural Networks, which is
in turn is a standard building block for a vast array of machine learning
applications (eg, image recognition)

~~~
nathanaldensr
Ah, cool. So is the goal with having this tech on the phone that the phone
won't need to communicate with servers to do this sort of processing? I'm
struggling to think of a use case for this.

~~~
spyhi
> the goal with having this tech on the phone that the phone won't need to
> communicate with servers to do this sort of processing?

Yeah, that's basically it. In short, the operations listed are pretty
computationally intensive on a CPU, but pretty easy to parallelize for the
data structures that are commonly used in machine learning (matrices and
tensors). I presume that, by creating an API, Google can abstract out these
common ML operations to work on the most efficient hardware on the device,
whether a GPU or custom ML hardware such as Apple's Neural Engine. In theory,
this should make on-device machine learning and inference more power-
efficient, and could reduce reliance on server communication, improving
privacy and probably making lightweight ML applications feel faster.

~~~
richdougherty
> custom ML hardware

I think it's speculation still, but it seems likely that the Pixel Visual Core
chip included in Pixel 2s could be a target for the API.

[https://arstechnica.com/gadgets/2017/10/google-launches-
the-...](https://arstechnica.com/gadgets/2017/10/google-launches-the-
android-8-1-developer-preview/)

The chip is already a target for some ML APIs.

[https://blog.google/products/pixel/pixel-visual-core-
image-p...](https://blog.google/products/pixel/pixel-visual-core-image-
processing-and-machine-learning-pixel-2/)

------
bubblethink
Any chance the original Pixel's kernel version (3.18) got updated ? All
android devices get frozen in time with the kernel they ship with due to
blobs. Nothing new. Just checking if that is ever going to change.

------
rb808
No support for 6p or 5x. WTF my phone is <2 years old.

~~~
chki
2 years and 5-6 Months to be fair and it will probably be exactly three years
old when Android P gets released. In my opinion this is ok because they have
been very upfront about the updates from the beginning (two years system
updates and three years full security updates). Also backward compatibility
for new apps will be there for a really long time. I would also add that it s
preferable to the slow iOS situation: "No update" is better than "broken
update".

~~~
tomsmeding
If they said that in advance, the only thing that it bought them is no legal
action. (Though no-one would bother getting a lwyer over something this
small...)

Such a period is quite short, and maybe too short for a resourceful company
like Google. They should be able to do better; I'm sure the "old" hardware can
manage. (Else you've got a problem with your software.)

------
ProAm
Does Google release bugs that were fixed in each release? Im still waiting to
hear if they fixed the MS Exchange syncing using Gmail that was broken in
Android O. It's near impossible to tell what is working or broken between
releases.

~~~
ac29
I've heard good things about nine [0] if you are working with MS Exchange.
Haven't used it personally though.

[0]
[https://play.google.com/store/apps/details?id=com.ninefolder...](https://play.google.com/store/apps/details?id=com.ninefolders.hd3)

------
saagarjha
> [W]ith Android P we're starting a gradual process to restrict access to
> selected non-SDK interfaces, asking developers -- including app teams inside
> Google -- to use the public equivalents instead. In cases where there is no
> public equivalent for your use-case, please let us know -- we want to make
> sure that this process is as smooth as possible for developers, so we'll use
> your feedback to ensure the initial rollout only affects APIs where
> developers can easily migrate to public alternatives.

What's the situation with private API use on Android? What can you do with
private API? Will you be rejected from the Play Store if you use it?

~~~
Karliss
Acording to [https://android-
developers.googleblog.com/2018/02/improving-...](https://android-
developers.googleblog.com/2018/02/improving-stability-by-reducing-usage.html)
it will simply not be possible to access API you are not supposed to touch.
Trying it will result in NoSuchFieldException/NoSuchMethodException.

~~~
saagarjha
> Starting in the next release of Android, some non-SDK methods and fields
> will be restricted so that you cannot access them -- either directly, via
> reflection, or JNI. If you try, you can see errors such as
> NoSuchFieldException or NoSuchMethodException.

Yes, how is this done? Using SecurityManager or something similar?

~~~
kllrnohj
In the runtime itself: [https://android-
review.googlesource.com/c/platform/art/+/580...](https://android-
review.googlesource.com/c/platform/art/+/580003/10)

CL is abandoned but it appears to have just be split up into smaller changes,
so that should still give a good idea of the approach being used.

------
singularity2001
clicking through the neural networks api:

ANEURALNETWORKS_RELU6 The output is calculated using this formula: output =
min(6, max(0, input))

is that a joke/easter-egg?

also: is there an official java wrapper for the neural networks ndk api?

~~~
mcintyre1994
It's in TensorFlow:
[https://www.tensorflow.org/api_docs/python/tf/nn/relu6](https://www.tensorflow.org/api_docs/python/tf/nn/relu6)

And even points to a paper: [http://www.cs.utoronto.ca/~kriz/conv-
cifar10-aug2010.pdf](http://www.cs.utoronto.ca/~kriz/conv-cifar10-aug2010.pdf)

I'm not sure why they didn't make it a variable maximum though, or what the
advantage is over multiplying a sigmoid by 6.

~~~
clarle
There's an explanation here:

[https://stackoverflow.com/questions/47220595/why-the-6-in-
re...](https://stackoverflow.com/questions/47220595/why-the-6-in-relu6)

It's an arbitrary value, but 6 fits best into 8 bits.

------
mortdeus
What I want to know is what they plan to call this version of Android. Android
Pez, Android Peeps, Android Peppermint, Android Pudding, Android Pie, Android
ummm im out.

~~~
Froyoh
Android Popcorn?

~~~
ikeyany
It has to be sugar-based. Probably Pumpkin Pie or Popsicle.

------
eik3_de
Wait, the clock will be in the top left? That spot is for temporary items like
notifications, not something permanent like the clock!

------
IloveHN84
I still see the lack of security features as in iOS a penalty.

I would prefer less eye-candy over a better security. And I hope that more
middle-high end phones might profit from the Go edition of Android.

I still find surprising that a few vendors (Maybe only Nokia and Lenovo?) are
selling bare-version of Android.

------
butz
Progressive Web Apps still have Chrome icon on them, and nowhere to be seen in
Installed Apps list. Is Google backing up on PWAs?

~~~
dstaley
This sounds like a bookmark, not a PWA. I have several PWAs on my Pixel 2, all
of which appear without the Chrome icon in my app drawer.

~~~
kuschku
Android has two ways of PWAs currently, either as a more complicated bookmark
(with the icon) or with Chrome generating an APK on the fly, Google signing it
on the fly, and it then being installed.

Obviously, this is only available to Chrome, and not to any third-party
browser (the EU antitrust commission is gonna love this).

------
matchbok
Seems that with every release, Android falls further and further behind iOS.
Every iOS release is jam-packed with huge new features. One of the "top"
features of this release is... a notch?

Do we still have to deal with 4+ messaging apps?

And to throw salt in the wound, 90% of users won't see this until 2020. :/

~~~
saagarjha
Behind in what way? Android still leads in many areas, such as how it handles
notifications.

~~~
squiggleblaz
Yup. Notifications in Android - actually useful. Notifications in iPhone -
good luck. You'd better not be using your phone, and you better not have two
notifications you want to receive. Otherwise they just disappear. But iPhone's
notification dots >>> Oreo's.

The Android keyboard (Gboard) is generally better, and emoji specifically. I
never have problems finding the emoji I want on Android (because I can search
for it), but on my iPhone I would sometimes if I'm lucky get a suggestion that
if I'm lucky I would be able to see (or else it might just be ...). Otherwise
it's just search through a giant list and hope my idea of where it belongs is
the same as the developers'.

------
oflannabhra
I think the writing is on the wall for Google's Android. There is some
analysis that Android, from a business perspective, did not work out all that
well for Google. My best guess as to the future state of things:

1) Pixels move to Fuchsia, native apps are in Dart/Flutter, compatibility
layer for Android. Fuchsia becomes a distinguishing feature of Googles
hardware, and allows Google to differentiate vs Android competitors.

2) Google continues to support Android, but only as it affects their business
interests (as a funnel for search).

3) Google migrates some service level functionality away from Android and
Pixels become a first-class citizen in Google's ecosystem.

If you look at Google's moves over the past 5 or so years, you can seem them
try to mitigate the fact that Samsung was basically the biggest winner of
Google opening up Android (Motorola Mobility acquisition, Pixels, Project Fi).

Google sees that voice is unable to be monetized (from an advertising
perspective), and is attempting to replicate Apple's strategy by creating a
new revenue stream from hardware. This has the added benefit of capturing the
most profitable users from Apple. It is a very big bet, and I would not want
to be going up against Apple in a mature market. It will be interesting to see
how it plays out!

Ben Thompson has a pretty great take on these large shifts within Google [0].

[0] - [https://stratechery.com/2016/google-and-the-limits-of-
strate...](https://stratechery.com/2016/google-and-the-limits-of-strategy/)

~~~
mankash666
For one thing, Google's inability to monetize Android better is it's own bad
execution. There's nothing inherently bad about the Android platform, from a
monetization standpoint.

Google's pixel & nexus phones have never dominated the market - and for good
reason - they're not the best. If Google can get their hardware act together,
they can see a windfall in revenues/profit.

~~~
ufmace
I think with the Pixels, Google is at least making an effort at having the
best hardware. They still have some things to figure out regarding marketing,
logistics, keeping design language consistent, etc, but at least for now, they
seem to be working on it.

