Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support workspace accounts with basic device management #2296

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
public class DeviceConfiguration {
public List<String> availableFeatures;
public int densityDpi;
public double diagonalInch;
public int glEsVersion;
public List<String> glExtensions;
public boolean hasFiveWayNavigation;
Expand Down Expand Up @@ -92,6 +93,10 @@ public DeviceConfiguration(Context context) {
this.nativePlatforms = getNativePlatforms();
widthPixels = displayMetrics.widthPixels;
heightPixels = displayMetrics.heightPixels;
diagonalInch = Math.sqrt(
Math.pow(widthPixels / displayMetrics.xdpi, 2) +
Math.pow(heightPixels / displayMetrics.ydpi, 2)
);
locales = getLocales(context);
Set<String> glExtensions = new HashSet<String>();
addEglExtensions(glExtensions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static <T> T request(String url, Request request, Class<T> tClass) throws
} catch (IOException e) {
// Ignore
}
throw new IOException(error);
throw new NotOkayException(error);
}

String result = new String(Utils.readStreamToEnd(connection.getInputStream()));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.microg.gms.common;

import java.io.IOException;

public class NotOkayException extends IOException {
public NotOkayException() {
}

public NotOkayException(String message) {
super(message);
}

public NotOkayException(String message, Throwable cause) {
super(message, cause);
}

public NotOkayException(Throwable cause) {
super(cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,9 @@ public class Scopes {
public static final String USER_BIRTHDAY_READ = "https://www.googleapis.com/auth/user.birthday.read";
@Hide
public static final String GMAIL_READONLY = "https://www.googleapis.com/auth/gmail.readonly";
/**
* Scope for cryptauthenrollment.googleapis.com (required for certain Google Workspace accounts)
*/
@Hide
public static final String CRYPTAUTH = "https://www.googleapis.com/auth/cryptauth";
}
27 changes: 27 additions & 0 deletions play-services-core-proto/src/main/proto/cryptauth/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2015 The Chromium Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/* SPDX-FileCopyrightText: 2014 The Chromium Authors
* SPDX-License-Identifier: BSD-3-Clause
*/

syntax = "proto3";

package cryptauthv2;

option optimize_for = LITE_RUNTIME;

//--------------------- ATTENTION ------------------------
// If you chamge this file please change
// j/c/g/android/gms/auth_proximity/proto/cryptauth_better_together_feature_metadata.proto
// as well.


// A seed used to feed an EID BLE advertisement for some time period.
// Next ID: 4
message BeaconSeed {
// The beacon seed bytes.
bytes data = 1;

// The time at which this key becomes active.
int64 start_time_millis = 2;

// The time at which this key becomes inactive.
int64 end_time_millis = 3;
}

// Data required to verify the remote device.
// Next ID: 3
message AttestationData {
enum Type {
UNKNOWN = 0;

// A Chrome OS "soft-bind" certificate chain.
// The |certificates| field holds a PEM encoded X.509 certificate chain
// ordered from leaf to root.
CROS_SOFT_BIND_CERT_CHAIN = 1;
}

Type type = 1;

// The certificate data as specified by |type|.
repeated bytes certificates = 2;
}

// Device metadata relevant to the suite of multi-device (Better Together)
// features. This data is sent to and received from CryptAuth--using end-to-end
// encryption--as part of DeviceSync v2.
// Next ID: 5
message BetterTogetherDeviceMetadata {
// A cryptographic public key associated with the device.
// The format of this key is a serialized SecureMessage.GenericPublicKey.
bytes public_key = 1;

// A device model name that's guaranteed not to contain any PII.
string no_pii_device_name = 2;

// A list of seeds for EID BLE advertisements targeting this device.
repeated BeaconSeed beacon_seeds = 3;

// Bluetooth public address, formatted as a hex string with colons and capital
// letters. Example: "01:23:45:67:89:AB"
string bluetooth_public_address = 4;

// Attestation data associated with this device.
AttestationData attestation_data = 5;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* SPDX-FileCopyrightText: 2014 The Chromium Authors
* SPDX-License-Identifier: BSD-3-Clause
*/

// This message fills the |metadata| bytes field of the FeatureMetadata message
// (found in the file cryptauth_client_app_metadata.proto) when |feature_type|
// is FeatureMetadata::Feature::BETTER_TOGETHER.
syntax = "proto3";

package cryptauthv2;

option optimize_for = LITE_RUNTIME;

message BetterTogetherFeatureMetadata {
enum FeatureName {
UNKNOWN_FEATURE = 0;
BETTER_TOGETHER_HOST = 1;
BETTER_TOGETHER_CLIENT = 2;
EASY_UNLOCK_HOST = 3;
EASY_UNLOCK_CLIENT = 4;
MAGIC_TETHER_HOST = 5;
MAGIC_TETHER_CLIENT = 6;
SMS_CONNECT_HOST = 7;
SMS_CONNECT_CLIENT = 8;
PHONE_HUB_HOST = 9;
PHONE_HUB_CLIENT = 10;
WIFI_SYNC_HOST = 11;
WIFI_SYNC_CLIENT = 12;
ECHE_HOST = 13;
ECHE_CLIENT = 14;
PHONE_HUB_CAMERA_ROLL_HOST = 15;
PHONE_HUB_CAMERA_ROLL_CLIENT = 16;
}

repeated FeatureName supported_features = 1;
repeated FeatureName enabled_features = 2;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/* SPDX-FileCopyrightText: 2014 The Chromium Authors
* SPDX-License-Identifier: BSD-3-Clause
*/

// Client-specific metadata used in the CryptAuth v2 Enrollment protocol, which
// is serialized and held in |client_app_metadata| of SyncKeysRequest (in file
// cryptauth_enrollment.proto).
syntax = "proto3";

package cryptauthv2;

option optimize_for = LITE_RUNTIME;

// Client specific metadata contained in SyncKeysRequest.client_app_metadata.
// Next id: 31
message ClientAppMetadata {
// App specific metadata from the device. On Android, these should be common
// for all the features as they come from GmsCore, however, on IOS and other
// devices, there could be multiple apps with the feature.
repeated ApplicationSpecificMetadata application_specific_metadata = 1;

// Subgrouping of device identifiers.
// Instance ID: See more info at go/gcm-in-gmscore and
// https://g3doc.corp.google.com/java/com/google/wireless/android/iid/g3doc/index.md?cl=head
string instance_id = 2;
// Token to authenticate the instance ID.
string instance_id_token = 3;
// Checkin android id of the device.
fixed64 android_device_id = 4;
// Chrome and iOS use a UUID in the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
// Where x is a lowercase hex digit.
// For iOS, this UUID is the IDFV.
// For backward compatibility with some Chrome long_device_ids, this can also
// be something else.
// For the same reason, this field is case sensitive, even with valid UUIDs.
string long_device_id = 5;

// Subgrouping of device features field. These help in targeting specific
// class of devices, for ex: Tablets vs phones etc.
// Locale of the device.
string locale = 6;
// The Operating System version.
string device_os_version = 7;
// The Operating System version number on the device.
int64 device_os_version_code = 8;
// The Operating system release on the device.
string device_os_release = 9;
// The Operating system codename on the device.
string device_os_codename = 10;
// Size of the display in thousandths of an inch (e.g. 7000 mils = 7 in)
int32 device_display_diagonal_mils = 11;
// Device's model name (e.g., an android.os.Build.MODEL)
string device_model = 12;
// The device manufacturer name.
string device_manufacturer = 13;
// The type of device this is.
enum DeviceType {
UNKNOWN = 0;
ANDROID = 1;
CHROME = 2;
IOS = 3;
BROWSER = 4;
OSX = 5;
}
DeviceType device_type = 14;

// Subgrouping of lock screen related fields. Used by many identity features.
// Is this device using a secure screenlock (e.g., a pattern or pin unlock).
bool using_secure_screenlock = 15;
// Is auto-unlocking the screenlock supported ?
bool auto_unlock_screenlock_supported = 16;
// Is auto-unlocking the screenlock (e.g., when at "home") enabled ?
bool auto_unlock_screenlock_enabled = 17;

// Subgrouping of bluetooth state related fields on the device. Used by many
// features.
// Does the device have a Bluetooth (classic) radio?
bool bluetooth_radio_supported = 18;
// Is the Bluetooth (classic) radio on?
bool bluetooth_radio_enabled = 19;
// Does the device have a ble radio?
bool ble_radio_supported = 20;

// Does the device hardware support a mobile data connection?
bool mobile_data_supported = 21;
// Does the device support tethering ?
bool tethering_supported = 22;
// If a feature wants to upload some metadata common to all its keys.
repeated FeatureMetadata feature_metadata = 23;

// Bluetooth address for EasyUnlock.
string bluetooth_address = 24;

// Is the device a "Pixel Experience" Android device?
bool pixel_experience = 25;
// Is the device running in the ARC++ container on a chromebook?
bool arc_plus_plus = 26;
// Does the device support user presence that is backed by hardware
// (unspoofable by malware)?
bool hardware_user_presence_supported = 27;
// Does the device support user verification (E.g., passcode, biometrics)?
bool user_verification_supported = 28;
// Does the device support creating a key in trusted execution environment?
bool trusted_execution_environment_supported = 29;
// Does the device support creating a key in a dedicated secure element
// hardware?
bool dedicated_secure_element_supported = 30;

// The response blob generated by the DroidGuard client on the device.
string droid_guard_response = 31;
}

// Metadata that's app specific.
// Next id: 6
message ApplicationSpecificMetadata {
// Used for device_address of DeviceInfo field 2, but for GCM capable devices.
bytes gcm_registration_id = 1;
// Does the user have notifications enabled for the given device address.
bool notification_enabled = 2;
// The software version running on the device.
string device_software_version = 3;
// The software version number running on the device.
int64 device_software_version_code = 4;
// Software package information if applicable.
string device_software_package = 5;
// Whether the user has Bluetooth enabled for the given device address.
bool bluetooth_enabled = 6;
}

// Metadata which is same for different keys belonging to a particular feature.
message FeatureMetadata {
enum Feature {
UNKNOWN = 0;
AUTHZEN = 1;
BETTER_TOGETHER = 2;
}
Feature feature_type = 1;
bytes metadata = 2;
}
Loading