Merge "Refactor StatusHints (1/3)" into mnc-dev
diff --git a/api/current.txt b/api/current.txt
index ea87e82..8d5d226 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -3572,7 +3572,6 @@
method public int getMemoryClass();
method public void getMemoryInfo(android.app.ActivityManager.MemoryInfo);
method public static void getMyMemoryState(android.app.ActivityManager.RunningAppProcessInfo);
- method public int getPackageImportance(java.lang.String);
method public android.os.Debug.MemoryInfo[] getProcessMemoryInfo(int[]);
method public java.util.List<android.app.ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState();
method public deprecated java.util.List<android.app.ActivityManager.RecentTaskInfo> getRecentTasks(int, int) throws java.lang.SecurityException;
@@ -5750,7 +5749,7 @@
method public void setCameraDisabled(android.content.ComponentName, boolean);
method public void setCertInstallerPackage(android.content.ComponentName, java.lang.String) throws java.lang.SecurityException;
method public void setCrossProfileCallerIdDisabled(android.content.ComponentName, boolean);
- method public boolean setDeviceInitializer(android.content.ComponentName, android.content.ComponentName, java.lang.String) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException;
+ method public boolean setDeviceInitializer(android.content.ComponentName, android.content.ComponentName) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException;
method public void setGlobalSetting(android.content.ComponentName, java.lang.String, java.lang.String);
method public boolean setKeyguardDisabled(android.content.ComponentName, boolean);
method public void setKeyguardDisabledFeatures(android.content.ComponentName, int);
@@ -15340,14 +15339,14 @@
method public final void reset();
method public void setCallback(android.media.MediaCodec.Callback, android.os.Handler);
method public void setCallback(android.media.MediaCodec.Callback);
+ method public void setInputSurface(android.view.Surface);
method public void setOnFrameRenderedListener(android.media.MediaCodec.OnFrameRenderedListener, android.os.Handler);
+ method public void setOutputSurface(android.view.Surface);
method public final void setParameters(android.os.Bundle);
- method public void setSurface(android.view.Surface);
method public final void setVideoScalingMode(int);
method public final void signalEndOfInputStream();
method public final void start();
method public final void stop();
- method public void usePersistentInputSurface(android.view.Surface);
field public static final int BUFFER_FLAG_CODEC_CONFIG = 2; // 0x2
field public static final int BUFFER_FLAG_END_OF_STREAM = 4; // 0x4
field public static final int BUFFER_FLAG_KEY_FRAME = 1; // 0x1
@@ -16196,6 +16195,7 @@
method public void setAudioSource(int) throws java.lang.IllegalStateException;
method public deprecated void setCamera(android.hardware.Camera);
method public void setCaptureRate(double);
+ method public void setInputSurface(android.view.Surface);
method public void setLocation(float, float);
method public void setMaxDuration(int) throws java.lang.IllegalArgumentException;
method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException;
@@ -16214,7 +16214,6 @@
method public void setVideoSource(int) throws java.lang.IllegalStateException;
method public void start() throws java.lang.IllegalStateException;
method public void stop() throws java.lang.IllegalStateException;
- method public void usePersistentSurface(android.view.Surface);
field public static final int MEDIA_ERROR_SERVER_DIED = 100; // 0x64
field public static final int MEDIA_RECORDER_ERROR_UNKNOWN = 1; // 0x1
field public static final int MEDIA_RECORDER_INFO_MAX_DURATION_REACHED = 800; // 0x320
@@ -17855,7 +17854,7 @@
method public void onTimeShiftPause();
method public void onTimeShiftResume();
method public void onTimeShiftSeekTo(long);
- method public void onTimeShiftSetPlaybackRate(float, int);
+ method public void onTimeShiftSetPlaybackParams(android.media.PlaybackParams);
method public boolean onTouchEvent(android.view.MotionEvent);
method public boolean onTrackballEvent(android.view.MotionEvent);
method public abstract boolean onTune(android.net.Uri);
@@ -17867,7 +17866,7 @@
method public int describeContents();
method public final int getAudioChannelCount();
method public final int getAudioSampleRate();
- method public final java.lang.String getDescription();
+ method public final java.lang.CharSequence getDescription();
method public final android.os.Bundle getExtra();
method public final java.lang.String getId();
method public final java.lang.String getLanguage();
@@ -17888,7 +17887,7 @@
method public android.media.tv.TvTrackInfo build();
method public final android.media.tv.TvTrackInfo.Builder setAudioChannelCount(int);
method public final android.media.tv.TvTrackInfo.Builder setAudioSampleRate(int);
- method public final android.media.tv.TvTrackInfo.Builder setDescription(java.lang.String);
+ method public final android.media.tv.TvTrackInfo.Builder setDescription(java.lang.CharSequence);
method public final android.media.tv.TvTrackInfo.Builder setExtra(android.os.Bundle);
method public final android.media.tv.TvTrackInfo.Builder setLanguage(java.lang.String);
method public final android.media.tv.TvTrackInfo.Builder setVideoFrameRate(float);
@@ -17916,7 +17915,7 @@
method public void timeShiftPause();
method public void timeShiftResume();
method public void timeShiftSeekTo(long);
- method public void timeShiftSetPlaybackRate(float, int);
+ method public void timeShiftSetPlaybackParams(android.media.PlaybackParams);
method public void tune(java.lang.String, android.net.Uri);
}
@@ -28354,15 +28353,67 @@
ctor public KeyChainException(java.lang.Throwable);
}
+ public final deprecated class KeyPairGeneratorSpec implements java.security.spec.AlgorithmParameterSpec {
+ method public java.security.spec.AlgorithmParameterSpec getAlgorithmParameterSpec();
+ method public android.content.Context getContext();
+ method public java.util.Date getEndDate();
+ method public int getKeySize();
+ method public java.lang.String getKeyType();
+ method public java.lang.String getKeystoreAlias();
+ method public java.math.BigInteger getSerialNumber();
+ method public java.util.Date getStartDate();
+ method public javax.security.auth.x500.X500Principal getSubjectDN();
+ method public boolean isEncryptionRequired();
+ }
+
+ public static final deprecated class KeyPairGeneratorSpec.Builder {
+ ctor public KeyPairGeneratorSpec.Builder(android.content.Context);
+ method public android.security.KeyPairGeneratorSpec build();
+ method public android.security.KeyPairGeneratorSpec.Builder setAlgorithmParameterSpec(java.security.spec.AlgorithmParameterSpec);
+ method public android.security.KeyPairGeneratorSpec.Builder setAlias(java.lang.String);
+ method public android.security.KeyPairGeneratorSpec.Builder setEncryptionRequired();
+ method public android.security.KeyPairGeneratorSpec.Builder setEndDate(java.util.Date);
+ method public android.security.KeyPairGeneratorSpec.Builder setKeySize(int);
+ method public android.security.KeyPairGeneratorSpec.Builder setKeyType(java.lang.String) throws java.security.NoSuchAlgorithmException;
+ method public android.security.KeyPairGeneratorSpec.Builder setSerialNumber(java.math.BigInteger);
+ method public android.security.KeyPairGeneratorSpec.Builder setStartDate(java.util.Date);
+ method public android.security.KeyPairGeneratorSpec.Builder setSubject(javax.security.auth.x500.X500Principal);
+ }
+
+ public final deprecated class KeyStoreParameter implements java.security.KeyStore.ProtectionParameter {
+ method public android.content.Context getContext();
+ method public boolean isEncryptionRequired();
+ }
+
+ public static final deprecated class KeyStoreParameter.Builder {
+ ctor public KeyStoreParameter.Builder(android.content.Context);
+ method public android.security.KeyStoreParameter build();
+ method public android.security.KeyStoreParameter.Builder setEncryptionRequired(boolean);
+ }
+
+ public class NetworkSecurityPolicy {
+ method public static android.security.NetworkSecurityPolicy getInstance();
+ method public boolean isCleartextTrafficPermitted();
+ }
+
+}
+
+package android.security.keystore {
+
public class KeyExpiredException extends java.security.InvalidKeyException {
ctor public KeyExpiredException();
ctor public KeyExpiredException(java.lang.String);
ctor public KeyExpiredException(java.lang.String, java.lang.Throwable);
}
- public class KeyGeneratorSpec implements java.security.spec.AlgorithmParameterSpec {
+ public final class KeyGenParameterSpec implements java.security.spec.AlgorithmParameterSpec {
+ method public java.security.spec.AlgorithmParameterSpec getAlgorithmParameterSpec();
method public java.lang.String[] getBlockModes();
- method public android.content.Context getContext();
+ method public java.util.Date getCertificateNotAfter();
+ method public java.util.Date getCertificateNotBefore();
+ method public java.math.BigInteger getCertificateSerialNumber();
+ method public javax.security.auth.x500.X500Principal getCertificateSubject();
+ method public java.lang.String[] getDigests();
method public java.lang.String[] getEncryptionPaddings();
method public int getKeySize();
method public java.util.Date getKeyValidityForConsumptionEnd();
@@ -28370,28 +28421,53 @@
method public java.util.Date getKeyValidityStart();
method public java.lang.String getKeystoreAlias();
method public int getPurposes();
+ method public java.lang.String[] getSignaturePaddings();
method public int getUserAuthenticationValidityDurationSeconds();
- method public boolean isEncryptionRequired();
+ method public boolean isDigestsSpecified();
+ method public boolean isEncryptionAtRestRequired();
method public boolean isRandomizedEncryptionRequired();
method public boolean isUserAuthenticationRequired();
}
- public static class KeyGeneratorSpec.Builder {
- ctor public KeyGeneratorSpec.Builder(android.content.Context);
- method public android.security.KeyGeneratorSpec build();
- method public android.security.KeyGeneratorSpec.Builder setAlias(java.lang.String);
- method public android.security.KeyGeneratorSpec.Builder setBlockModes(java.lang.String...);
- method public android.security.KeyGeneratorSpec.Builder setEncryptionPaddings(java.lang.String...);
- method public android.security.KeyGeneratorSpec.Builder setEncryptionRequired();
- method public android.security.KeyGeneratorSpec.Builder setKeySize(int);
- method public android.security.KeyGeneratorSpec.Builder setKeyValidityEnd(java.util.Date);
- method public android.security.KeyGeneratorSpec.Builder setKeyValidityForConsumptionEnd(java.util.Date);
- method public android.security.KeyGeneratorSpec.Builder setKeyValidityForOriginationEnd(java.util.Date);
- method public android.security.KeyGeneratorSpec.Builder setKeyValidityStart(java.util.Date);
- method public android.security.KeyGeneratorSpec.Builder setPurposes(int);
- method public android.security.KeyGeneratorSpec.Builder setRandomizedEncryptionRequired(boolean);
- method public android.security.KeyGeneratorSpec.Builder setUserAuthenticationRequired(boolean);
- method public android.security.KeyGeneratorSpec.Builder setUserAuthenticationValidityDurationSeconds(int);
+ public static final class KeyGenParameterSpec.Builder {
+ ctor public KeyGenParameterSpec.Builder(java.lang.String, int);
+ method public android.security.keystore.KeyGenParameterSpec build();
+ method public android.security.keystore.KeyGenParameterSpec.Builder setAlgorithmParameterSpec(java.security.spec.AlgorithmParameterSpec);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setBlockModes(java.lang.String...);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setCertificateNotAfter(java.util.Date);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setCertificateNotBefore(java.util.Date);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setCertificateSerialNumber(java.math.BigInteger);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setCertificateSubject(javax.security.auth.x500.X500Principal);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setDigests(java.lang.String...);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setEncryptionAtRestRequired(boolean);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setEncryptionPaddings(java.lang.String...);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setKeySize(int);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setKeyValidityEnd(java.util.Date);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setKeyValidityForConsumptionEnd(java.util.Date);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setKeyValidityForOriginationEnd(java.util.Date);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setKeyValidityStart(java.util.Date);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setRandomizedEncryptionRequired(boolean);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setSignaturePaddings(java.lang.String...);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setUserAuthenticationRequired(boolean);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setUserAuthenticationValidityDurationSeconds(int);
+ }
+
+ public class KeyInfo implements java.security.spec.KeySpec {
+ method public java.lang.String[] getBlockModes();
+ method public java.lang.String[] getDigests();
+ method public java.lang.String[] getEncryptionPaddings();
+ method public int getKeySize();
+ method public java.util.Date getKeyValidityForConsumptionEnd();
+ method public java.util.Date getKeyValidityForOriginationEnd();
+ method public java.util.Date getKeyValidityStart();
+ method public java.lang.String getKeystoreAlias();
+ method public int getOrigin();
+ method public int getPurposes();
+ method public java.lang.String[] getSignaturePaddings();
+ method public int getUserAuthenticationValidityDurationSeconds();
+ method public boolean isInsideSecureHardware();
+ method public boolean isUserAuthenticationRequired();
+ method public boolean isUserAuthenticationRequirementEnforcedBySecureHardware();
}
public class KeyNotYetValidException extends java.security.InvalidKeyException {
@@ -28400,63 +28476,13 @@
ctor public KeyNotYetValidException(java.lang.String, java.lang.Throwable);
}
- public final class KeyPairGeneratorSpec implements java.security.spec.AlgorithmParameterSpec {
- method public java.security.spec.AlgorithmParameterSpec getAlgorithmParameterSpec();
- method public java.lang.String[] getBlockModes();
- method public android.content.Context getContext();
- method public java.lang.String[] getDigests();
- method public java.lang.String[] getEncryptionPaddings();
- method public java.util.Date getEndDate();
- method public int getKeySize();
- method public java.lang.String getKeyType();
- method public java.util.Date getKeyValidityForConsumptionEnd();
- method public java.util.Date getKeyValidityForOriginationEnd();
- method public java.util.Date getKeyValidityStart();
- method public java.lang.String getKeystoreAlias();
- method public int getPurposes();
- method public java.math.BigInteger getSerialNumber();
- method public java.lang.String[] getSignaturePaddings();
- method public java.util.Date getStartDate();
- method public javax.security.auth.x500.X500Principal getSubjectDN();
- method public int getUserAuthenticationValidityDurationSeconds();
- method public boolean isEncryptionRequired();
- method public boolean isRandomizedEncryptionRequired();
- method public boolean isUserAuthenticationRequired();
- }
-
- public static final class KeyPairGeneratorSpec.Builder {
- ctor public KeyPairGeneratorSpec.Builder(android.content.Context);
- method public android.security.KeyPairGeneratorSpec build();
- method public android.security.KeyPairGeneratorSpec.Builder setAlgorithmParameterSpec(java.security.spec.AlgorithmParameterSpec);
- method public android.security.KeyPairGeneratorSpec.Builder setAlias(java.lang.String);
- method public android.security.KeyPairGeneratorSpec.Builder setBlockModes(java.lang.String...);
- method public android.security.KeyPairGeneratorSpec.Builder setDigests(java.lang.String...);
- method public android.security.KeyPairGeneratorSpec.Builder setEncryptionPaddings(java.lang.String...);
- method public android.security.KeyPairGeneratorSpec.Builder setEncryptionRequired();
- method public android.security.KeyPairGeneratorSpec.Builder setEndDate(java.util.Date);
- method public android.security.KeyPairGeneratorSpec.Builder setKeySize(int);
- method public android.security.KeyPairGeneratorSpec.Builder setKeyType(java.lang.String) throws java.security.NoSuchAlgorithmException;
- method public android.security.KeyPairGeneratorSpec.Builder setKeyValidityEnd(java.util.Date);
- method public android.security.KeyPairGeneratorSpec.Builder setKeyValidityForConsumptionEnd(java.util.Date);
- method public android.security.KeyPairGeneratorSpec.Builder setKeyValidityForOriginationEnd(java.util.Date);
- method public android.security.KeyPairGeneratorSpec.Builder setKeyValidityStart(java.util.Date);
- method public android.security.KeyPairGeneratorSpec.Builder setPurposes(int);
- method public android.security.KeyPairGeneratorSpec.Builder setRandomizedEncryptionRequired(boolean);
- method public android.security.KeyPairGeneratorSpec.Builder setSerialNumber(java.math.BigInteger);
- method public android.security.KeyPairGeneratorSpec.Builder setSignaturePaddings(java.lang.String...);
- method public android.security.KeyPairGeneratorSpec.Builder setStartDate(java.util.Date);
- method public android.security.KeyPairGeneratorSpec.Builder setSubject(javax.security.auth.x500.X500Principal);
- method public android.security.KeyPairGeneratorSpec.Builder setUserAuthenticationRequired(boolean);
- method public android.security.KeyPairGeneratorSpec.Builder setUserAuthenticationValidityDurationSeconds(int);
- }
-
public class KeyPermanentlyInvalidatedException extends java.security.InvalidKeyException {
ctor public KeyPermanentlyInvalidatedException();
ctor public KeyPermanentlyInvalidatedException(java.lang.String);
ctor public KeyPermanentlyInvalidatedException(java.lang.String, java.lang.Throwable);
}
- public abstract class KeyStoreKeyProperties {
+ public abstract class KeyProperties {
field public static final java.lang.String BLOCK_MODE_CBC = "CBC";
field public static final java.lang.String BLOCK_MODE_CTR = "CTR";
field public static final java.lang.String BLOCK_MODE_ECB = "ECB";
@@ -28491,29 +28517,10 @@
field public static final java.lang.String SIGNATURE_PADDING_RSA_PSS = "PSS";
}
- public class KeyStoreKeySpec implements java.security.spec.KeySpec {
+ public final class KeyProtection implements java.security.KeyStore.ProtectionParameter {
method public java.lang.String[] getBlockModes();
method public java.lang.String[] getDigests();
method public java.lang.String[] getEncryptionPaddings();
- method public int getKeySize();
- method public java.util.Date getKeyValidityForConsumptionEnd();
- method public java.util.Date getKeyValidityForOriginationEnd();
- method public java.util.Date getKeyValidityStart();
- method public java.lang.String getKeystoreAlias();
- method public int getOrigin();
- method public int getPurposes();
- method public java.lang.String[] getSignaturePaddings();
- method public int getUserAuthenticationValidityDurationSeconds();
- method public boolean isInsideSecureHardware();
- method public boolean isUserAuthenticationRequired();
- method public boolean isUserAuthenticationRequirementEnforcedBySecureHardware();
- }
-
- public final class KeyStoreParameter implements java.security.KeyStore.ProtectionParameter {
- method public java.lang.String[] getBlockModes();
- method public android.content.Context getContext();
- method public java.lang.String[] getDigests();
- method public java.lang.String[] getEncryptionPaddings();
method public java.util.Date getKeyValidityForConsumptionEnd();
method public java.util.Date getKeyValidityForOriginationEnd();
method public java.util.Date getKeyValidityStart();
@@ -28521,32 +28528,26 @@
method public java.lang.String[] getSignaturePaddings();
method public int getUserAuthenticationValidityDurationSeconds();
method public boolean isDigestsSpecified();
- method public boolean isEncryptionRequired();
+ method public boolean isEncryptionAtRestRequired();
method public boolean isRandomizedEncryptionRequired();
method public boolean isUserAuthenticationRequired();
}
- public static final class KeyStoreParameter.Builder {
- ctor public KeyStoreParameter.Builder(android.content.Context);
- method public android.security.KeyStoreParameter build();
- method public android.security.KeyStoreParameter.Builder setBlockModes(java.lang.String...);
- method public android.security.KeyStoreParameter.Builder setDigests(java.lang.String...);
- method public android.security.KeyStoreParameter.Builder setEncryptionPaddings(java.lang.String...);
- method public android.security.KeyStoreParameter.Builder setEncryptionRequired(boolean);
- method public android.security.KeyStoreParameter.Builder setKeyValidityEnd(java.util.Date);
- method public android.security.KeyStoreParameter.Builder setKeyValidityForConsumptionEnd(java.util.Date);
- method public android.security.KeyStoreParameter.Builder setKeyValidityForOriginationEnd(java.util.Date);
- method public android.security.KeyStoreParameter.Builder setKeyValidityStart(java.util.Date);
- method public android.security.KeyStoreParameter.Builder setPurposes(int);
- method public android.security.KeyStoreParameter.Builder setRandomizedEncryptionRequired(boolean);
- method public android.security.KeyStoreParameter.Builder setSignaturePaddings(java.lang.String...);
- method public android.security.KeyStoreParameter.Builder setUserAuthenticationRequired(boolean);
- method public android.security.KeyStoreParameter.Builder setUserAuthenticationValidityDurationSeconds(int);
- }
-
- public class NetworkSecurityPolicy {
- method public static android.security.NetworkSecurityPolicy getInstance();
- method public boolean isCleartextTrafficPermitted();
+ public static final class KeyProtection.Builder {
+ ctor public KeyProtection.Builder(int);
+ method public android.security.keystore.KeyProtection build();
+ method public android.security.keystore.KeyProtection.Builder setBlockModes(java.lang.String...);
+ method public android.security.keystore.KeyProtection.Builder setDigests(java.lang.String...);
+ method public android.security.keystore.KeyProtection.Builder setEncryptionAtRestRequired(boolean);
+ method public android.security.keystore.KeyProtection.Builder setEncryptionPaddings(java.lang.String...);
+ method public android.security.keystore.KeyProtection.Builder setKeyValidityEnd(java.util.Date);
+ method public android.security.keystore.KeyProtection.Builder setKeyValidityForConsumptionEnd(java.util.Date);
+ method public android.security.keystore.KeyProtection.Builder setKeyValidityForOriginationEnd(java.util.Date);
+ method public android.security.keystore.KeyProtection.Builder setKeyValidityStart(java.util.Date);
+ method public android.security.keystore.KeyProtection.Builder setRandomizedEncryptionRequired(boolean);
+ method public android.security.keystore.KeyProtection.Builder setSignaturePaddings(java.lang.String...);
+ method public android.security.keystore.KeyProtection.Builder setUserAuthenticationRequired(boolean);
+ method public android.security.keystore.KeyProtection.Builder setUserAuthenticationValidityDurationSeconds(int);
}
public class UserNotAuthenticatedException extends java.security.InvalidKeyException {
@@ -30570,7 +30571,7 @@
field public static final java.lang.String BOOL_OPERATOR_SELECTION_EXPAND = "bool_operator_selection_expand";
field public static final java.lang.String BOOL_PREFER_2G = "bool_prefer_2g";
field public static final java.lang.String BOOL_SHOW_APN_SETTING_CDMA = "bool_show_apn_setting_cdma";
- field public static final java.lang.String BOOL_SHOW_CDMA = "bool_show_cdma";
+ field public static final java.lang.String BOOL_SHOW_CDMA_CHOICES = "bool_show_cdma_choices";
field public static final java.lang.String BOOL_SHOW_ONSCREEN_DIAL_BUTTON = "bool_show_onscreen_dial_button";
field public static final java.lang.String BOOL_SIM_NETWORK_UNLOCK_ALLOW_DISMISS = "bool_sim_network_unlock_allow_dismiss";
field public static final java.lang.String BOOL_SUPPORT_PAUSE_IMS_VIDEO_CALLS = "bool_support_pause_ims_video_calls";
@@ -38798,7 +38799,6 @@
}
public abstract class WebMessagePort {
- ctor public WebMessagePort();
method public abstract void close();
method public abstract void postMessage(android.webkit.WebMessage);
method public abstract void setWebMessageCallback(android.webkit.WebMessagePort.WebMessageCallback);
diff --git a/api/system-current.txt b/api/system-current.txt
index 84a23f5..0de71e3 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -3660,7 +3660,6 @@
method public int getMemoryClass();
method public void getMemoryInfo(android.app.ActivityManager.MemoryInfo);
method public static void getMyMemoryState(android.app.ActivityManager.RunningAppProcessInfo);
- method public int getPackageImportance(java.lang.String);
method public android.os.Debug.MemoryInfo[] getProcessMemoryInfo(int[]);
method public java.util.List<android.app.ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState();
method public deprecated java.util.List<android.app.ActivityManager.RecentTaskInfo> getRecentTasks(int, int) throws java.lang.SecurityException;
@@ -5856,7 +5855,7 @@
method public void setCameraDisabled(android.content.ComponentName, boolean);
method public void setCertInstallerPackage(android.content.ComponentName, java.lang.String) throws java.lang.SecurityException;
method public void setCrossProfileCallerIdDisabled(android.content.ComponentName, boolean);
- method public boolean setDeviceInitializer(android.content.ComponentName, android.content.ComponentName, java.lang.String) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException;
+ method public boolean setDeviceInitializer(android.content.ComponentName, android.content.ComponentName) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException;
method public void setGlobalSetting(android.content.ComponentName, java.lang.String, java.lang.String);
method public boolean setKeyguardDisabled(android.content.ComponentName, boolean);
method public void setKeyguardDisabledFeatures(android.content.ComponentName, int);
@@ -16574,14 +16573,14 @@
method public final void reset();
method public void setCallback(android.media.MediaCodec.Callback, android.os.Handler);
method public void setCallback(android.media.MediaCodec.Callback);
+ method public void setInputSurface(android.view.Surface);
method public void setOnFrameRenderedListener(android.media.MediaCodec.OnFrameRenderedListener, android.os.Handler);
+ method public void setOutputSurface(android.view.Surface);
method public final void setParameters(android.os.Bundle);
- method public void setSurface(android.view.Surface);
method public final void setVideoScalingMode(int);
method public final void signalEndOfInputStream();
method public final void start();
method public final void stop();
- method public void usePersistentInputSurface(android.view.Surface);
field public static final int BUFFER_FLAG_CODEC_CONFIG = 2; // 0x2
field public static final int BUFFER_FLAG_END_OF_STREAM = 4; // 0x4
field public static final int BUFFER_FLAG_KEY_FRAME = 1; // 0x1
@@ -17431,6 +17430,7 @@
method public void setAudioSource(int) throws java.lang.IllegalStateException;
method public deprecated void setCamera(android.hardware.Camera);
method public void setCaptureRate(double);
+ method public void setInputSurface(android.view.Surface);
method public void setLocation(float, float);
method public void setMaxDuration(int) throws java.lang.IllegalArgumentException;
method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException;
@@ -17449,7 +17449,6 @@
method public void setVideoSource(int) throws java.lang.IllegalStateException;
method public void start() throws java.lang.IllegalStateException;
method public void stop() throws java.lang.IllegalStateException;
- method public void usePersistentSurface(android.view.Surface);
field public static final int MEDIA_ERROR_SERVER_DIED = 100; // 0x64
field public static final int MEDIA_RECORDER_ERROR_UNKNOWN = 1; // 0x1
field public static final int MEDIA_RECORDER_INFO_MAX_DURATION_REACHED = 800; // 0x320
@@ -19302,7 +19301,7 @@
method public void onTimeShiftPause();
method public void onTimeShiftResume();
method public void onTimeShiftSeekTo(long);
- method public void onTimeShiftSetPlaybackRate(float, int);
+ method public void onTimeShiftSetPlaybackParams(android.media.PlaybackParams);
method public boolean onTouchEvent(android.view.MotionEvent);
method public boolean onTrackballEvent(android.view.MotionEvent);
method public abstract boolean onTune(android.net.Uri);
@@ -19338,7 +19337,7 @@
method public int describeContents();
method public final int getAudioChannelCount();
method public final int getAudioSampleRate();
- method public final java.lang.String getDescription();
+ method public final java.lang.CharSequence getDescription();
method public final android.os.Bundle getExtra();
method public final java.lang.String getId();
method public final java.lang.String getLanguage();
@@ -19359,7 +19358,7 @@
method public android.media.tv.TvTrackInfo build();
method public final android.media.tv.TvTrackInfo.Builder setAudioChannelCount(int);
method public final android.media.tv.TvTrackInfo.Builder setAudioSampleRate(int);
- method public final android.media.tv.TvTrackInfo.Builder setDescription(java.lang.String);
+ method public final android.media.tv.TvTrackInfo.Builder setDescription(java.lang.CharSequence);
method public final android.media.tv.TvTrackInfo.Builder setExtra(android.os.Bundle);
method public final android.media.tv.TvTrackInfo.Builder setLanguage(java.lang.String);
method public final android.media.tv.TvTrackInfo.Builder setVideoFrameRate(float);
@@ -19392,7 +19391,7 @@
method public void timeShiftPause();
method public void timeShiftResume();
method public void timeShiftSeekTo(long);
- method public void timeShiftSetPlaybackRate(float, int);
+ method public void timeShiftSetPlaybackParams(android.media.PlaybackParams);
method public void tune(java.lang.String, android.net.Uri);
method public void tune(java.lang.String, android.net.Uri, android.os.Bundle);
method public void unblockContent(android.media.tv.TvContentRating);
@@ -30379,15 +30378,67 @@
ctor public KeyChainException(java.lang.Throwable);
}
+ public final deprecated class KeyPairGeneratorSpec implements java.security.spec.AlgorithmParameterSpec {
+ method public java.security.spec.AlgorithmParameterSpec getAlgorithmParameterSpec();
+ method public android.content.Context getContext();
+ method public java.util.Date getEndDate();
+ method public int getKeySize();
+ method public java.lang.String getKeyType();
+ method public java.lang.String getKeystoreAlias();
+ method public java.math.BigInteger getSerialNumber();
+ method public java.util.Date getStartDate();
+ method public javax.security.auth.x500.X500Principal getSubjectDN();
+ method public boolean isEncryptionRequired();
+ }
+
+ public static final deprecated class KeyPairGeneratorSpec.Builder {
+ ctor public KeyPairGeneratorSpec.Builder(android.content.Context);
+ method public android.security.KeyPairGeneratorSpec build();
+ method public android.security.KeyPairGeneratorSpec.Builder setAlgorithmParameterSpec(java.security.spec.AlgorithmParameterSpec);
+ method public android.security.KeyPairGeneratorSpec.Builder setAlias(java.lang.String);
+ method public android.security.KeyPairGeneratorSpec.Builder setEncryptionRequired();
+ method public android.security.KeyPairGeneratorSpec.Builder setEndDate(java.util.Date);
+ method public android.security.KeyPairGeneratorSpec.Builder setKeySize(int);
+ method public android.security.KeyPairGeneratorSpec.Builder setKeyType(java.lang.String) throws java.security.NoSuchAlgorithmException;
+ method public android.security.KeyPairGeneratorSpec.Builder setSerialNumber(java.math.BigInteger);
+ method public android.security.KeyPairGeneratorSpec.Builder setStartDate(java.util.Date);
+ method public android.security.KeyPairGeneratorSpec.Builder setSubject(javax.security.auth.x500.X500Principal);
+ }
+
+ public final deprecated class KeyStoreParameter implements java.security.KeyStore.ProtectionParameter {
+ method public android.content.Context getContext();
+ method public boolean isEncryptionRequired();
+ }
+
+ public static final deprecated class KeyStoreParameter.Builder {
+ ctor public KeyStoreParameter.Builder(android.content.Context);
+ method public android.security.KeyStoreParameter build();
+ method public android.security.KeyStoreParameter.Builder setEncryptionRequired(boolean);
+ }
+
+ public class NetworkSecurityPolicy {
+ method public static android.security.NetworkSecurityPolicy getInstance();
+ method public boolean isCleartextTrafficPermitted();
+ }
+
+}
+
+package android.security.keystore {
+
public class KeyExpiredException extends java.security.InvalidKeyException {
ctor public KeyExpiredException();
ctor public KeyExpiredException(java.lang.String);
ctor public KeyExpiredException(java.lang.String, java.lang.Throwable);
}
- public class KeyGeneratorSpec implements java.security.spec.AlgorithmParameterSpec {
+ public final class KeyGenParameterSpec implements java.security.spec.AlgorithmParameterSpec {
+ method public java.security.spec.AlgorithmParameterSpec getAlgorithmParameterSpec();
method public java.lang.String[] getBlockModes();
- method public android.content.Context getContext();
+ method public java.util.Date getCertificateNotAfter();
+ method public java.util.Date getCertificateNotBefore();
+ method public java.math.BigInteger getCertificateSerialNumber();
+ method public javax.security.auth.x500.X500Principal getCertificateSubject();
+ method public java.lang.String[] getDigests();
method public java.lang.String[] getEncryptionPaddings();
method public int getKeySize();
method public java.util.Date getKeyValidityForConsumptionEnd();
@@ -30395,28 +30446,53 @@
method public java.util.Date getKeyValidityStart();
method public java.lang.String getKeystoreAlias();
method public int getPurposes();
+ method public java.lang.String[] getSignaturePaddings();
method public int getUserAuthenticationValidityDurationSeconds();
- method public boolean isEncryptionRequired();
+ method public boolean isDigestsSpecified();
+ method public boolean isEncryptionAtRestRequired();
method public boolean isRandomizedEncryptionRequired();
method public boolean isUserAuthenticationRequired();
}
- public static class KeyGeneratorSpec.Builder {
- ctor public KeyGeneratorSpec.Builder(android.content.Context);
- method public android.security.KeyGeneratorSpec build();
- method public android.security.KeyGeneratorSpec.Builder setAlias(java.lang.String);
- method public android.security.KeyGeneratorSpec.Builder setBlockModes(java.lang.String...);
- method public android.security.KeyGeneratorSpec.Builder setEncryptionPaddings(java.lang.String...);
- method public android.security.KeyGeneratorSpec.Builder setEncryptionRequired();
- method public android.security.KeyGeneratorSpec.Builder setKeySize(int);
- method public android.security.KeyGeneratorSpec.Builder setKeyValidityEnd(java.util.Date);
- method public android.security.KeyGeneratorSpec.Builder setKeyValidityForConsumptionEnd(java.util.Date);
- method public android.security.KeyGeneratorSpec.Builder setKeyValidityForOriginationEnd(java.util.Date);
- method public android.security.KeyGeneratorSpec.Builder setKeyValidityStart(java.util.Date);
- method public android.security.KeyGeneratorSpec.Builder setPurposes(int);
- method public android.security.KeyGeneratorSpec.Builder setRandomizedEncryptionRequired(boolean);
- method public android.security.KeyGeneratorSpec.Builder setUserAuthenticationRequired(boolean);
- method public android.security.KeyGeneratorSpec.Builder setUserAuthenticationValidityDurationSeconds(int);
+ public static final class KeyGenParameterSpec.Builder {
+ ctor public KeyGenParameterSpec.Builder(java.lang.String, int);
+ method public android.security.keystore.KeyGenParameterSpec build();
+ method public android.security.keystore.KeyGenParameterSpec.Builder setAlgorithmParameterSpec(java.security.spec.AlgorithmParameterSpec);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setBlockModes(java.lang.String...);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setCertificateNotAfter(java.util.Date);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setCertificateNotBefore(java.util.Date);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setCertificateSerialNumber(java.math.BigInteger);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setCertificateSubject(javax.security.auth.x500.X500Principal);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setDigests(java.lang.String...);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setEncryptionAtRestRequired(boolean);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setEncryptionPaddings(java.lang.String...);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setKeySize(int);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setKeyValidityEnd(java.util.Date);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setKeyValidityForConsumptionEnd(java.util.Date);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setKeyValidityForOriginationEnd(java.util.Date);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setKeyValidityStart(java.util.Date);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setRandomizedEncryptionRequired(boolean);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setSignaturePaddings(java.lang.String...);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setUserAuthenticationRequired(boolean);
+ method public android.security.keystore.KeyGenParameterSpec.Builder setUserAuthenticationValidityDurationSeconds(int);
+ }
+
+ public class KeyInfo implements java.security.spec.KeySpec {
+ method public java.lang.String[] getBlockModes();
+ method public java.lang.String[] getDigests();
+ method public java.lang.String[] getEncryptionPaddings();
+ method public int getKeySize();
+ method public java.util.Date getKeyValidityForConsumptionEnd();
+ method public java.util.Date getKeyValidityForOriginationEnd();
+ method public java.util.Date getKeyValidityStart();
+ method public java.lang.String getKeystoreAlias();
+ method public int getOrigin();
+ method public int getPurposes();
+ method public java.lang.String[] getSignaturePaddings();
+ method public int getUserAuthenticationValidityDurationSeconds();
+ method public boolean isInsideSecureHardware();
+ method public boolean isUserAuthenticationRequired();
+ method public boolean isUserAuthenticationRequirementEnforcedBySecureHardware();
}
public class KeyNotYetValidException extends java.security.InvalidKeyException {
@@ -30425,63 +30501,13 @@
ctor public KeyNotYetValidException(java.lang.String, java.lang.Throwable);
}
- public final class KeyPairGeneratorSpec implements java.security.spec.AlgorithmParameterSpec {
- method public java.security.spec.AlgorithmParameterSpec getAlgorithmParameterSpec();
- method public java.lang.String[] getBlockModes();
- method public android.content.Context getContext();
- method public java.lang.String[] getDigests();
- method public java.lang.String[] getEncryptionPaddings();
- method public java.util.Date getEndDate();
- method public int getKeySize();
- method public java.lang.String getKeyType();
- method public java.util.Date getKeyValidityForConsumptionEnd();
- method public java.util.Date getKeyValidityForOriginationEnd();
- method public java.util.Date getKeyValidityStart();
- method public java.lang.String getKeystoreAlias();
- method public int getPurposes();
- method public java.math.BigInteger getSerialNumber();
- method public java.lang.String[] getSignaturePaddings();
- method public java.util.Date getStartDate();
- method public javax.security.auth.x500.X500Principal getSubjectDN();
- method public int getUserAuthenticationValidityDurationSeconds();
- method public boolean isEncryptionRequired();
- method public boolean isRandomizedEncryptionRequired();
- method public boolean isUserAuthenticationRequired();
- }
-
- public static final class KeyPairGeneratorSpec.Builder {
- ctor public KeyPairGeneratorSpec.Builder(android.content.Context);
- method public android.security.KeyPairGeneratorSpec build();
- method public android.security.KeyPairGeneratorSpec.Builder setAlgorithmParameterSpec(java.security.spec.AlgorithmParameterSpec);
- method public android.security.KeyPairGeneratorSpec.Builder setAlias(java.lang.String);
- method public android.security.KeyPairGeneratorSpec.Builder setBlockModes(java.lang.String...);
- method public android.security.KeyPairGeneratorSpec.Builder setDigests(java.lang.String...);
- method public android.security.KeyPairGeneratorSpec.Builder setEncryptionPaddings(java.lang.String...);
- method public android.security.KeyPairGeneratorSpec.Builder setEncryptionRequired();
- method public android.security.KeyPairGeneratorSpec.Builder setEndDate(java.util.Date);
- method public android.security.KeyPairGeneratorSpec.Builder setKeySize(int);
- method public android.security.KeyPairGeneratorSpec.Builder setKeyType(java.lang.String) throws java.security.NoSuchAlgorithmException;
- method public android.security.KeyPairGeneratorSpec.Builder setKeyValidityEnd(java.util.Date);
- method public android.security.KeyPairGeneratorSpec.Builder setKeyValidityForConsumptionEnd(java.util.Date);
- method public android.security.KeyPairGeneratorSpec.Builder setKeyValidityForOriginationEnd(java.util.Date);
- method public android.security.KeyPairGeneratorSpec.Builder setKeyValidityStart(java.util.Date);
- method public android.security.KeyPairGeneratorSpec.Builder setPurposes(int);
- method public android.security.KeyPairGeneratorSpec.Builder setRandomizedEncryptionRequired(boolean);
- method public android.security.KeyPairGeneratorSpec.Builder setSerialNumber(java.math.BigInteger);
- method public android.security.KeyPairGeneratorSpec.Builder setSignaturePaddings(java.lang.String...);
- method public android.security.KeyPairGeneratorSpec.Builder setStartDate(java.util.Date);
- method public android.security.KeyPairGeneratorSpec.Builder setSubject(javax.security.auth.x500.X500Principal);
- method public android.security.KeyPairGeneratorSpec.Builder setUserAuthenticationRequired(boolean);
- method public android.security.KeyPairGeneratorSpec.Builder setUserAuthenticationValidityDurationSeconds(int);
- }
-
public class KeyPermanentlyInvalidatedException extends java.security.InvalidKeyException {
ctor public KeyPermanentlyInvalidatedException();
ctor public KeyPermanentlyInvalidatedException(java.lang.String);
ctor public KeyPermanentlyInvalidatedException(java.lang.String, java.lang.Throwable);
}
- public abstract class KeyStoreKeyProperties {
+ public abstract class KeyProperties {
field public static final java.lang.String BLOCK_MODE_CBC = "CBC";
field public static final java.lang.String BLOCK_MODE_CTR = "CTR";
field public static final java.lang.String BLOCK_MODE_ECB = "ECB";
@@ -30516,29 +30542,10 @@
field public static final java.lang.String SIGNATURE_PADDING_RSA_PSS = "PSS";
}
- public class KeyStoreKeySpec implements java.security.spec.KeySpec {
+ public final class KeyProtection implements java.security.KeyStore.ProtectionParameter {
method public java.lang.String[] getBlockModes();
method public java.lang.String[] getDigests();
method public java.lang.String[] getEncryptionPaddings();
- method public int getKeySize();
- method public java.util.Date getKeyValidityForConsumptionEnd();
- method public java.util.Date getKeyValidityForOriginationEnd();
- method public java.util.Date getKeyValidityStart();
- method public java.lang.String getKeystoreAlias();
- method public int getOrigin();
- method public int getPurposes();
- method public java.lang.String[] getSignaturePaddings();
- method public int getUserAuthenticationValidityDurationSeconds();
- method public boolean isInsideSecureHardware();
- method public boolean isUserAuthenticationRequired();
- method public boolean isUserAuthenticationRequirementEnforcedBySecureHardware();
- }
-
- public final class KeyStoreParameter implements java.security.KeyStore.ProtectionParameter {
- method public java.lang.String[] getBlockModes();
- method public android.content.Context getContext();
- method public java.lang.String[] getDigests();
- method public java.lang.String[] getEncryptionPaddings();
method public java.util.Date getKeyValidityForConsumptionEnd();
method public java.util.Date getKeyValidityForOriginationEnd();
method public java.util.Date getKeyValidityStart();
@@ -30546,32 +30553,26 @@
method public java.lang.String[] getSignaturePaddings();
method public int getUserAuthenticationValidityDurationSeconds();
method public boolean isDigestsSpecified();
- method public boolean isEncryptionRequired();
+ method public boolean isEncryptionAtRestRequired();
method public boolean isRandomizedEncryptionRequired();
method public boolean isUserAuthenticationRequired();
}
- public static final class KeyStoreParameter.Builder {
- ctor public KeyStoreParameter.Builder(android.content.Context);
- method public android.security.KeyStoreParameter build();
- method public android.security.KeyStoreParameter.Builder setBlockModes(java.lang.String...);
- method public android.security.KeyStoreParameter.Builder setDigests(java.lang.String...);
- method public android.security.KeyStoreParameter.Builder setEncryptionPaddings(java.lang.String...);
- method public android.security.KeyStoreParameter.Builder setEncryptionRequired(boolean);
- method public android.security.KeyStoreParameter.Builder setKeyValidityEnd(java.util.Date);
- method public android.security.KeyStoreParameter.Builder setKeyValidityForConsumptionEnd(java.util.Date);
- method public android.security.KeyStoreParameter.Builder setKeyValidityForOriginationEnd(java.util.Date);
- method public android.security.KeyStoreParameter.Builder setKeyValidityStart(java.util.Date);
- method public android.security.KeyStoreParameter.Builder setPurposes(int);
- method public android.security.KeyStoreParameter.Builder setRandomizedEncryptionRequired(boolean);
- method public android.security.KeyStoreParameter.Builder setSignaturePaddings(java.lang.String...);
- method public android.security.KeyStoreParameter.Builder setUserAuthenticationRequired(boolean);
- method public android.security.KeyStoreParameter.Builder setUserAuthenticationValidityDurationSeconds(int);
- }
-
- public class NetworkSecurityPolicy {
- method public static android.security.NetworkSecurityPolicy getInstance();
- method public boolean isCleartextTrafficPermitted();
+ public static final class KeyProtection.Builder {
+ ctor public KeyProtection.Builder(int);
+ method public android.security.keystore.KeyProtection build();
+ method public android.security.keystore.KeyProtection.Builder setBlockModes(java.lang.String...);
+ method public android.security.keystore.KeyProtection.Builder setDigests(java.lang.String...);
+ method public android.security.keystore.KeyProtection.Builder setEncryptionAtRestRequired(boolean);
+ method public android.security.keystore.KeyProtection.Builder setEncryptionPaddings(java.lang.String...);
+ method public android.security.keystore.KeyProtection.Builder setKeyValidityEnd(java.util.Date);
+ method public android.security.keystore.KeyProtection.Builder setKeyValidityForConsumptionEnd(java.util.Date);
+ method public android.security.keystore.KeyProtection.Builder setKeyValidityForOriginationEnd(java.util.Date);
+ method public android.security.keystore.KeyProtection.Builder setKeyValidityStart(java.util.Date);
+ method public android.security.keystore.KeyProtection.Builder setRandomizedEncryptionRequired(boolean);
+ method public android.security.keystore.KeyProtection.Builder setSignaturePaddings(java.lang.String...);
+ method public android.security.keystore.KeyProtection.Builder setUserAuthenticationRequired(boolean);
+ method public android.security.keystore.KeyProtection.Builder setUserAuthenticationValidityDurationSeconds(int);
}
public class UserNotAuthenticatedException extends java.security.InvalidKeyException {
@@ -32753,7 +32754,7 @@
field public static final java.lang.String BOOL_OPERATOR_SELECTION_EXPAND = "bool_operator_selection_expand";
field public static final java.lang.String BOOL_PREFER_2G = "bool_prefer_2g";
field public static final java.lang.String BOOL_SHOW_APN_SETTING_CDMA = "bool_show_apn_setting_cdma";
- field public static final java.lang.String BOOL_SHOW_CDMA = "bool_show_cdma";
+ field public static final java.lang.String BOOL_SHOW_CDMA_CHOICES = "bool_show_cdma_choices";
field public static final java.lang.String BOOL_SHOW_ONSCREEN_DIAL_BUTTON = "bool_show_onscreen_dial_button";
field public static final java.lang.String BOOL_SIM_NETWORK_UNLOCK_ALLOW_DISMISS = "bool_sim_network_unlock_allow_dismiss";
field public static final java.lang.String BOOL_SUPPORT_PAUSE_IMS_VIDEO_CALLS = "bool_support_pause_ims_video_calls";
diff --git a/cmds/sm/src/com/android/commands/sm/Sm.java b/cmds/sm/src/com/android/commands/sm/Sm.java
index 4d83610..4a8cf08 100644
--- a/cmds/sm/src/com/android/commands/sm/Sm.java
+++ b/cmds/sm/src/com/android/commands/sm/Sm.java
@@ -18,8 +18,10 @@
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.SystemProperties;
import android.os.storage.DiskInfo;
import android.os.storage.IMountService;
+import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.util.Log;
@@ -65,6 +67,8 @@
runListDisks();
} else if ("list-volumes".equals(op)) {
runListVolumes();
+ } else if ("has-adoptable".equals(op)) {
+ runHasAdoptable();
} else if ("get-primary-storage-uuid".equals(op)) {
runGetPrimaryStorageUuid();
} else if ("partition".equals(op)) {
@@ -111,7 +115,12 @@
}
}
- public void runGetPrimaryStorageUuid() throws RemoteException{
+ public void runHasAdoptable() {
+ System.out.println(SystemProperties.getBoolean(StorageManager.PROP_HAS_ADOPTABLE, false)
+ || SystemProperties.getBoolean(StorageManager.PROP_FORCE_ADOPTABLE, false));
+ }
+
+ public void runGetPrimaryStorageUuid() throws RemoteException {
System.out.println(mSm.getPrimaryStorageUuid());
}
@@ -166,6 +175,7 @@
private static int showUsage() {
System.err.println("usage: sm list-disks");
System.err.println(" sm list-volumes [public|private|emulated|all]");
+ System.err.println(" sm has-adoptable");
System.err.println(" sm get-primary-storage-uuid");
System.err.println("");
System.err.println(" sm partition DISK [public|private|mixed] [ratio]");
diff --git a/cmds/svc/src/com/android/commands/svc/UsbCommand.java b/cmds/svc/src/com/android/commands/svc/UsbCommand.java
index 4dcb05e..a6ef25f 100644
--- a/cmds/svc/src/com/android/commands/svc/UsbCommand.java
+++ b/cmds/svc/src/com/android/commands/svc/UsbCommand.java
@@ -50,7 +50,7 @@
IUsbManager usbMgr = IUsbManager.Stub.asInterface(ServiceManager.getService(
Context.USB_SERVICE));
try {
- usbMgr.setCurrentFunction((args.length >=3 ? args[2] : null), false);
+ usbMgr.setCurrentFunction((args.length >=3 ? args[2] : null));
} catch (RemoteException e) {
System.err.println("Error communicating with UsbManager: " + e);
}
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 9bbb4be..9c99099 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -2320,6 +2320,8 @@
* in {@link RunningAppProcessInfo}, giving you the highest importance of all the
* processes that this package has code running inside of. If there are no processes
* running its code, {@link RunningAppProcessInfo#IMPORTANCE_GONE} is returned.
+ *
+ * @hide
*/
public int getPackageImportance(String packageName) {
try {
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index a71a258..1e9bc54 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -2069,6 +2069,13 @@
return true;
}
+ case KEYGUARD_GOING_AWAY_TRANSACTION: {
+ data.enforceInterface(IActivityManager.descriptor);
+ keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
+ reply.writeNoException();
+ return true;
+ }
+
case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
IBinder token = data.readStrongBinder();
@@ -5179,6 +5186,19 @@
reply.recycle();
}
+ public void keyguardGoingAway(boolean disableWindowAnimations,
+ boolean keyguardGoingToNotificationShade) throws RemoteException {
+ Parcel data = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ data.writeInterfaceToken(IActivityManager.descriptor);
+ data.writeInt(disableWindowAnimations ? 1 : 0);
+ data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
+ mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
+ reply.readException();
+ data.recycle();
+ reply.recycle();
+ }
+
public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
throws RemoteException {
Parcel data = Parcel.obtain();
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index 6b5239d..e0a30ad 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -945,7 +945,7 @@
if (f.mView != null) {
// Need to save the current view state if not
// done already.
- if (!mHost.onShouldSaveFragmentState(f) && f.mSavedViewState == null) {
+ if (mHost.onShouldSaveFragmentState(f) && f.mSavedViewState == null) {
saveFragmentViewState(f);
}
}
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 5829fbe..05a936c 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -403,6 +403,9 @@
public void keyguardWaitingForActivityDrawn() throws RemoteException;
+ public void keyguardGoingAway(boolean disableWindowAnimations,
+ boolean keyguardGoingToNotificationShade) throws RemoteException;
+
public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
throws RemoteException;
@@ -842,4 +845,5 @@
int SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+294;
int UPDATE_DEVICE_OWNER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+295;
int UPDATE_PREFERRED_SETUP_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+296;
+ int KEYGUARD_GOING_AWAY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+297;
}
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 110bdf0..55ff85a 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -2523,13 +2523,26 @@
* {@link DeviceAdminInfo#USES_POLICY_DISABLE_KEYGUARD_FEATURES} to be able to call
* this method; if it has not, a security exception will be thrown.
*
- * <p>Calling this from a managed profile will throw a security exception.
+ * <p>Calling this from a managed profile before version
+ * {@link android.os.Build.VERSION_CODES#MNC} will throw a security exception.
+ *
+ * <p>From version {@link android.os.Build.VERSION_CODES#MNC} a profile owner can set:
+ * <ul>
+ * <li>{@link #KEYGUARD_DISABLE_TRUST_AGENTS}, {@link #KEYGUARD_DISABLE_FINGERPRINT}
+ * these will affect the profile's parent user.
+ * <li>{@link #KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS} this will affect notifications
+ * generated by applications in the managed profile.
+ * </ul>
+ * <p>Requests to disable other features on a managed profile will be ignored. The admin
+ * can check which features have been disabled by calling
+ * {@link #getKeyguardDisabledFeatures(ComponentName)}
*
* @param admin Which {@link DeviceAdminReceiver} this request is associated with.
* @param which {@link #KEYGUARD_DISABLE_FEATURES_NONE} (default),
* {@link #KEYGUARD_DISABLE_WIDGETS_ALL}, {@link #KEYGUARD_DISABLE_SECURE_CAMERA},
* {@link #KEYGUARD_DISABLE_SECURE_NOTIFICATIONS}, {@link #KEYGUARD_DISABLE_TRUST_AGENTS},
- * {@link #KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS}, {@link #KEYGUARD_DISABLE_FEATURES_ALL}
+ * {@link #KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS}, {@link #KEYGUARD_DISABLE_FINGERPRINT},
+ * {@link #KEYGUARD_DISABLE_FEATURES_ALL}
*/
public void setKeyguardDisabledFeatures(ComponentName admin, int which) {
if (mService != null) {
@@ -2793,17 +2806,16 @@
* @param who Which {@link DeviceAdminReceiver} this request is associated with, or null if not
* called by the device owner.
* @param initializer Which {@link DeviceAdminReceiver} to make device initializer.
- * @param initializerName The user-visible name of the device initializer.
* @return whether the component was successfully registered as the device initializer.
* @throws IllegalArgumentException if the componentname is null or invalid
* @throws IllegalStateException if the caller is not device owner or the device has
* already been provisioned or a device initializer already exists.
*/
- public boolean setDeviceInitializer(ComponentName who, ComponentName initializer,
- String initializerName) throws IllegalArgumentException, IllegalStateException {
+ public boolean setDeviceInitializer(ComponentName who, ComponentName initializer)
+ throws IllegalArgumentException, IllegalStateException {
if (mService != null) {
try {
- return mService.setDeviceInitializer(who, initializer, initializerName);
+ return mService.setDeviceInitializer(who, initializer);
} catch (RemoteException re) {
Log.w(TAG, "Failed to set device initializer");
}
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index 481ff62..71d044e 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -213,7 +213,7 @@
boolean setUserEnabled(in ComponentName who);
boolean isDeviceInitializer(String packageName);
void clearDeviceInitializer(in ComponentName who);
- boolean setDeviceInitializer(in ComponentName who, in ComponentName initializer, String initializerName);
+ boolean setDeviceInitializer(in ComponentName who, in ComponentName initializer);
String getDeviceInitializer();
ComponentName getDeviceInitializerComponent();
diff --git a/core/java/android/hardware/fingerprint/FingerprintUtils.java b/core/java/android/hardware/fingerprint/FingerprintUtils.java
deleted file mode 100644
index 525f254..0000000
--- a/core/java/android/hardware/fingerprint/FingerprintUtils.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.fingerprint;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.os.Vibrator;
-import android.provider.Settings;
-import android.text.TextUtils;
-import android.util.Log;
-
-import com.android.internal.util.ArrayUtils;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Utility class for dealing with fingerprints and fingerprint settings.
- * @hide
- */
-public
-class FingerprintUtils {
- private static final boolean DEBUG = true;
- private static final String TAG = "FingerprintUtils";
- private static final long[] FP_ERROR_VIBRATE_PATTERN = new long[] {0, 30, 100, 30};
- private static final long[] FP_SUCCESS_VIBRATE_PATTERN = new long[] {0, 30};
-
- private static int[] toIntArray(List<Integer> list) {
- if (list == null) {
- return null;
- }
- int[] arr = new int[list.size()];
- int i = 0;
- for (int elem : list) {
- arr[i] = elem;
- i++;
- }
- return arr;
- }
-
- public static int[] getFingerprintIdsForUser(ContentResolver res, int userId) {
- String fingerIdsRaw = Settings.Secure.getStringForUser(res,
- Settings.Secure.USER_FINGERPRINT_IDS, userId);
- ArrayList<Integer> tmp = new ArrayList<Integer>();
- if (!TextUtils.isEmpty(fingerIdsRaw)) {
- String[] fingerStringIds = fingerIdsRaw.replace("[","").replace("]","").split(", ");
- int length = fingerStringIds.length;
- for (int i = 0; i < length; i++) {
- try {
- tmp.add(Integer.decode(fingerStringIds[i]));
- } catch (NumberFormatException e) {
- if (DEBUG) Log.w(TAG, "Error parsing finger id: '" + fingerStringIds[i] + "'");
- }
- }
- }
- return toIntArray(tmp);
- }
-
- public static void addFingerprintIdForUser(ContentResolver res, int fingerId, int userId) {
- // FingerId 0 has special meaning.
- if (fingerId == 0) {
- Log.w(TAG, "Tried to add fingerId 0");
- return;
- }
-
- int[] fingerIds = getFingerprintIdsForUser(res, userId);
-
- // Don't allow dups
- if (ArrayUtils.contains(fingerIds, fingerId)) {
- Log.w(TAG, "finger already added " + fingerId);
- return;
- }
- int[] newList = Arrays.copyOf(fingerIds, fingerIds.length + 1);
- newList[fingerIds.length] = fingerId;
- Settings.Secure.putStringForUser(res, Settings.Secure.USER_FINGERPRINT_IDS,
- Arrays.toString(newList), userId);
- }
-
- public static boolean removeFingerprintIdForUser(int fingerId, ContentResolver res, int userId)
- {
- // FingerId 0 has special meaning. The HAL layer is supposed to remove each finger one
- // at a time and invoke notify() for each fingerId. If we get called with 0 here, it means
- // something bad has happened.
- if (fingerId == 0) throw new IllegalArgumentException("fingerId can't be 0");
-
- final int[] fingerIds = getFingerprintIdsForUser(res, userId);
- if (ArrayUtils.contains(fingerIds, fingerId)) {
- final int[] result = ArrayUtils.removeInt(fingerIds, fingerId);
- Settings.Secure.putStringForUser(res, Settings.Secure.USER_FINGERPRINT_IDS,
- Arrays.toString(result), userId);
- return true;
- }
- return false;
- }
-
- public static void vibrateFingerprintError(Context context) {
- Vibrator vibrator = context.getSystemService(Vibrator.class);
- if (vibrator != null) {
- vibrator.vibrate(FP_ERROR_VIBRATE_PATTERN, -1);
- }
- }
-
- public static void vibrateFingerprintSuccess(Context context) {
- Vibrator vibrator = context.getSystemService(Vibrator.class);
- if (vibrator != null) {
- vibrator.vibrate(FP_SUCCESS_VIBRATE_PATTERN, -1);
- }
- }
-
-};
-
diff --git a/core/java/android/hardware/usb/IUsbManager.aidl b/core/java/android/hardware/usb/IUsbManager.aidl
index e4ab3f2..881dc0f 100644
--- a/core/java/android/hardware/usb/IUsbManager.aidl
+++ b/core/java/android/hardware/usb/IUsbManager.aidl
@@ -83,7 +83,7 @@
void clearDefaults(String packageName, int userId);
/* Sets the current USB function. */
- void setCurrentFunction(String function, boolean makeDefault);
+ void setCurrentFunction(String function);
/* Allow USB debugging from the attached host. If alwaysAllow is true, add the
* the public key to list of host keys that the user has approved.
diff --git a/core/java/android/hardware/usb/UsbManager.java b/core/java/android/hardware/usb/UsbManager.java
index a45d4ca..000d41f 100644
--- a/core/java/android/hardware/usb/UsbManager.java
+++ b/core/java/android/hardware/usb/UsbManager.java
@@ -228,6 +228,23 @@
*/
public static final String EXTRA_PERMISSION_GRANTED = "permission";
+ /**
+ * The persistent property which stores whether adb is enabled or not. Other values are ignored.
+ * Previously this value stored non-adb settings, but not anymore.
+ * TODO: rename this to something adb specific, rather than using usb.
+ *
+ * {@hide}
+ */
+ public static final String ADB_PERSISTENT_PROPERTY = "persist.sys.usb.config";
+
+ /**
+ * The non-persistent property which stores the current USB settings.
+ *
+ * {@hide}
+ */
+ public static final String USB_SETTINGS_PROPERTY = "sys.usb.config";
+
+
private final Context mContext;
private final IUsbManager mService;
@@ -410,21 +427,26 @@
}
}
+ private static boolean propertyContainsFunction(String property, String function) {
+ String functions = SystemProperties.get(property, "");
+ int index = functions.indexOf(function);
+ if (index < 0) return false;
+ if (index > 0 && functions.charAt(index - 1) != ',') return false;
+ int charAfter = index + function.length();
+ if (charAfter < functions.length() && functions.charAt(charAfter) != ',') return false;
+ return true;
+ }
+
/**
- * Returns the current default USB function.
+ * Returns true if the specified USB function is currently enabled.
*
- * @return name of the default function.
+ * @param function name of the USB function
+ * @return true if the USB function is enabled.
*
* {@hide}
*/
- public String getDefaultFunction() {
- String functions = SystemProperties.get("persist.sys.usb.config", "");
- int commaIndex = functions.indexOf(',');
- if (commaIndex > 0) {
- return functions.substring(0, commaIndex);
- } else {
- return functions;
- }
+ public boolean isFunctionEnabled(String function) {
+ return propertyContainsFunction(USB_SETTINGS_PROPERTY, function);
}
/**
@@ -432,13 +454,12 @@
* If function is null, then the current function is set to the default function.
*
* @param function name of the USB function, or null to restore the default function
- * @param makeDefault true if the function should be set as the new default function
*
* {@hide}
*/
- public void setCurrentFunction(String function, boolean makeDefault) {
+ public void setCurrentFunction(String function) {
try {
- mService.setCurrentFunction(function, makeDefault);
+ mService.setCurrentFunction(function);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException in setCurrentFunction", e);
}
diff --git a/core/java/android/os/FileUtils.java b/core/java/android/os/FileUtils.java
index 021e5e4..917271d 100644
--- a/core/java/android/os/FileUtils.java
+++ b/core/java/android/os/FileUtils.java
@@ -528,7 +528,7 @@
* {@code /after/foo/bar.txt}.
*/
public static File rewriteAfterRename(File beforeDir, File afterDir, File file) {
- if (file == null) return null;
+ if (file == null || beforeDir == null || afterDir == null) return null;
if (contains(beforeDir, file)) {
final String splice = file.getAbsolutePath().substring(
beforeDir.getAbsolutePath().length());
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index 3fdabee..8c0bbbf 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -73,6 +73,8 @@
/** {@hide} */
public static final String PROP_PRIMARY_PHYSICAL = "ro.vold.primary_physical";
/** {@hide} */
+ public static final String PROP_HAS_ADOPTABLE = "vold.has_adoptable";
+ /** {@hide} */
public static final String PROP_FORCE_ADOPTABLE = "persist.fw.force_adoptable";
/** {@hide} */
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index d3a5561..c514180 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -4363,12 +4363,6 @@
"lock_screen_appwidget_ids";
/**
- * List of enrolled fingerprint identifiers (comma-delimited).
- * @hide
- */
- public static final String USER_FINGERPRINT_IDS = "user_fingerprint_ids";
-
- /**
* Id of the appwidget shown on the lock screen when appwidgets are disabled.
* @hide
*/
diff --git a/core/java/android/provider/VoicemailContract.java b/core/java/android/provider/VoicemailContract.java
index 879f26c..89668c1 100644
--- a/core/java/android/provider/VoicemailContract.java
+++ b/core/java/android/provider/VoicemailContract.java
@@ -306,6 +306,13 @@
contentValues.put(Voicemails.SOURCE_PACKAGE, voicemail.getSourcePackage());
contentValues.put(Voicemails.SOURCE_DATA, voicemail.getSourceData());
contentValues.put(Voicemails.IS_READ, voicemail.isRead() ? 1 : 0);
+
+ PhoneAccountHandle phoneAccount = voicemail.getPhoneAccount();
+ if (voicemail.getPhoneAccount() != null) {
+ contentValues.put(Voicemails.PHONE_ACCOUNT_COMPONENT_NAME,
+ phoneAccount.getComponentName().flattenToString());
+ contentValues.put(Voicemails.PHONE_ACCOUNT_ID, phoneAccount.getId());
+ }
return contentValues;
}
}
diff --git a/core/java/android/security/IKeystoreService.aidl b/core/java/android/security/IKeystoreService.aidl
index 4809050..b0779c0 100644
--- a/core/java/android/security/IKeystoreService.aidl
+++ b/core/java/android/security/IKeystoreService.aidl
@@ -75,4 +75,6 @@
int abort(IBinder handle);
boolean isOperationAuthorized(IBinder token);
int addAuthToken(in byte[] authToken);
+ int onUserAdded(int userId, int parentId);
+ int onUserRemoved(int userId);
}
diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java
index 599ac74..1e42913 100644
--- a/core/java/android/service/notification/ZenModeConfig.java
+++ b/core/java/android/service/notification/ZenModeConfig.java
@@ -573,24 +573,34 @@
}
public static Condition toTimeCondition(Context context, int minutesFromNow, int userHandle) {
+ return toTimeCondition(context, minutesFromNow, userHandle, false /*shortVersion*/);
+ }
+
+ public static Condition toTimeCondition(Context context, int minutesFromNow, int userHandle,
+ boolean shortVersion) {
final long now = System.currentTimeMillis();
final long millis = minutesFromNow == 0 ? ZERO_VALUE_MS : minutesFromNow * MINUTES_MS;
- return toTimeCondition(context, now + millis, minutesFromNow, now, userHandle);
+ return toTimeCondition(context, now + millis, minutesFromNow, now, userHandle,
+ shortVersion);
}
public static Condition toTimeCondition(Context context, long time, int minutes, long now,
- int userHandle) {
+ int userHandle, boolean shortVersion) {
final int num, summaryResId, line1ResId;
if (minutes < 60) {
// display as minutes
num = minutes;
- summaryResId = R.plurals.zen_mode_duration_minutes_summary;
- line1ResId = R.plurals.zen_mode_duration_minutes;
+ summaryResId = shortVersion ? R.plurals.zen_mode_duration_minutes_summary_short
+ : R.plurals.zen_mode_duration_minutes_summary;
+ line1ResId = shortVersion ? R.plurals.zen_mode_duration_minutes_short
+ : R.plurals.zen_mode_duration_minutes;
} else {
// display as hours
num = Math.round(minutes / 60f);
- summaryResId = com.android.internal.R.plurals.zen_mode_duration_hours_summary;
- line1ResId = com.android.internal.R.plurals.zen_mode_duration_hours;
+ summaryResId = shortVersion ? R.plurals.zen_mode_duration_hours_summary_short
+ : R.plurals.zen_mode_duration_hours_summary;
+ line1ResId = shortVersion ? R.plurals.zen_mode_duration_hours_short
+ : R.plurals.zen_mode_duration_hours;
}
final String skeleton = DateFormat.is24HourFormat(context, userHandle) ? "Hm" : "hma";
final String pattern = DateFormat.getBestDateTimePattern(Locale.getDefault(), skeleton);
@@ -793,17 +803,17 @@
}
public static String getConditionLine1(Context context, ZenModeConfig config,
- int userHandle) {
- return getConditionLine(context, config, userHandle, true /*useLine1*/);
+ int userHandle, boolean shortVersion) {
+ return getConditionLine(context, config, userHandle, true /*useLine1*/, shortVersion);
}
public static String getConditionSummary(Context context, ZenModeConfig config,
- int userHandle) {
- return getConditionLine(context, config, userHandle, false /*useLine1*/);
+ int userHandle, boolean shortVersion) {
+ return getConditionLine(context, config, userHandle, false /*useLine1*/, shortVersion);
}
private static String getConditionLine(Context context, ZenModeConfig config,
- int userHandle, boolean useLine1) {
+ int userHandle, boolean useLine1, boolean shortVersion) {
if (config == null) return "";
if (config.manualRule != null) {
final Uri id = config.manualRule.conditionId;
@@ -816,7 +826,7 @@
final long now = System.currentTimeMillis();
final long span = time - now;
c = toTimeCondition(context,
- time, Math.round(span / (float) MINUTES_MS), now, userHandle);
+ time, Math.round(span / (float) MINUTES_MS), now, userHandle, shortVersion);
}
final String rt = c == null ? "" : useLine1 ? c.line1 : c.summary;
return TextUtils.isEmpty(rt) ? "" : rt;
diff --git a/core/java/android/view/IWindow.aidl b/core/java/android/view/IWindow.aidl
index 9fc80fc..0fefdc7 100644
--- a/core/java/android/view/IWindow.aidl
+++ b/core/java/android/view/IWindow.aidl
@@ -80,11 +80,17 @@
int localValue, int localChanges);
/**
- * If the window manager returned RELAYOUT_RES_ANIMATING
- * from relayout(), this method will be called when the animation
- * is done.
+ * The window is beginning to animate. The application should stop drawing frames until the
+ * window is not animating anymore, indicated by being called {@link #windowEndAnimating}.
+ *
+ * @param remainingFrameCount how many frames the app might still draw before stopping drawing
*/
- void doneAnimating();
+ void onAnimationStarted(int remainingFrameCount);
+
+ /**
+ * The window has ended animating. See {@link #onAnimationStarted}.
+ */
+ void onAnimationStopped();
/**
* Called for non-application windows when the enter animation has completed.
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 57c6cbf..7c635b9 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -220,6 +220,9 @@
boolean mLastWasImTarget;
boolean mWindowsAnimating;
boolean mDrawDuringWindowsAnimating;
+
+ /** How many frames the app is still allowed to draw when a window animation is happening. */
+ private int mRemainingFrameCount;
boolean mIsDrawing;
int mLastSystemUiVisibility;
int mClientWindowLayoutFlags;
@@ -1569,10 +1572,6 @@
}
final int surfaceGenerationId = mSurface.getGenerationId();
relayoutResult = relayoutWindow(params, viewVisibility, insetsPending);
- if (!mDrawDuringWindowsAnimating &&
- (relayoutResult & WindowManagerGlobal.RELAYOUT_RES_ANIMATING) != 0) {
- mWindowsAnimating = true;
- }
if (DEBUG_LAYOUT) Log.v(TAG, "relayout: frame=" + frame.toShortString()
+ " overscan=" + mPendingOverscanInsets.toShortString()
@@ -1996,14 +1995,11 @@
+ mView.findFocus());
}
}
- if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_ANIMATING) != 0) {
- // The first time we relayout the window, if the system is
- // doing window animations, we want to hold of on any future
- // draws until the animation is done.
- mWindowsAnimating = true;
- }
} else if (mWindowsAnimating) {
- skipDraw = true;
+ if (mRemainingFrameCount <= 0) {
+ skipDraw = true;
+ }
+ mRemainingFrameCount--;
}
mFirst = false;
@@ -2018,7 +2014,6 @@
mLastWasImTarget = imTarget;
InputMethodManager imm = InputMethodManager.peekInstance();
if (imm != null && imTarget) {
- imm.startGettingWindowFocus(mView);
imm.onWindowFocus(mView, mView.findFocus(),
mWindowAttributes.softInputMode,
!mHasHadWindowFocus, mWindowAttributes.flags);
@@ -2800,7 +2795,7 @@
public void setDrawDuringWindowsAnimating(boolean value) {
mDrawDuringWindowsAnimating = value;
if (value) {
- handleDispatchDoneAnimating();
+ handleDispatchWindowAnimationStopped();
}
}
@@ -3152,11 +3147,12 @@
private final static int MSG_UPDATE_CONFIGURATION = 18;
private final static int MSG_PROCESS_INPUT_EVENTS = 19;
private final static int MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST = 21;
- private final static int MSG_DISPATCH_DONE_ANIMATING = 22;
- private final static int MSG_INVALIDATE_WORLD = 23;
- private final static int MSG_WINDOW_MOVED = 24;
- private final static int MSG_SYNTHESIZE_INPUT_EVENT = 25;
- private final static int MSG_DISPATCH_WINDOW_SHOWN = 26;
+ private final static int MSG_INVALIDATE_WORLD = 22;
+ private final static int MSG_WINDOW_MOVED = 23;
+ private final static int MSG_SYNTHESIZE_INPUT_EVENT = 24;
+ private final static int MSG_DISPATCH_WINDOW_SHOWN = 25;
+ private final static int MSG_DISPATCH_WINDOW_ANIMATION_STOPPED = 26;
+ private final static int MSG_DISPATCH_WINDOW_ANIMATION_STARTED = 27;
final class ViewRootHandler extends Handler {
@Override
@@ -3200,8 +3196,10 @@
return "MSG_PROCESS_INPUT_EVENTS";
case MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST:
return "MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST";
- case MSG_DISPATCH_DONE_ANIMATING:
- return "MSG_DISPATCH_DONE_ANIMATING";
+ case MSG_DISPATCH_WINDOW_ANIMATION_STARTED:
+ return "MSG_DISPATCH_WINDOW_ANIMATION_STARTED";
+ case MSG_DISPATCH_WINDOW_ANIMATION_STOPPED:
+ return "MSG_DISPATCH_WINDOW_ANIMATION_STOPPED";
case MSG_WINDOW_MOVED:
return "MSG_WINDOW_MOVED";
case MSG_SYNTHESIZE_INPUT_EVENT:
@@ -3322,10 +3320,6 @@
InputMethodManager imm = InputMethodManager.peekInstance();
if (mView != null) {
- if (hasWindowFocus && imm != null && mLastWasImTarget &&
- !isInLocalFocusMode()) {
- imm.startGettingWindowFocus(mView);
- }
mAttachInfo.mKeyDispatchState.reset();
mView.dispatchWindowFocusChanged(hasWindowFocus);
mAttachInfo.mTreeObserver.dispatchOnWindowFocusChange(hasWindowFocus);
@@ -3421,8 +3415,12 @@
case MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST: {
setAccessibilityFocus(null, null);
} break;
- case MSG_DISPATCH_DONE_ANIMATING: {
- handleDispatchDoneAnimating();
+ case MSG_DISPATCH_WINDOW_ANIMATION_STARTED: {
+ int remainingFrameCount = msg.arg1;
+ handleDispatchWindowAnimationStarted(remainingFrameCount);
+ } break;
+ case MSG_DISPATCH_WINDOW_ANIMATION_STOPPED: {
+ handleDispatchWindowAnimationStopped();
} break;
case MSG_INVALIDATE_WORLD: {
if (mView != null) {
@@ -4038,7 +4036,7 @@
} else {
// If delivering a new non-key event, make sure the window is
// now allowed to start updating.
- handleDispatchDoneAnimating();
+ handleDispatchWindowAnimationStopped();
final int source = q.mEvent.getSource();
if ((source & InputDevice.SOURCE_CLASS_POINTER) != 0) {
return processPointerEvent(q);
@@ -4068,7 +4066,7 @@
if (event.getAction() != KeyEvent.ACTION_UP) {
// If delivering a new key event, make sure the window is
// now allowed to start updating.
- handleDispatchDoneAnimating();
+ handleDispatchWindowAnimationStopped();
}
// Deliver the key to the view hierarchy.
@@ -5285,7 +5283,14 @@
}
}
- public void handleDispatchDoneAnimating() {
+ public void handleDispatchWindowAnimationStarted(int remainingFrameCount) {
+ if (!mDrawDuringWindowsAnimating) {
+ mRemainingFrameCount = remainingFrameCount;
+ mWindowsAnimating = true;
+ }
+ }
+
+ public void handleDispatchWindowAnimationStopped() {
if (mWindowsAnimating) {
mWindowsAnimating = false;
if (!mDirty.isEmpty() || mIsAnimating || mFullRedrawNeeded) {
@@ -6189,8 +6194,13 @@
mHandler.sendMessage(mHandler.obtainMessage(MSG_DISPATCH_SYSTEM_UI_VISIBILITY, args));
}
- public void dispatchDoneAnimating() {
- mHandler.sendEmptyMessage(MSG_DISPATCH_DONE_ANIMATING);
+ public void dispatchWindowAnimationStarted(int remainingFrameCount) {
+ mHandler.obtainMessage(MSG_DISPATCH_WINDOW_ANIMATION_STARTED,
+ remainingFrameCount, 0 /* unused */).sendToTarget();
+ }
+
+ public void dispatchWindowAnimationStopped() {
+ mHandler.sendEmptyMessage(MSG_DISPATCH_WINDOW_ANIMATION_STOPPED);
}
public void dispatchCheckFocus() {
@@ -6713,10 +6723,18 @@
}
@Override
- public void doneAnimating() {
+ public void onAnimationStarted(int remainingFrameCount) {
final ViewRootImpl viewAncestor = mViewAncestor.get();
if (viewAncestor != null) {
- viewAncestor.dispatchDoneAnimating();
+ viewAncestor.dispatchWindowAnimationStarted(remainingFrameCount);
+ }
+ }
+
+ @Override
+ public void onAnimationStopped() {
+ final ViewRootImpl viewAncestor = mViewAncestor.get();
+ if (viewAncestor != null) {
+ viewAncestor.dispatchWindowAnimationStopped();
}
}
diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java
index e7a7ba8..c16578e 100644
--- a/core/java/android/view/WindowManagerGlobal.java
+++ b/core/java/android/view/WindowManagerGlobal.java
@@ -69,12 +69,6 @@
public static final int RELAYOUT_RES_SURFACE_CHANGED = 0x4;
/**
- * The window manager is currently animating. It will call
- * IWindow.doneAnimating() when done.
- */
- public static final int RELAYOUT_RES_ANIMATING = 0x8;
-
- /**
* Flag for relayout: the client will be later giving
* internal insets; as a result, the window will not impact other window
* layouts until the insets are given.
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index 568e160..1fb791c 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -281,12 +281,7 @@
boolean mFullscreenMode;
// -----------------------------------------------------------
-
- /**
- * This is the root view of the overall window that currently has input
- * method focus.
- */
- View mCurRootView;
+
/**
* This is the view that should currently be served by an input method,
* regardless of the state of setting that up.
@@ -806,7 +801,6 @@
* Disconnect any existing input connection, clearing the served view.
*/
void finishInputLocked() {
- mCurRootView = null;
mNextServedView = null;
if (mServedView != null) {
if (DEBUG) Log.v(TAG, "FINISH INPUT: " + mServedView);
@@ -1290,10 +1284,9 @@
void focusInLocked(View view) {
if (DEBUG) Log.v(TAG, "focusIn: " + view);
- if (mCurRootView != view.getRootView()) {
- // This is a request from a window that isn't in the window with
- // IME focus, so ignore it.
- if (DEBUG) Log.v(TAG, "Not IME target window, ignoring");
+ if (!view.hasWindowFocus()) {
+ // This is a request from a window that doesn't have window focus, so ignore it.
+ if (DEBUG) Log.v(TAG, "Not focused window, ignoring");
return;
}
@@ -1310,16 +1303,9 @@
if (DEBUG) Log.v(TAG, "focusOut: " + view
+ " mServedView=" + mServedView
+ " winFocus=" + view.hasWindowFocus());
- if (mServedView != view) {
- // The following code would auto-hide the IME if we end up
- // with no more views with focus. This can happen, however,
- // whenever we go into touch mode, so it ends up hiding
- // at times when we don't really want it to. For now it
- // seems better to just turn it all off.
- if (false && view.hasWindowFocus()) {
- mNextServedView = null;
- scheduleCheckFocusLocked(view);
- }
+ if (mServedView == view && view.hasWindowFocus()) {
+ mNextServedView = null;
+ scheduleCheckFocusLocked(view);
}
}
}
@@ -1442,13 +1428,6 @@
}
}
- /** @hide */
- public void startGettingWindowFocus(View rootView) {
- synchronized (mH) {
- mCurRootView = rootView;
- }
- }
-
/**
* Report the current selection range.
*
@@ -2156,7 +2135,6 @@
+ " mBindSequence=" + mBindSequence
+ " mCurId=" + mCurId);
p.println(" mCurMethod=" + mCurMethod);
- p.println(" mCurRootView=" + mCurRootView);
p.println(" mServedView=" + mServedView);
p.println(" mNextServedView=" + mNextServedView);
p.println(" mServedConnecting=" + mServedConnecting);
diff --git a/core/java/android/webkit/FindActionModeCallback.java b/core/java/android/webkit/FindActionModeCallback.java
index ab6a2f9..6fef2d6 100644
--- a/core/java/android/webkit/FindActionModeCallback.java
+++ b/core/java/android/webkit/FindActionModeCallback.java
@@ -154,7 +154,6 @@
}
public void showSoftInput() {
- mInput.startGettingWindowFocus(mEditText.getRootView());
mInput.focusIn(mEditText);
mInput.showSoftInput(mEditText, 0);
}
diff --git a/core/java/android/webkit/WebMessagePort.java b/core/java/android/webkit/WebMessagePort.java
index eab27bd..5f33c7b 100644
--- a/core/java/android/webkit/WebMessagePort.java
+++ b/core/java/android/webkit/WebMessagePort.java
@@ -16,12 +16,13 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.os.Handler;
/**
- * The Java representation of the HTML5 Message Port. See
- * https://html.spec.whatwg.org/multipage/comms.html#messageport
- * for definition of MessagePort in HTML5.
+ * The Java representation of the
+ * <a href="https://html.spec.whatwg.org/multipage/comms.html#messageport">
+ * HTML5 message ports.</a>
*
* A Message port represents one endpoint of a Message Channel. In Android
* webview, there is no separate Message Channel object. When a message channel
@@ -32,6 +33,19 @@
* When a message port is first created or received via transfer, it does not
* have a WebMessageCallback to receive web messages. The messages are queued until
* a WebMessageCallback is set.
+ *
+ * A message port should be closed when it is not used by the embedder application
+ * anymore. A closed port cannot be transferred or cannot be reopened to send
+ * messages. Close can be called multiple times.
+ *
+ * When a port is transferred to JS, it cannot be used to send or receive messages
+ * at the Java side anymore. Different from HTML5 Spec, a port cannot be transferred
+ * if one of these has ever happened: i. a message callback was set, ii. a message was
+ * posted on it. A transferred port cannot be closed by the application, since
+ * the ownership is also transferred.
+ *
+ * It is possible to transfer both ports of a channel to JS, for example for
+ * communication between subframes.
*/
public abstract class WebMessagePort {
@@ -55,6 +69,13 @@
}
/**
+ * Constructor.
+ * @hide
+ */
+ @SystemApi
+ public WebMessagePort() { }
+
+ /**
* Post a WebMessage to the entangled port.
*
* @param message the message from Java to JS.
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 453e4f5..cfa347f 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -1340,11 +1340,13 @@
* offscreen but attached to a window. Turning this on can avoid
* rendering artifacts when animating an offscreen WebView on-screen.
* Offscreen WebViews in this mode use more memory. The default value is
- * false.
+ * false.<br>
* Please follow these guidelines to limit memory usage:
- * - WebView size should be not be larger than the device screen size.
- * - Limit use of this mode to a small number of WebViews. Use it for
+ * <ul>
+ * <li> WebView size should be not be larger than the device screen size.
+ * <li> Limit use of this mode to a small number of WebViews. Use it for
* visible WebViews and WebViews about to be animated to visible.
+ * </ul>
*/
public abstract void setOffscreenPreRaster(boolean enabled);
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index f990e41..92615f3 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1838,8 +1838,9 @@
/**
* Creates a message channel to communicate with JS and returns the message
* ports that represent the endpoints of this message channel. The HTML5 message
- * channel functionality is described here:
- * https://html.spec.whatwg.org/multipage/comms.html#messagechannel
+ * channel functionality is described
+ * <a href="https://html.spec.whatwg.org/multipage/comms.html#messagechannel">here
+ * </a>
*
* The returned message channels are entangled and already in started state.
*
@@ -1853,11 +1854,14 @@
/**
* Post a message to main frame. The embedded application can restrict the
* messages to a certain target origin. See
- * https://html.spec.whatwg.org/multipage/comms.html#posting-messages
- * for how target origin can be used.
+ * <a href="https://html.spec.whatwg.org/multipage/comms.html#posting-messages">
+ * HTML5 spec</a> for how target origin can be used.
*
* @param message the WebMessage
- * @param targetOrigin the target origin.
+ * @param targetOrigin the target origin. This is the origin of the page
+ * that is intended to receive the message. For best security
+ * practices, the user should not specify a wildcard (*) when
+ * specifying the origin.
*/
public void postMessageToMainFrame(WebMessage message, Uri targetOrigin) {
checkThread();
diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java
index 993ab58..e27ba13 100644
--- a/core/java/com/android/internal/view/BaseIWindow.java
+++ b/core/java/com/android/internal/view/BaseIWindow.java
@@ -100,7 +100,11 @@
}
@Override
- public void doneAnimating() {
+ public void onAnimationStarted(int remainingFrameCount) {
+ }
+
+ @Override
+ public void onAnimationStopped() {
}
@Override
diff --git a/core/java/org/apache/http/conn/ssl/SSLSocketFactory.java b/core/java/org/apache/http/conn/ssl/SSLSocketFactory.java
index 4d53d40..250932b 100644
--- a/core/java/org/apache/http/conn/ssl/SSLSocketFactory.java
+++ b/core/java/org/apache/http/conn/ssl/SSLSocketFactory.java
@@ -329,6 +329,14 @@
sslsock.setSoTimeout(soTimeout);
try {
+ // BEGIN android-added
+ /*
+ * Make sure we have started the handshake before verifying.
+ * Otherwise when we go to the hostname verifier, it directly calls
+ * SSLSocket#getSession() which swallows SSL handshake errors.
+ */
+ sslsock.startHandshake();
+ // END android-added
hostnameVerifier.verify(host, sslsock);
// verifyHostName() didn't blowup - good!
} catch (IOException iox) {
@@ -389,6 +397,14 @@
port,
autoClose
);
+ // BEGIN android-added
+ /*
+ * Make sure we have started the handshake before verifying.
+ * Otherwise when we go to the hostname verifier, it directly calls
+ * SSLSocket#getSession() which swallows SSL handshake errors.
+ */
+ sslSocket.startHandshake();
+ // END android-added
hostnameVerifier.verify(host, sslSocket);
// verifyHostName() didn't blowup - good!
return sslSocket;
diff --git a/core/jni/android/opengl/util.cpp b/core/jni/android/opengl/util.cpp
index bce2b33..40029bb 100644
--- a/core/jni/android/opengl/util.cpp
+++ b/core/jni/android/opengl/util.cpp
@@ -150,7 +150,105 @@
return result;
}
-template<class JArray, class T>
+class ByteArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
+ return _env->GetByteArrayElements(array, is_copy);
+ }
+};
+class BooleanArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
+ return _env->GetBooleanArrayElements(array, is_copy);
+ }
+};
+class CharArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
+ return _env->GetCharArrayElements(array, is_copy);
+ }
+};
+class ShortArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
+ return _env->GetShortArrayElements(array, is_copy);
+ }
+};
+class IntArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
+ return _env->GetIntArrayElements(array, is_copy);
+ }
+};
+class LongArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
+ return _env->GetLongArrayElements(array, is_copy);
+ }
+};
+class FloatArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
+ return _env->GetFloatArrayElements(array, is_copy);
+ }
+};
+class DoubleArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
+ return _env->GetDoubleArrayElements(array, is_copy);
+ }
+};
+
+class ByteArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jint mode) {
+ _env->ReleaseByteArrayElements(array, data, mode);
+ }
+};
+class BooleanArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jint mode) {
+ _env->ReleaseBooleanArrayElements(array, data, mode);
+ }
+};
+class CharArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jcharArray array, jchar* data, jint mode) {
+ _env->ReleaseCharArrayElements(array, data, mode);
+ }
+};
+class ShortArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jshortArray array, jshort* data, jint mode) {
+ _env->ReleaseShortArrayElements(array, data, mode);
+ }
+};
+class IntArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jintArray array, jint* data, jint mode) {
+ _env->ReleaseIntArrayElements(array, data, mode);
+ }
+};
+class LongArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jlongArray array, jlong* data, jint mode) {
+ _env->ReleaseLongArrayElements(array, data, mode);
+ }
+};
+class FloatArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jint mode) {
+ _env->ReleaseFloatArrayElements(array, data, mode);
+ }
+};
+class DoubleArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jint mode) {
+ _env->ReleaseDoubleArrayElements(array, data, mode);
+ }
+};
+
+template<class JArray, class T, class ArrayGetter, class ArrayReleaser>
class ArrayHelper {
public:
ArrayHelper(JNIEnv* env, JArray ref, jint offset, jint minSize) {
@@ -164,7 +262,7 @@
~ArrayHelper() {
if (mBase) {
- mEnv->ReleasePrimitiveArrayCritical(mRef, mBase, mReleaseParam);
+ ArrayReleaser::Release(mEnv, mRef, mBase, mReleaseParam);
}
}
@@ -195,7 +293,7 @@
// Bind the array.
void bind() {
- mBase = (T*) mEnv->GetPrimitiveArrayCritical(mRef, (jboolean *) 0);
+ mBase = (T*) ArrayGetter::Get(mEnv, mRef, (jboolean *) 0);
mData = mBase + mOffset;
}
@@ -215,10 +313,10 @@
int mReleaseParam;
};
-typedef ArrayHelper<jfloatArray, float> FloatArrayHelper;
-typedef ArrayHelper<jcharArray, unsigned short> UnsignedShortArrayHelper;
-typedef ArrayHelper<jintArray, int> IntArrayHelper;
-typedef ArrayHelper<jbyteArray, unsigned char> ByteArrayHelper;
+typedef ArrayHelper<jfloatArray, float, FloatArrayGetter, FloatArrayReleaser> FloatArrayHelper;
+typedef ArrayHelper<jcharArray, unsigned short, CharArrayGetter, CharArrayReleaser> UnsignedShortArrayHelper;
+typedef ArrayHelper<jintArray, int, IntArrayGetter, IntArrayReleaser> IntArrayHelper;
+typedef ArrayHelper<jbyteArray, unsigned char, ByteArrayGetter, ByteArrayReleaser> ByteArrayHelper;
inline float distance2(float x, float y, float z) {
return x * x + y * y + z * z;
diff --git a/core/jni/android_opengl_EGL14.cpp b/core/jni/android_opengl_EGL14.cpp
index 36f7963..9f5b3bc 100644
--- a/core/jni/android_opengl_EGL14.cpp
+++ b/core/jni/android_opengl_EGL14.cpp
@@ -204,7 +204,7 @@
goto exit;
}
major_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(major_ref, (jboolean *)0);
+ _env->GetIntArrayElements(major_ref, (jboolean *)0);
major = major_base + majorOffset;
if (!minor_ref) {
@@ -227,7 +227,7 @@
goto exit;
}
minor_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(minor_ref, (jboolean *)0);
+ _env->GetIntArrayElements(minor_ref, (jboolean *)0);
minor = minor_base + minorOffset;
_returnValue = eglInitialize(
@@ -238,11 +238,11 @@
exit:
if (minor_base) {
- _env->ReleasePrimitiveArrayCritical(minor_ref, minor_base,
+ _env->ReleaseIntArrayElements(minor_ref, (jint*)minor_base,
_exception ? JNI_ABORT: 0);
}
if (major_base) {
- _env->ReleasePrimitiveArrayCritical(major_ref, major_base,
+ _env->ReleaseIntArrayElements(major_ref, (jint*)major_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -324,7 +324,7 @@
}
_num_configRemaining = _env->GetArrayLength(num_config_ref) - num_configOffset;
num_config_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(num_config_ref, (jboolean *)0);
+ _env->GetIntArrayElements(num_config_ref, (jboolean *)0);
num_config = num_config_base + num_configOffset;
_returnValue = eglGetConfigs(
@@ -336,7 +336,7 @@
exit:
if (num_config_base) {
- _env->ReleasePrimitiveArrayCritical(num_config_ref, num_config_base,
+ _env->ReleaseIntArrayElements(num_config_ref, (jint*)num_config_base,
_exception ? JNI_ABORT: 0);
}
if (configs) {
@@ -385,7 +385,7 @@
}
_attrib_listRemaining = _env->GetArrayLength(attrib_list_ref) - attrib_listOffset;
attrib_list_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0);
+ _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
attrib_list = attrib_list_base + attrib_listOffset;
attrib_list_sentinel = false;
for (int i = _attrib_listRemaining - 1; i >= 0; i--) {
@@ -442,7 +442,7 @@
goto exit;
}
num_config_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(num_config_ref, (jboolean *)0);
+ _env->GetIntArrayElements(num_config_ref, (jboolean *)0);
num_config = num_config_base + num_configOffset;
_returnValue = eglChooseConfig(
@@ -455,11 +455,11 @@
exit:
if (num_config_base) {
- _env->ReleasePrimitiveArrayCritical(num_config_ref, num_config_base,
+ _env->ReleaseIntArrayElements(num_config_ref, (jint*)num_config_base,
_exception ? JNI_ABORT: 0);
}
if (attrib_list_base) {
- _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base,
+ _env->ReleaseIntArrayElements(attrib_list_ref, (jint*)attrib_list_base,
JNI_ABORT);
}
if (configs) {
@@ -509,7 +509,7 @@
goto exit;
}
value_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
_returnValue = eglGetConfigAttrib(
@@ -521,7 +521,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -573,7 +573,7 @@
_remaining = _env->GetArrayLength(attrib_list_ref) - offset;
attrib_list_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0);
+ _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
attrib_list = attrib_list_base + offset;
attrib_list_sentinel = 0;
for (int i = _remaining - 1; i >= 0; i--) {
@@ -598,7 +598,7 @@
exit:
if (attrib_list_base) {
- _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base,
+ _env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base,
JNI_ABORT);
}
if (_exception) {
@@ -655,7 +655,7 @@
_remaining = _env->GetArrayLength(attrib_list_ref) - offset;
attrib_list_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0);
+ _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
attrib_list = attrib_list_base + offset;
attrib_list_sentinel = 0;
for (int i = _remaining - 1; i >= 0; i--) {
@@ -680,7 +680,7 @@
exit:
if (attrib_list_base) {
- _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base,
+ _env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base,
JNI_ABORT);
}
if (_exception) {
@@ -717,7 +717,7 @@
}
_remaining = _env->GetArrayLength(attrib_list_ref) - offset;
attrib_list_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0);
+ _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
attrib_list = attrib_list_base + offset;
attrib_list_sentinel = false;
for (int i = _remaining - 1; i >= 0; i--) {
@@ -741,7 +741,7 @@
exit:
if (attrib_list_base) {
- _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base,
+ _env->ReleaseIntArrayElements(attrib_list_ref, (jint*)attrib_list_base,
JNI_ABORT);
}
if (_exception) {
@@ -808,7 +808,7 @@
goto exit;
}
value_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
_returnValue = eglQuerySurface(
@@ -820,7 +820,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -896,7 +896,7 @@
}
_remaining = _env->GetArrayLength(attrib_list_ref) - offset;
attrib_list_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0);
+ _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
attrib_list = attrib_list_base + offset;
attrib_list_sentinel = false;
for (int i = _remaining - 1; i >= 0; i--) {
@@ -922,7 +922,7 @@
exit:
if (attrib_list_base) {
- _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base,
+ _env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base,
JNI_ABORT);
}
if (_exception) {
@@ -940,7 +940,6 @@
}
return android_eglCreatePbufferFromClientBuffer(_env, _this, dpy, buftype, buffer, config, attrib_list_ref, offset);
}
-
/* EGLBoolean eglSurfaceAttrib ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value ) */
static jboolean
android_eglSurfaceAttrib
@@ -1034,7 +1033,7 @@
}
_remaining = _env->GetArrayLength(attrib_list_ref) - offset;
attrib_list_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0);
+ _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
attrib_list = attrib_list_base + offset;
attrib_list_sentinel = false;
for (int i = _remaining - 1; i >= 0; i--) {
@@ -1059,7 +1058,7 @@
exit:
if (attrib_list_base) {
- _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base,
+ _env->ReleaseIntArrayElements(attrib_list_ref, (jint*)attrib_list_base,
JNI_ABORT);
}
if (_exception) {
@@ -1165,7 +1164,7 @@
goto exit;
}
value_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
_returnValue = eglQueryContext(
@@ -1177,7 +1176,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
diff --git a/core/jni/android_opengl_GLES10.cpp b/core/jni/android_opengl_GLES10.cpp
index c9b68bf..dac98de 100644
--- a/core/jni/android_opengl_GLES10.cpp
+++ b/core/jni/android_opengl_GLES10.cpp
@@ -126,6 +126,116 @@
return NULL;
}
+class ByteArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
+ return _env->GetByteArrayElements(array, is_copy);
+ }
+};
+class BooleanArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
+ return _env->GetBooleanArrayElements(array, is_copy);
+ }
+};
+class CharArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
+ return _env->GetCharArrayElements(array, is_copy);
+ }
+};
+class ShortArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
+ return _env->GetShortArrayElements(array, is_copy);
+ }
+};
+class IntArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
+ return _env->GetIntArrayElements(array, is_copy);
+ }
+};
+class LongArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
+ return _env->GetLongArrayElements(array, is_copy);
+ }
+};
+class FloatArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
+ return _env->GetFloatArrayElements(array, is_copy);
+ }
+};
+class DoubleArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
+ return _env->GetDoubleArrayElements(array, is_copy);
+ }
+};
+
+template<typename JTYPEARRAY, typename ARRAYGETTER>
+static void*
+getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
+ return ARRAYGETTER::Get(_env, array, is_copy);
+}
+
+class ByteArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
+ _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class BooleanArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
+ _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class CharArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
+ _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class ShortArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
+ _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class IntArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
+ _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class LongArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
+ _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class FloatArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
+ _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class DoubleArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
+ _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+
+template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
+static void
+releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
+ ARRAYRELEASER::Release(_env, array, data, commit);
+}
+
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -229,7 +339,8 @@
return needed;
}
-template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
static void
get
(JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
@@ -264,8 +375,8 @@
_exceptionMessage = "length - offset < needed";
goto exit;
}
- params_base = (CTYPE *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, params_ref, (jboolean *)0);
params = params_base + offset;
GET(
@@ -275,8 +386,8 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
- _exception ? JNI_ABORT: 0);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, params_ref, params_base, !_exception);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -284,20 +395,21 @@
}
-template <typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
static void
getarray
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
jint _exception = 0;
const char * _exceptionType;
const char * _exceptionMessage;
- jarray _array = (jarray) 0;
+ JTYPEARRAY _array = (JTYPEARRAY) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
CTYPE *params = (CTYPE *) 0;
int _needed = 0;
- params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
_remaining /= sizeof(CTYPE); // convert from bytes to item count
_needed = getNeededCount(pname);
// if we didn't find this pname, we just assume the user passed
@@ -310,7 +422,8 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, _array, (jboolean *) 0);
params = (CTYPE *) (_paramsBase + _bufferOffset);
}
GET(
@@ -320,7 +433,8 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -515,7 +629,7 @@
jint _remaining;
GLvoid *data = (GLvoid *) 0;
- data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (data == NULL) {
char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
data = (GLvoid *) (_dataBase + _bufferOffset);
@@ -544,7 +658,7 @@
jint _remaining;
GLvoid *data = (GLvoid *) 0;
- data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (data == NULL) {
char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
data = (GLvoid *) (_dataBase + _bufferOffset);
@@ -637,7 +751,7 @@
goto exit;
}
textures_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
+ _env->GetIntArrayElements(textures_ref, (jboolean *)0);
textures = textures_base + offset;
glDeleteTextures(
@@ -647,7 +761,7 @@
exit:
if (textures_base) {
- _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
+ _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
JNI_ABORT);
}
if (_exception) {
@@ -662,12 +776,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *textures = (GLuint *) 0;
- textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
+ textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -675,7 +789,7 @@
goto exit;
}
if (textures == NULL) {
- char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
textures = (GLuint *) (_texturesBase + _bufferOffset);
}
glDeleteTextures(
@@ -685,7 +799,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, textures, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)textures, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -771,7 +885,7 @@
jint _remaining;
GLvoid *indices = (GLvoid *) 0;
- indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset);
+ indices = (GLvoid *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < count) {
_exception = 1;
_exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
@@ -882,7 +996,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glFogfv(
@@ -892,7 +1006,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -907,12 +1021,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_FOG_COLOR)
@@ -931,7 +1045,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glFogfv(
@@ -941,7 +1055,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1000,7 +1114,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glFogxv(
@@ -1010,7 +1124,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -1025,12 +1139,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_FOG_COLOR)
@@ -1049,7 +1163,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glFogxv(
@@ -1059,7 +1173,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1134,7 +1248,7 @@
goto exit;
}
textures_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
+ _env->GetIntArrayElements(textures_ref, (jboolean *)0);
textures = textures_base + offset;
glGenTextures(
@@ -1144,7 +1258,7 @@
exit:
if (textures_base) {
- _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
+ _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1159,12 +1273,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *textures = (GLuint *) 0;
- textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
+ textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -1172,7 +1286,7 @@
goto exit;
}
if (textures == NULL) {
- char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
textures = (GLuint *) (_texturesBase + _bufferOffset);
}
glGenTextures(
@@ -1182,7 +1296,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)textures, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1202,16 +1316,17 @@
static void
android_glGetIntegerv__I_3II
(JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
- get<jintArray, GLint, glGetIntegerv>(_env, _this, pname, params_ref, offset);
+ get<jintArray, IntArrayGetter, jint*, IntArrayReleaser, GLint, glGetIntegerv>(
+ _env, _this, pname, params_ref, offset);
}
/* void glGetIntegerv ( GLenum pname, GLint *params ) */
static void
android_glGetIntegerv__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- getarray<GLint, glGetIntegerv>(_env, _this, pname, params_buf);
+ getarray<GLint, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetIntegerv>(
+ _env, _this, pname, params_buf);
}
-
/* const GLubyte * glGetString ( GLenum name ) */
static jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
const char* chars = (const char*) glGetString((GLenum) name);
@@ -1279,7 +1394,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glLightModelfv(
@@ -1289,7 +1404,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -1304,12 +1419,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_LIGHT_MODEL_AMBIENT)
@@ -1328,7 +1443,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glLightModelfv(
@@ -1338,7 +1453,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1397,7 +1512,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glLightModelxv(
@@ -1407,7 +1522,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -1422,12 +1537,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_LIGHT_MODEL_AMBIENT)
@@ -1446,7 +1561,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glLightModelxv(
@@ -1456,7 +1571,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1530,7 +1645,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glLightfv(
@@ -1541,7 +1656,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -1556,12 +1671,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_SPOT_DIRECTION)
@@ -1594,7 +1709,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glLightfv(
@@ -1605,7 +1720,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1679,7 +1794,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glLightxv(
@@ -1690,7 +1805,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -1705,12 +1820,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_SPOT_DIRECTION)
@@ -1743,7 +1858,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glLightxv(
@@ -1754,7 +1869,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1811,7 +1926,7 @@
}
_remaining = _env->GetArrayLength(m_ref) - offset;
m_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(m_ref, (jboolean *)0);
m = m_base + offset;
glLoadMatrixf(
@@ -1820,7 +1935,7 @@
exit:
if (m_base) {
- _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+ _env->ReleaseFloatArrayElements(m_ref, (jfloat*)m_base,
JNI_ABORT);
}
if (_exception) {
@@ -1832,21 +1947,21 @@
static void
android_glLoadMatrixf__Ljava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jobject m_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *m = (GLfloat *) 0;
- m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
+ m = (GLfloat *)getPointer(_env, m_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (m == NULL) {
- char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _mBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
m = (GLfloat *) (_mBase + _bufferOffset);
}
glLoadMatrixf(
(GLfloat *)m
);
if (_array) {
- releasePointer(_env, _array, m, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)m, JNI_ABORT);
}
}
@@ -1875,7 +1990,7 @@
}
_remaining = _env->GetArrayLength(m_ref) - offset;
m_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+ _env->GetIntArrayElements(m_ref, (jboolean *)0);
m = m_base + offset;
glLoadMatrixx(
@@ -1884,7 +1999,7 @@
exit:
if (m_base) {
- _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+ _env->ReleaseIntArrayElements(m_ref, (jint*)m_base,
JNI_ABORT);
}
if (_exception) {
@@ -1896,21 +2011,21 @@
static void
android_glLoadMatrixx__Ljava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jobject m_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *m = (GLfixed *) 0;
- m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
+ m = (GLfixed *)getPointer(_env, m_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (m == NULL) {
- char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _mBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
m = (GLfixed *) (_mBase + _bufferOffset);
}
glLoadMatrixx(
(GLfixed *)m
);
if (_array) {
- releasePointer(_env, _array, m, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)m, JNI_ABORT);
}
}
@@ -1988,7 +2103,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glMaterialfv(
@@ -1999,7 +2114,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2014,12 +2129,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_AMBIENT)
@@ -2050,7 +2165,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glMaterialfv(
@@ -2061,7 +2176,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2133,7 +2248,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glMaterialxv(
@@ -2144,7 +2259,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2159,12 +2274,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_AMBIENT)
@@ -2195,7 +2310,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glMaterialxv(
@@ -2206,7 +2321,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2247,7 +2362,7 @@
}
_remaining = _env->GetArrayLength(m_ref) - offset;
m_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(m_ref, (jboolean *)0);
m = m_base + offset;
glMultMatrixf(
@@ -2256,7 +2371,7 @@
exit:
if (m_base) {
- _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+ _env->ReleaseFloatArrayElements(m_ref, (jfloat*)m_base,
JNI_ABORT);
}
if (_exception) {
@@ -2268,21 +2383,21 @@
static void
android_glMultMatrixf__Ljava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jobject m_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *m = (GLfloat *) 0;
- m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
+ m = (GLfloat *)getPointer(_env, m_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (m == NULL) {
- char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _mBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
m = (GLfloat *) (_mBase + _bufferOffset);
}
glMultMatrixf(
(GLfloat *)m
);
if (_array) {
- releasePointer(_env, _array, m, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)m, JNI_ABORT);
}
}
@@ -2311,7 +2426,7 @@
}
_remaining = _env->GetArrayLength(m_ref) - offset;
m_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+ _env->GetIntArrayElements(m_ref, (jboolean *)0);
m = m_base + offset;
glMultMatrixx(
@@ -2320,7 +2435,7 @@
exit:
if (m_base) {
- _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+ _env->ReleaseIntArrayElements(m_ref, (jint*)m_base,
JNI_ABORT);
}
if (_exception) {
@@ -2332,21 +2447,21 @@
static void
android_glMultMatrixx__Ljava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jobject m_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *m = (GLfixed *) 0;
- m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
+ m = (GLfixed *)getPointer(_env, m_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (m == NULL) {
- char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _mBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
m = (GLfixed *) (_mBase + _bufferOffset);
}
glMultMatrixx(
(GLfixed *)m
);
if (_array) {
- releasePointer(_env, _array, m, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)m, JNI_ABORT);
}
}
@@ -2520,7 +2635,7 @@
jint _remaining;
GLvoid *pixels = (GLvoid *) 0;
- pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
+ pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (pixels == NULL) {
char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
@@ -2734,7 +2849,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexEnvfv(
@@ -2745,7 +2860,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2760,12 +2875,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_TEXTURE_ENV_COLOR)
@@ -2784,7 +2899,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glTexEnvfv(
@@ -2795,7 +2910,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2855,7 +2970,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexEnvxv(
@@ -2866,7 +2981,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2881,12 +2996,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_TEXTURE_ENV_COLOR)
@@ -2905,7 +3020,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glTexEnvxv(
@@ -2916,7 +3031,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2933,7 +3048,7 @@
GLvoid *pixels = (GLvoid *) 0;
if (pixels_buf) {
- pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
+ pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
}
if (pixels_buf && pixels == NULL) {
char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
@@ -2987,7 +3102,7 @@
GLvoid *pixels = (GLvoid *) 0;
if (pixels_buf) {
- pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
+ pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
}
if (pixels_buf && pixels == NULL) {
char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
diff --git a/core/jni/android_opengl_GLES10Ext.cpp b/core/jni/android_opengl_GLES10Ext.cpp
index 4f1eaa5..95be11b 100644
--- a/core/jni/android_opengl_GLES10Ext.cpp
+++ b/core/jni/android_opengl_GLES10Ext.cpp
@@ -126,6 +126,116 @@
return NULL;
}
+class ByteArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
+ return _env->GetByteArrayElements(array, is_copy);
+ }
+};
+class BooleanArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
+ return _env->GetBooleanArrayElements(array, is_copy);
+ }
+};
+class CharArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
+ return _env->GetCharArrayElements(array, is_copy);
+ }
+};
+class ShortArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
+ return _env->GetShortArrayElements(array, is_copy);
+ }
+};
+class IntArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
+ return _env->GetIntArrayElements(array, is_copy);
+ }
+};
+class LongArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
+ return _env->GetLongArrayElements(array, is_copy);
+ }
+};
+class FloatArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
+ return _env->GetFloatArrayElements(array, is_copy);
+ }
+};
+class DoubleArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
+ return _env->GetDoubleArrayElements(array, is_copy);
+ }
+};
+
+template<typename JTYPEARRAY, typename ARRAYGETTER>
+static void*
+getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
+ return ARRAYGETTER::Get(_env, array, is_copy);
+}
+
+class ByteArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
+ _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class BooleanArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
+ _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class CharArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
+ _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class ShortArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
+ _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class IntArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
+ _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class LongArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
+ _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class FloatArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
+ _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class DoubleArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
+ _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+
+template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
+static void
+releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
+ ARRAYRELEASER::Release(_env, array, data, commit);
+}
+
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -229,7 +339,8 @@
return needed;
}
-template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
static void
get
(JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
@@ -264,8 +375,8 @@
_exceptionMessage = "length - offset < needed";
goto exit;
}
- params_base = (CTYPE *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, params_ref, (jboolean *)0);
params = params_base + offset;
GET(
@@ -275,8 +386,8 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
- _exception ? JNI_ABORT: 0);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, params_ref, params_base, !_exception);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -284,20 +395,21 @@
}
-template <typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
static void
getarray
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
jint _exception = 0;
const char * _exceptionType;
const char * _exceptionMessage;
- jarray _array = (jarray) 0;
+ JTYPEARRAY _array = (JTYPEARRAY) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
CTYPE *params = (CTYPE *) 0;
int _needed = 0;
- params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
_remaining /= sizeof(CTYPE); // convert from bytes to item count
_needed = getNeededCount(pname);
// if we didn't find this pname, we just assume the user passed
@@ -310,7 +422,8 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, _array, (jboolean *) 0);
params = (CTYPE *) (_paramsBase + _bufferOffset);
}
GET(
@@ -320,7 +433,8 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -363,7 +477,7 @@
goto exit;
}
mantissa_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(mantissa_ref, (jboolean *)0);
+ _env->GetIntArrayElements(mantissa_ref, (jboolean *)0);
mantissa = mantissa_base + mantissaOffset;
if (!exponent_ref) {
@@ -386,7 +500,7 @@
goto exit;
}
exponent_base = (GLint *)
- _env->GetPrimitiveArrayCritical(exponent_ref, (jboolean *)0);
+ _env->GetIntArrayElements(exponent_ref, (jboolean *)0);
exponent = exponent_base + exponentOffset;
_returnValue = glQueryMatrixxOES(
@@ -396,11 +510,11 @@
exit:
if (exponent_base) {
- _env->ReleasePrimitiveArrayCritical(exponent_ref, exponent_base,
+ _env->ReleaseIntArrayElements(exponent_ref, (jint*)exponent_base,
_exception ? JNI_ABORT: 0);
}
if (mantissa_base) {
- _env->ReleasePrimitiveArrayCritical(mantissa_ref, mantissa_base,
+ _env->ReleaseIntArrayElements(mantissa_ref, (jint*)mantissa_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -416,9 +530,9 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _mantissaArray = (jarray) 0;
+ jintArray _mantissaArray = (jintArray) 0;
jint _mantissaBufferOffset = (jint) 0;
- jarray _exponentArray = (jarray) 0;
+ jintArray _exponentArray = (jintArray) 0;
jint _exponentBufferOffset = (jint) 0;
GLbitfield _returnValue = -1;
jint _mantissaRemaining;
@@ -426,14 +540,14 @@
jint _exponentRemaining;
GLint *exponent = (GLint *) 0;
- mantissa = (GLfixed *)getPointer(_env, mantissa_buf, &_mantissaArray, &_mantissaRemaining, &_mantissaBufferOffset);
+ mantissa = (GLfixed *)getPointer(_env, mantissa_buf, (jarray*)&_mantissaArray, &_mantissaRemaining, &_mantissaBufferOffset);
if (_mantissaRemaining < 16) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
_exceptionMessage = "remaining() < 16 < needed";
goto exit;
}
- exponent = (GLint *)getPointer(_env, exponent_buf, &_exponentArray, &_exponentRemaining, &_exponentBufferOffset);
+ exponent = (GLint *)getPointer(_env, exponent_buf, (jarray*)&_exponentArray, &_exponentRemaining, &_exponentBufferOffset);
if (_exponentRemaining < 16) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -441,11 +555,11 @@
goto exit;
}
if (mantissa == NULL) {
- char * _mantissaBase = (char *)_env->GetPrimitiveArrayCritical(_mantissaArray, (jboolean *) 0);
+ char * _mantissaBase = (char *)_env->GetIntArrayElements(_mantissaArray, (jboolean *) 0);
mantissa = (GLfixed *) (_mantissaBase + _mantissaBufferOffset);
}
if (exponent == NULL) {
- char * _exponentBase = (char *)_env->GetPrimitiveArrayCritical(_exponentArray, (jboolean *) 0);
+ char * _exponentBase = (char *)_env->GetIntArrayElements(_exponentArray, (jboolean *) 0);
exponent = (GLint *) (_exponentBase + _exponentBufferOffset);
}
_returnValue = glQueryMatrixxOES(
@@ -455,10 +569,10 @@
exit:
if (_exponentArray) {
- releasePointer(_env, _exponentArray, exponent, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_exponentArray, (jint*)exponent, _exception ? JNI_ABORT : 0);
}
if (_mantissaArray) {
- releasePointer(_env, _mantissaArray, mantissa, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_mantissaArray, (jint*)mantissa, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
diff --git a/core/jni/android_opengl_GLES11.cpp b/core/jni/android_opengl_GLES11.cpp
index 08c4740..6970a3c 100644
--- a/core/jni/android_opengl_GLES11.cpp
+++ b/core/jni/android_opengl_GLES11.cpp
@@ -126,6 +126,116 @@
return NULL;
}
+class ByteArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
+ return _env->GetByteArrayElements(array, is_copy);
+ }
+};
+class BooleanArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
+ return _env->GetBooleanArrayElements(array, is_copy);
+ }
+};
+class CharArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
+ return _env->GetCharArrayElements(array, is_copy);
+ }
+};
+class ShortArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
+ return _env->GetShortArrayElements(array, is_copy);
+ }
+};
+class IntArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
+ return _env->GetIntArrayElements(array, is_copy);
+ }
+};
+class LongArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
+ return _env->GetLongArrayElements(array, is_copy);
+ }
+};
+class FloatArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
+ return _env->GetFloatArrayElements(array, is_copy);
+ }
+};
+class DoubleArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
+ return _env->GetDoubleArrayElements(array, is_copy);
+ }
+};
+
+template<typename JTYPEARRAY, typename ARRAYGETTER>
+static void*
+getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
+ return ARRAYGETTER::Get(_env, array, is_copy);
+}
+
+class ByteArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
+ _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class BooleanArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
+ _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class CharArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
+ _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class ShortArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
+ _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class IntArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
+ _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class LongArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
+ _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class FloatArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
+ _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class DoubleArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
+ _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+
+template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
+static void
+releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
+ ARRAYRELEASER::Release(_env, array, data, commit);
+}
+
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -229,7 +339,8 @@
return needed;
}
-template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
static void
get
(JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
@@ -264,8 +375,8 @@
_exceptionMessage = "length - offset < needed";
goto exit;
}
- params_base = (CTYPE *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, params_ref, (jboolean *)0);
params = params_base + offset;
GET(
@@ -275,8 +386,8 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
- _exception ? JNI_ABORT: 0);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, params_ref, params_base, !_exception);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -284,20 +395,21 @@
}
-template <typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
static void
getarray
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
jint _exception = 0;
const char * _exceptionType;
const char * _exceptionMessage;
- jarray _array = (jarray) 0;
+ JTYPEARRAY _array = (JTYPEARRAY) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
CTYPE *params = (CTYPE *) 0;
int _needed = 0;
- params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
_remaining /= sizeof(CTYPE); // convert from bytes to item count
_needed = getNeededCount(pname);
// if we didn't find this pname, we just assume the user passed
@@ -310,7 +422,8 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, _array, (jboolean *) 0);
params = (CTYPE *) (_paramsBase + _bufferOffset);
}
GET(
@@ -320,7 +433,8 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -351,7 +465,7 @@
GLvoid *data = (GLvoid *) 0;
if (data_buf) {
- data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < size) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -391,7 +505,7 @@
jint _remaining;
GLvoid *data = (GLvoid *) 0;
- data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < size) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -443,7 +557,7 @@
}
_remaining = _env->GetArrayLength(equation_ref) - offset;
equation_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(equation_ref, (jboolean *)0);
equation = equation_base + offset;
glClipPlanef(
@@ -453,7 +567,7 @@
exit:
if (equation_base) {
- _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
+ _env->ReleaseFloatArrayElements(equation_ref, (jfloat*)equation_base,
JNI_ABORT);
}
if (_exception) {
@@ -468,14 +582,14 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *equation = (GLfloat *) 0;
- equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset);
+ equation = (GLfloat *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (equation == NULL) {
- char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _equationBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
equation = (GLfloat *) (_equationBase + _bufferOffset);
}
glClipPlanef(
@@ -483,7 +597,7 @@
(GLfloat *)equation
);
if (_array) {
- releasePointer(_env, _array, equation, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)equation, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -515,7 +629,7 @@
}
_remaining = _env->GetArrayLength(equation_ref) - offset;
equation_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
+ _env->GetIntArrayElements(equation_ref, (jboolean *)0);
equation = equation_base + offset;
glClipPlanex(
@@ -525,7 +639,7 @@
exit:
if (equation_base) {
- _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
+ _env->ReleaseIntArrayElements(equation_ref, (jint*)equation_base,
JNI_ABORT);
}
if (_exception) {
@@ -540,14 +654,14 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *equation = (GLfixed *) 0;
- equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset);
+ equation = (GLfixed *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (equation == NULL) {
- char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _equationBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
equation = (GLfixed *) (_equationBase + _bufferOffset);
}
glClipPlanex(
@@ -555,7 +669,7 @@
(GLfixed *)equation
);
if (_array) {
- releasePointer(_env, _array, equation, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)equation, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -617,7 +731,7 @@
goto exit;
}
buffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
buffers = buffers_base + offset;
glDeleteBuffers(
@@ -627,7 +741,7 @@
exit:
if (buffers_base) {
- _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
+ _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
JNI_ABORT);
}
if (_exception) {
@@ -642,12 +756,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *buffers = (GLuint *) 0;
- buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
+ buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -655,7 +769,7 @@
goto exit;
}
if (buffers == NULL) {
- char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
buffers = (GLuint *) (_buffersBase + _bufferOffset);
}
glDeleteBuffers(
@@ -665,7 +779,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, buffers, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -721,7 +835,7 @@
goto exit;
}
buffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
buffers = buffers_base + offset;
glGenBuffers(
@@ -731,7 +845,7 @@
exit:
if (buffers_base) {
- _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
+ _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -746,12 +860,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *buffers = (GLuint *) 0;
- buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
+ buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -759,7 +873,7 @@
goto exit;
}
if (buffers == NULL) {
- char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
buffers = (GLuint *) (_buffersBase + _bufferOffset);
}
glGenBuffers(
@@ -769,7 +883,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -780,14 +894,16 @@
static void
android_glGetBooleanv__I_3ZI
(JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
- get<jbooleanArray, GLboolean, glGetBooleanv>(_env, _this, pname, params_ref, offset);
+ get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>(
+ _env, _this, pname, params_ref, offset);
}
/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
static void
android_glGetBooleanv__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- getarray<GLboolean, glGetBooleanv>(_env, _this, pname, params_buf);
+ getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>(
+ _env, _this, pname, params_buf);
}
/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
static void
@@ -820,7 +936,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetBufferParameteriv(
@@ -831,7 +947,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -846,12 +962,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -859,7 +975,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetBufferParameteriv(
@@ -870,7 +986,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -908,7 +1024,7 @@
goto exit;
}
eqn_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(eqn_ref, (jboolean *)0);
eqn = eqn_base + offset;
glGetClipPlanef(
@@ -918,7 +1034,7 @@
exit:
if (eqn_base) {
- _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
+ _env->ReleaseFloatArrayElements(eqn_ref, (jfloat*)eqn_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -933,12 +1049,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *eqn = (GLfloat *) 0;
- eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset);
+ eqn = (GLfloat *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 4) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -946,7 +1062,7 @@
goto exit;
}
if (eqn == NULL) {
- char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _eqnBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
eqn = (GLfloat *) (_eqnBase + _bufferOffset);
}
glGetClipPlanef(
@@ -956,7 +1072,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)eqn, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -994,7 +1110,7 @@
goto exit;
}
eqn_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
+ _env->GetIntArrayElements(eqn_ref, (jboolean *)0);
eqn = eqn_base + offset;
glGetClipPlanex(
@@ -1004,7 +1120,7 @@
exit:
if (eqn_base) {
- _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
+ _env->ReleaseIntArrayElements(eqn_ref, (jint*)eqn_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1019,12 +1135,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *eqn = (GLfixed *) 0;
- eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset);
+ eqn = (GLfixed *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 4) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -1032,7 +1148,7 @@
goto exit;
}
if (eqn == NULL) {
- char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _eqnBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
eqn = (GLfixed *) (_eqnBase + _bufferOffset);
}
glGetClipPlanex(
@@ -1042,7 +1158,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)eqn, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1074,7 +1190,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetFixedv(
@@ -1084,7 +1200,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1096,14 +1212,14 @@
static void
android_glGetFixedv__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetFixedv(
@@ -1111,7 +1227,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -1119,14 +1235,16 @@
static void
android_glGetFloatv__I_3FI
(JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
- get<jfloatArray, GLfloat, glGetFloatv>(_env, _this, pname, params_ref, offset);
+ get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>(
+ _env, _this, pname, params_ref, offset);
}
/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
static void
android_glGetFloatv__ILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- getarray<GLfloat, glGetFloatv>(_env, _this, pname, params_buf);
+ getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>(
+ _env, _this, pname, params_buf);
}
/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
static void
@@ -1184,7 +1302,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetLightfv(
@@ -1195,7 +1313,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1210,12 +1328,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_SPOT_DIRECTION)
@@ -1248,7 +1366,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetLightfv(
@@ -1259,7 +1377,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1322,7 +1440,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetLightxv(
@@ -1333,7 +1451,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1348,12 +1466,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_SPOT_DIRECTION)
@@ -1386,7 +1504,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetLightxv(
@@ -1397,7 +1515,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1458,7 +1576,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetMaterialfv(
@@ -1469,7 +1587,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1484,12 +1602,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_AMBIENT)
@@ -1520,7 +1638,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetMaterialfv(
@@ -1531,7 +1649,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1592,7 +1710,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetMaterialxv(
@@ -1603,7 +1721,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1618,12 +1736,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_AMBIENT)
@@ -1654,7 +1772,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetMaterialxv(
@@ -1665,7 +1783,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1714,7 +1832,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexEnvfv(
@@ -1725,7 +1843,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1740,12 +1858,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_TEXTURE_ENV_COLOR)
@@ -1764,7 +1882,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetTexEnvfv(
@@ -1775,7 +1893,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1824,7 +1942,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexEnviv(
@@ -1835,7 +1953,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1850,12 +1968,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_TEXTURE_ENV_COLOR)
@@ -1874,7 +1992,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetTexEnviv(
@@ -1885,7 +2003,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1934,7 +2052,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexEnvxv(
@@ -1945,7 +2063,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1960,12 +2078,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_TEXTURE_ENV_COLOR)
@@ -1984,7 +2102,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetTexEnvxv(
@@ -1995,7 +2113,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2033,7 +2151,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexParameterfv(
@@ -2044,7 +2162,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2059,12 +2177,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2072,7 +2190,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetTexParameterfv(
@@ -2083,7 +2201,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2121,7 +2239,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexParameteriv(
@@ -2132,7 +2250,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2147,12 +2265,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2160,7 +2278,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetTexParameteriv(
@@ -2171,7 +2289,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2209,7 +2327,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexParameterxv(
@@ -2220,7 +2338,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2235,12 +2353,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2248,7 +2366,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetTexParameterxv(
@@ -2259,7 +2377,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2351,7 +2469,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glPointParameterfv(
@@ -2361,7 +2479,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2376,12 +2494,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2389,7 +2507,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glPointParameterfv(
@@ -2399,7 +2517,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2447,7 +2565,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glPointParameterxv(
@@ -2457,7 +2575,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2472,12 +2590,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2485,7 +2603,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glPointParameterxv(
@@ -2495,7 +2613,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2590,7 +2708,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexEnviv(
@@ -2601,7 +2719,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2616,12 +2734,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_TEXTURE_ENV_COLOR)
@@ -2640,7 +2758,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glTexEnviv(
@@ -2651,7 +2769,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2689,7 +2807,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexParameterfv(
@@ -2700,7 +2818,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2715,12 +2833,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2728,7 +2846,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glTexParameterfv(
@@ -2739,7 +2857,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2788,7 +2906,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexParameteriv(
@@ -2799,7 +2917,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2814,12 +2932,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2827,7 +2945,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glTexParameteriv(
@@ -2838,7 +2956,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2876,7 +2994,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexParameterxv(
@@ -2887,7 +3005,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2902,12 +3020,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2915,7 +3033,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glTexParameterxv(
@@ -2926,7 +3044,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
diff --git a/core/jni/android_opengl_GLES11Ext.cpp b/core/jni/android_opengl_GLES11Ext.cpp
index 21e5670f..6422ff2 100644
--- a/core/jni/android_opengl_GLES11Ext.cpp
+++ b/core/jni/android_opengl_GLES11Ext.cpp
@@ -126,6 +126,116 @@
return NULL;
}
+class ByteArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
+ return _env->GetByteArrayElements(array, is_copy);
+ }
+};
+class BooleanArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
+ return _env->GetBooleanArrayElements(array, is_copy);
+ }
+};
+class CharArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
+ return _env->GetCharArrayElements(array, is_copy);
+ }
+};
+class ShortArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
+ return _env->GetShortArrayElements(array, is_copy);
+ }
+};
+class IntArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
+ return _env->GetIntArrayElements(array, is_copy);
+ }
+};
+class LongArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
+ return _env->GetLongArrayElements(array, is_copy);
+ }
+};
+class FloatArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
+ return _env->GetFloatArrayElements(array, is_copy);
+ }
+};
+class DoubleArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
+ return _env->GetDoubleArrayElements(array, is_copy);
+ }
+};
+
+template<typename JTYPEARRAY, typename ARRAYGETTER>
+static void*
+getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
+ return ARRAYGETTER::Get(_env, array, is_copy);
+}
+
+class ByteArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
+ _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class BooleanArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
+ _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class CharArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
+ _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class ShortArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
+ _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class IntArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
+ _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class LongArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
+ _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class FloatArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
+ _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class DoubleArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
+ _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+
+template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
+static void
+releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
+ ARRAYRELEASER::Release(_env, array, data, commit);
+}
+
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -229,7 +339,8 @@
return needed;
}
-template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
static void
get
(JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
@@ -264,8 +375,8 @@
_exceptionMessage = "length - offset < needed";
goto exit;
}
- params_base = (CTYPE *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, params_ref, (jboolean *)0);
params = params_base + offset;
GET(
@@ -275,8 +386,8 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
- _exception ? JNI_ABORT: 0);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, params_ref, params_base, !_exception);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -284,20 +395,21 @@
}
-template <typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
static void
getarray
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
jint _exception = 0;
const char * _exceptionType;
const char * _exceptionMessage;
- jarray _array = (jarray) 0;
+ JTYPEARRAY _array = (JTYPEARRAY) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
CTYPE *params = (CTYPE *) 0;
int _needed = 0;
- params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
_remaining /= sizeof(CTYPE); // convert from bytes to item count
_needed = getNeededCount(pname);
// if we didn't find this pname, we just assume the user passed
@@ -310,7 +422,8 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, _array, (jboolean *) 0);
params = (CTYPE *) (_paramsBase + _bufferOffset);
}
GET(
@@ -320,7 +433,8 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -429,7 +543,7 @@
goto exit;
}
coords_base = (GLshort *)
- _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0);
+ _env->GetShortArrayElements(coords_ref, (jboolean *)0);
coords = coords_base + offset;
glDrawTexsvOES(
@@ -438,7 +552,7 @@
exit:
if (coords_base) {
- _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base,
+ _env->ReleaseShortArrayElements(coords_ref, (jshort*)coords_base,
JNI_ABORT);
}
if (_exception) {
@@ -453,12 +567,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jshortArray _array = (jshortArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLshort *coords = (GLshort *) 0;
- coords = (GLshort *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset);
+ coords = (GLshort *)getPointer(_env, coords_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 5) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -466,7 +580,7 @@
goto exit;
}
if (coords == NULL) {
- char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _coordsBase = (char *)_env->GetShortArrayElements(_array, (jboolean *) 0);
coords = (GLshort *) (_coordsBase + _bufferOffset);
}
glDrawTexsvOES(
@@ -475,7 +589,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, coords, JNI_FALSE);
+ _env->ReleaseShortArrayElements(_array, (jshort*)coords, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -513,7 +627,7 @@
goto exit;
}
coords_base = (GLint *)
- _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0);
+ _env->GetIntArrayElements(coords_ref, (jboolean *)0);
coords = coords_base + offset;
glDrawTexivOES(
@@ -522,7 +636,7 @@
exit:
if (coords_base) {
- _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base,
+ _env->ReleaseIntArrayElements(coords_ref, (jint*)coords_base,
JNI_ABORT);
}
if (_exception) {
@@ -537,12 +651,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *coords = (GLint *) 0;
- coords = (GLint *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset);
+ coords = (GLint *)getPointer(_env, coords_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 5) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -550,7 +664,7 @@
goto exit;
}
if (coords == NULL) {
- char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _coordsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
coords = (GLint *) (_coordsBase + _bufferOffset);
}
glDrawTexivOES(
@@ -559,7 +673,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, coords, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)coords, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -597,7 +711,7 @@
goto exit;
}
coords_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0);
+ _env->GetIntArrayElements(coords_ref, (jboolean *)0);
coords = coords_base + offset;
glDrawTexxvOES(
@@ -606,7 +720,7 @@
exit:
if (coords_base) {
- _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base,
+ _env->ReleaseIntArrayElements(coords_ref, (jint*)coords_base,
JNI_ABORT);
}
if (_exception) {
@@ -621,12 +735,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *coords = (GLfixed *) 0;
- coords = (GLfixed *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset);
+ coords = (GLfixed *)getPointer(_env, coords_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 5) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -634,7 +748,7 @@
goto exit;
}
if (coords == NULL) {
- char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _coordsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
coords = (GLfixed *) (_coordsBase + _bufferOffset);
}
glDrawTexxvOES(
@@ -643,7 +757,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, coords, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)coords, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -694,7 +808,7 @@
goto exit;
}
coords_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(coords_ref, (jboolean *)0);
coords = coords_base + offset;
glDrawTexfvOES(
@@ -703,7 +817,7 @@
exit:
if (coords_base) {
- _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base,
+ _env->ReleaseFloatArrayElements(coords_ref, (jfloat*)coords_base,
JNI_ABORT);
}
if (_exception) {
@@ -718,12 +832,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *coords = (GLfloat *) 0;
- coords = (GLfloat *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset);
+ coords = (GLfloat *)getPointer(_env, coords_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 5) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -731,7 +845,7 @@
goto exit;
}
if (coords == NULL) {
- char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _coordsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
coords = (GLfloat *) (_coordsBase + _bufferOffset);
}
glDrawTexfvOES(
@@ -740,7 +854,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, coords, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)coords, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -756,7 +870,7 @@
jint _remaining;
GLeglImageOES image = (GLeglImageOES) 0;
- image = (GLeglImageOES)getPointer(_env, image_buf, &_array, &_remaining, &_bufferOffset);
+ image = (GLeglImageOES)getPointer(_env, image_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (image == NULL) {
char * _imageBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
image = (GLeglImageOES) (_imageBase + _bufferOffset);
@@ -779,7 +893,7 @@
jint _remaining;
GLeglImageOES image = (GLeglImageOES) 0;
- image = (GLeglImageOES)getPointer(_env, image_buf, &_array, &_remaining, &_bufferOffset);
+ image = (GLeglImageOES)getPointer(_env, image_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (image == NULL) {
char * _imageBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
image = (GLeglImageOES) (_imageBase + _bufferOffset);
@@ -849,7 +963,7 @@
}
_remaining = _env->GetArrayLength(equation_ref) - offset;
equation_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
+ _env->GetIntArrayElements(equation_ref, (jboolean *)0);
equation = equation_base + offset;
glClipPlanexOES(
@@ -859,7 +973,7 @@
exit:
if (equation_base) {
- _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
+ _env->ReleaseIntArrayElements(equation_ref, (jint*)equation_base,
JNI_ABORT);
}
if (_exception) {
@@ -871,14 +985,14 @@
static void
android_glClipPlanexOES__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *equation = (GLfixed *) 0;
- equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset);
+ equation = (GLfixed *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (equation == NULL) {
- char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _equationBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
equation = (GLfixed *) (_equationBase + _bufferOffset);
}
glClipPlanexOES(
@@ -886,7 +1000,7 @@
(GLfixed *)equation
);
if (_array) {
- releasePointer(_env, _array, equation, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)equation, JNI_ABORT);
}
}
@@ -947,7 +1061,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glFogxvOES(
@@ -957,7 +1071,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -969,14 +1083,14 @@
static void
android_glFogxvOES__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glFogxvOES(
@@ -984,7 +1098,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
}
@@ -1033,7 +1147,7 @@
goto exit;
}
eqn_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
+ _env->GetIntArrayElements(eqn_ref, (jboolean *)0);
eqn = eqn_base + offset;
glGetClipPlanexOES(
@@ -1043,7 +1157,7 @@
exit:
if (eqn_base) {
- _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
+ _env->ReleaseIntArrayElements(eqn_ref, (jint*)eqn_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1058,12 +1172,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *eqn = (GLfixed *) 0;
- eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset);
+ eqn = (GLfixed *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 4) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -1071,7 +1185,7 @@
goto exit;
}
if (eqn == NULL) {
- char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _eqnBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
eqn = (GLfixed *) (_eqnBase + _bufferOffset);
}
glGetClipPlanexOES(
@@ -1081,7 +1195,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)eqn, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1113,7 +1227,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetFixedvOES(
@@ -1123,7 +1237,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1135,14 +1249,14 @@
static void
android_glGetFixedvOES__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetFixedvOES(
@@ -1150,7 +1264,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -1179,7 +1293,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetLightxvOES(
@@ -1190,7 +1304,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1202,14 +1316,14 @@
static void
android_glGetLightxvOES__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetLightxvOES(
@@ -1218,7 +1332,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -1247,7 +1361,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetMaterialxvOES(
@@ -1258,7 +1372,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1270,14 +1384,14 @@
static void
android_glGetMaterialxvOES__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetMaterialxvOES(
@@ -1286,7 +1400,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -1315,7 +1429,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexEnvxvOES(
@@ -1326,7 +1440,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1338,14 +1452,14 @@
static void
android_glGetTexEnvxvOES__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetTexEnvxvOES(
@@ -1354,7 +1468,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -1383,7 +1497,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexParameterxvOES(
@@ -1394,7 +1508,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1406,14 +1520,14 @@
static void
android_glGetTexParameterxvOES__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetTexParameterxvOES(
@@ -1422,7 +1536,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -1461,7 +1575,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glLightModelxvOES(
@@ -1471,7 +1585,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -1483,14 +1597,14 @@
static void
android_glLightModelxvOES__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glLightModelxvOES(
@@ -1498,7 +1612,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
}
@@ -1538,7 +1652,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glLightxvOES(
@@ -1549,7 +1663,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -1561,14 +1675,14 @@
static void
android_glLightxvOES__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glLightxvOES(
@@ -1577,7 +1691,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
}
@@ -1615,7 +1729,7 @@
}
_remaining = _env->GetArrayLength(m_ref) - offset;
m_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+ _env->GetIntArrayElements(m_ref, (jboolean *)0);
m = m_base + offset;
glLoadMatrixxOES(
@@ -1624,7 +1738,7 @@
exit:
if (m_base) {
- _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+ _env->ReleaseIntArrayElements(m_ref, (jint*)m_base,
JNI_ABORT);
}
if (_exception) {
@@ -1636,21 +1750,21 @@
static void
android_glLoadMatrixxOES__Ljava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jobject m_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *m = (GLfixed *) 0;
- m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
+ m = (GLfixed *)getPointer(_env, m_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (m == NULL) {
- char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _mBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
m = (GLfixed *) (_mBase + _bufferOffset);
}
glLoadMatrixxOES(
(GLfixed *)m
);
if (_array) {
- releasePointer(_env, _array, m, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)m, JNI_ABORT);
}
}
@@ -1690,7 +1804,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glMaterialxvOES(
@@ -1701,7 +1815,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -1713,14 +1827,14 @@
static void
android_glMaterialxvOES__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glMaterialxvOES(
@@ -1729,7 +1843,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
}
@@ -1758,7 +1872,7 @@
}
_remaining = _env->GetArrayLength(m_ref) - offset;
m_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+ _env->GetIntArrayElements(m_ref, (jboolean *)0);
m = m_base + offset;
glMultMatrixxOES(
@@ -1767,7 +1881,7 @@
exit:
if (m_base) {
- _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+ _env->ReleaseIntArrayElements(m_ref, (jint*)m_base,
JNI_ABORT);
}
if (_exception) {
@@ -1779,21 +1893,21 @@
static void
android_glMultMatrixxOES__Ljava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jobject m_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *m = (GLfixed *) 0;
- m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
+ m = (GLfixed *)getPointer(_env, m_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (m == NULL) {
- char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _mBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
m = (GLfixed *) (_mBase + _bufferOffset);
}
glMultMatrixxOES(
(GLfixed *)m
);
if (_array) {
- releasePointer(_env, _array, m, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)m, JNI_ABORT);
}
}
@@ -1870,7 +1984,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glPointParameterxvOES(
@@ -1880,7 +1994,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -1892,14 +2006,14 @@
static void
android_glPointParameterxvOES__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glPointParameterxvOES(
@@ -1907,7 +2021,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
}
@@ -1999,7 +2113,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexEnvxvOES(
@@ -2010,7 +2124,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2022,14 +2136,14 @@
static void
android_glTexEnvxvOES__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glTexEnvxvOES(
@@ -2038,7 +2152,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
}
@@ -2078,7 +2192,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexParameterxvOES(
@@ -2089,7 +2203,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2101,14 +2215,14 @@
static void
android_glTexParameterxvOES__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glTexParameterxvOES(
@@ -2117,7 +2231,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
}
@@ -2184,7 +2298,7 @@
goto exit;
}
renderbuffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
renderbuffers = renderbuffers_base + offset;
glDeleteRenderbuffersOES(
@@ -2194,7 +2308,7 @@
exit:
if (renderbuffers_base) {
- _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
+ _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
JNI_ABORT);
}
if (_exception) {
@@ -2209,12 +2323,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *renderbuffers = (GLuint *) 0;
- renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset);
+ renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2222,7 +2336,7 @@
goto exit;
}
if (renderbuffers == NULL) {
- char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
}
glDeleteRenderbuffersOES(
@@ -2232,7 +2346,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, renderbuffers, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2270,7 +2384,7 @@
goto exit;
}
renderbuffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
renderbuffers = renderbuffers_base + offset;
glGenRenderbuffersOES(
@@ -2280,7 +2394,7 @@
exit:
if (renderbuffers_base) {
- _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
+ _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2295,12 +2409,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *renderbuffers = (GLuint *) 0;
- renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset);
+ renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2308,7 +2422,7 @@
goto exit;
}
if (renderbuffers == NULL) {
- char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
}
glGenRenderbuffersOES(
@@ -2318,7 +2432,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2368,7 +2482,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetRenderbufferParameterivOES(
@@ -2379,7 +2493,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2394,12 +2508,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2407,7 +2521,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetRenderbufferParameterivOES(
@@ -2418,7 +2532,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2477,7 +2591,7 @@
goto exit;
}
framebuffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
framebuffers = framebuffers_base + offset;
glDeleteFramebuffersOES(
@@ -2487,7 +2601,7 @@
exit:
if (framebuffers_base) {
- _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
+ _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
JNI_ABORT);
}
if (_exception) {
@@ -2502,12 +2616,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *framebuffers = (GLuint *) 0;
- framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset);
+ framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2515,7 +2629,7 @@
goto exit;
}
if (framebuffers == NULL) {
- char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
}
glDeleteFramebuffersOES(
@@ -2525,7 +2639,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, framebuffers, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2563,7 +2677,7 @@
goto exit;
}
framebuffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
framebuffers = framebuffers_base + offset;
glGenFramebuffersOES(
@@ -2573,7 +2687,7 @@
exit:
if (framebuffers_base) {
- _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
+ _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2588,12 +2702,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *framebuffers = (GLuint *) 0;
- framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset);
+ framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2601,7 +2715,7 @@
goto exit;
}
if (framebuffers == NULL) {
- char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
}
glGenFramebuffersOES(
@@ -2611,7 +2725,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2685,7 +2799,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetFramebufferAttachmentParameterivOES(
@@ -2697,7 +2811,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2712,12 +2826,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2725,7 +2839,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetFramebufferAttachmentParameterivOES(
@@ -2737,7 +2851,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2880,7 +2994,7 @@
}
_remaining = _env->GetArrayLength(equation_ref) - offset;
equation_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(equation_ref, (jboolean *)0);
equation = equation_base + offset;
glClipPlanefOES(
@@ -2890,7 +3004,7 @@
exit:
if (equation_base) {
- _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
+ _env->ReleaseFloatArrayElements(equation_ref, (jfloat*)equation_base,
JNI_ABORT);
}
if (_exception) {
@@ -2902,14 +3016,14 @@
static void
android_glClipPlanefOES__ILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *equation = (GLfloat *) 0;
- equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset);
+ equation = (GLfloat *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (equation == NULL) {
- char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _equationBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
equation = (GLfloat *) (_equationBase + _bufferOffset);
}
glClipPlanefOES(
@@ -2917,7 +3031,7 @@
(GLfloat *)equation
);
if (_array) {
- releasePointer(_env, _array, equation, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)equation, JNI_ABORT);
}
}
@@ -2952,7 +3066,7 @@
goto exit;
}
eqn_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(eqn_ref, (jboolean *)0);
eqn = eqn_base + offset;
glGetClipPlanefOES(
@@ -2962,7 +3076,7 @@
exit:
if (eqn_base) {
- _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
+ _env->ReleaseFloatArrayElements(eqn_ref, (jfloat*)eqn_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2977,12 +3091,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *eqn = (GLfloat *) 0;
- eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset);
+ eqn = (GLfloat *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 4) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2990,7 +3104,7 @@
goto exit;
}
if (eqn == NULL) {
- char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _eqnBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
eqn = (GLfloat *) (_eqnBase + _bufferOffset);
}
glGetClipPlanefOES(
@@ -3000,7 +3114,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)eqn, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -3052,7 +3166,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexGenfvOES(
@@ -3063,7 +3177,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -3075,14 +3189,14 @@
static void
android_glTexGenfvOES__IILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glTexGenfvOES(
@@ -3091,7 +3205,7 @@
(GLfloat *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
}
@@ -3131,7 +3245,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexGenivOES(
@@ -3142,7 +3256,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -3154,14 +3268,14 @@
static void
android_glTexGenivOES__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glTexGenivOES(
@@ -3170,7 +3284,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
}
@@ -3210,7 +3324,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexGenxvOES(
@@ -3221,7 +3335,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -3233,14 +3347,14 @@
static void
android_glTexGenxvOES__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glTexGenxvOES(
@@ -3249,7 +3363,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
}
@@ -3278,7 +3392,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexGenfvOES(
@@ -3289,7 +3403,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3301,14 +3415,14 @@
static void
android_glGetTexGenfvOES__IILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetTexGenfvOES(
@@ -3317,7 +3431,7 @@
(GLfloat *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, 0);
}
}
@@ -3346,7 +3460,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexGenivOES(
@@ -3357,7 +3471,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3369,14 +3483,14 @@
static void
android_glGetTexGenivOES__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetTexGenivOES(
@@ -3385,7 +3499,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -3414,7 +3528,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexGenxvOES(
@@ -3425,7 +3539,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3437,14 +3551,14 @@
static void
android_glGetTexGenxvOES__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetTexGenxvOES(
@@ -3453,7 +3567,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
diff --git a/core/jni/android_opengl_GLES20.cpp b/core/jni/android_opengl_GLES20.cpp
index cd0c1354..f9a0dfe 100644
--- a/core/jni/android_opengl_GLES20.cpp
+++ b/core/jni/android_opengl_GLES20.cpp
@@ -126,6 +126,116 @@
return NULL;
}
+class ByteArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
+ return _env->GetByteArrayElements(array, is_copy);
+ }
+};
+class BooleanArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
+ return _env->GetBooleanArrayElements(array, is_copy);
+ }
+};
+class CharArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
+ return _env->GetCharArrayElements(array, is_copy);
+ }
+};
+class ShortArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
+ return _env->GetShortArrayElements(array, is_copy);
+ }
+};
+class IntArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
+ return _env->GetIntArrayElements(array, is_copy);
+ }
+};
+class LongArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
+ return _env->GetLongArrayElements(array, is_copy);
+ }
+};
+class FloatArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
+ return _env->GetFloatArrayElements(array, is_copy);
+ }
+};
+class DoubleArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
+ return _env->GetDoubleArrayElements(array, is_copy);
+ }
+};
+
+template<typename JTYPEARRAY, typename ARRAYGETTER>
+static void*
+getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
+ return ARRAYGETTER::Get(_env, array, is_copy);
+}
+
+class ByteArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
+ _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class BooleanArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
+ _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class CharArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
+ _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class ShortArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
+ _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class IntArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
+ _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class LongArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
+ _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class FloatArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
+ _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class DoubleArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
+ _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+
+template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
+static void
+releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
+ ARRAYRELEASER::Release(_env, array, data, commit);
+}
+
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -229,7 +339,8 @@
return needed;
}
-template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
static void
get
(JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
@@ -264,8 +375,8 @@
_exceptionMessage = "length - offset < needed";
goto exit;
}
- params_base = (CTYPE *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, params_ref, (jboolean *)0);
params = params_base + offset;
GET(
@@ -275,8 +386,8 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
- _exception ? JNI_ABORT: 0);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, params_ref, params_base, !_exception);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -284,20 +395,21 @@
}
-template <typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
static void
getarray
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
jint _exception = 0;
const char * _exceptionType;
const char * _exceptionMessage;
- jarray _array = (jarray) 0;
+ JTYPEARRAY _array = (JTYPEARRAY) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
CTYPE *params = (CTYPE *) 0;
int _needed = 0;
- params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
_remaining /= sizeof(CTYPE); // convert from bytes to item count
_needed = getNeededCount(pname);
// if we didn't find this pname, we just assume the user passed
@@ -310,7 +422,8 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, _array, (jboolean *) 0);
params = (CTYPE *) (_paramsBase + _bufferOffset);
}
GET(
@@ -320,7 +433,8 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -486,7 +600,7 @@
GLvoid *data = (GLvoid *) 0;
if (data_buf) {
- data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < size) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -526,7 +640,7 @@
jint _remaining;
GLvoid *data = (GLvoid *) 0;
- data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < size) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -633,7 +747,7 @@
jint _remaining;
GLvoid *data = (GLvoid *) 0;
- data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (data == NULL) {
char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
data = (GLvoid *) (_dataBase + _bufferOffset);
@@ -662,7 +776,7 @@
jint _remaining;
GLvoid *data = (GLvoid *) 0;
- data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (data == NULL) {
char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
data = (GLvoid *) (_dataBase + _bufferOffset);
@@ -775,7 +889,7 @@
goto exit;
}
buffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
buffers = buffers_base + offset;
glDeleteBuffers(
@@ -785,7 +899,7 @@
exit:
if (buffers_base) {
- _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
+ _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
JNI_ABORT);
}
if (_exception) {
@@ -800,12 +914,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *buffers = (GLuint *) 0;
- buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
+ buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -813,7 +927,7 @@
goto exit;
}
if (buffers == NULL) {
- char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
buffers = (GLuint *) (_buffersBase + _bufferOffset);
}
glDeleteBuffers(
@@ -823,7 +937,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, buffers, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -861,7 +975,7 @@
goto exit;
}
framebuffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
framebuffers = framebuffers_base + offset;
glDeleteFramebuffers(
@@ -871,7 +985,7 @@
exit:
if (framebuffers_base) {
- _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
+ _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
JNI_ABORT);
}
if (_exception) {
@@ -886,12 +1000,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *framebuffers = (GLuint *) 0;
- framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset);
+ framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -899,7 +1013,7 @@
goto exit;
}
if (framebuffers == NULL) {
- char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
}
glDeleteFramebuffers(
@@ -909,7 +1023,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, framebuffers, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -956,7 +1070,7 @@
goto exit;
}
renderbuffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
renderbuffers = renderbuffers_base + offset;
glDeleteRenderbuffers(
@@ -966,7 +1080,7 @@
exit:
if (renderbuffers_base) {
- _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
+ _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
JNI_ABORT);
}
if (_exception) {
@@ -981,12 +1095,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *renderbuffers = (GLuint *) 0;
- renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset);
+ renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -994,7 +1108,7 @@
goto exit;
}
if (renderbuffers == NULL) {
- char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
}
glDeleteRenderbuffers(
@@ -1004,7 +1118,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, renderbuffers, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1051,7 +1165,7 @@
goto exit;
}
textures_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
+ _env->GetIntArrayElements(textures_ref, (jboolean *)0);
textures = textures_base + offset;
glDeleteTextures(
@@ -1061,7 +1175,7 @@
exit:
if (textures_base) {
- _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
+ _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
JNI_ABORT);
}
if (_exception) {
@@ -1076,12 +1190,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *textures = (GLuint *) 0;
- textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
+ textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -1089,7 +1203,7 @@
goto exit;
}
if (textures == NULL) {
- char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
textures = (GLuint *) (_texturesBase + _bufferOffset);
}
glDeleteTextures(
@@ -1099,7 +1213,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, textures, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)textures, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1203,7 +1317,7 @@
jint _remaining;
GLvoid *indices = (GLvoid *) 0;
- indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset);
+ indices = (GLvoid *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < count) {
_exception = 1;
_exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
@@ -1327,7 +1441,7 @@
goto exit;
}
buffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
buffers = buffers_base + offset;
glGenBuffers(
@@ -1337,7 +1451,7 @@
exit:
if (buffers_base) {
- _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
+ _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1352,12 +1466,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *buffers = (GLuint *) 0;
- buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
+ buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -1365,7 +1479,7 @@
goto exit;
}
if (buffers == NULL) {
- char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
buffers = (GLuint *) (_buffersBase + _bufferOffset);
}
glGenBuffers(
@@ -1375,7 +1489,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1422,7 +1536,7 @@
goto exit;
}
framebuffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
framebuffers = framebuffers_base + offset;
glGenFramebuffers(
@@ -1432,7 +1546,7 @@
exit:
if (framebuffers_base) {
- _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
+ _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1447,12 +1561,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *framebuffers = (GLuint *) 0;
- framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset);
+ framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -1460,7 +1574,7 @@
goto exit;
}
if (framebuffers == NULL) {
- char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
}
glGenFramebuffers(
@@ -1470,7 +1584,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1508,7 +1622,7 @@
goto exit;
}
renderbuffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
renderbuffers = renderbuffers_base + offset;
glGenRenderbuffers(
@@ -1518,7 +1632,7 @@
exit:
if (renderbuffers_base) {
- _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
+ _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1533,12 +1647,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *renderbuffers = (GLuint *) 0;
- renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset);
+ renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -1546,7 +1660,7 @@
goto exit;
}
if (renderbuffers == NULL) {
- char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
}
glGenRenderbuffers(
@@ -1556,7 +1670,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1594,7 +1708,7 @@
goto exit;
}
textures_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
+ _env->GetIntArrayElements(textures_ref, (jboolean *)0);
textures = textures_base + offset;
glGenTextures(
@@ -1604,7 +1718,7 @@
exit:
if (textures_base) {
- _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
+ _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1619,12 +1733,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *textures = (GLuint *) 0;
- textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
+ textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -1632,7 +1746,7 @@
goto exit;
}
if (textures == NULL) {
- char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
textures = (GLuint *) (_texturesBase + _bufferOffset);
}
glGenTextures(
@@ -1642,7 +1756,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)textures, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1683,7 +1797,7 @@
}
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
length_base = (GLsizei *)
- _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
length = length_base + lengthOffset;
if (!size_ref) {
@@ -1700,7 +1814,7 @@
}
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
size_base = (GLint *)
- _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ _env->GetIntArrayElements(size_ref, (jboolean *)0);
size = size_base + sizeOffset;
if (!type_ref) {
@@ -1717,7 +1831,7 @@
}
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
type_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ _env->GetIntArrayElements(type_ref, (jboolean *)0);
type = type_base + typeOffset;
if (!name_ref) {
@@ -1734,7 +1848,7 @@
}
_nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
name_base = (char *)
- _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
+ _env->GetByteArrayElements(name_ref, (jboolean *)0);
name = name_base + nameOffset;
glGetActiveAttrib(
@@ -1749,19 +1863,19 @@
exit:
if (name_base) {
- _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
+ _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
_exception ? JNI_ABORT: 0);
}
if (type_base) {
- _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
_exception ? JNI_ABORT: 0);
}
if (size_base) {
- _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
_exception ? JNI_ABORT: 0);
}
if (length_base) {
- _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
+ _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1773,11 +1887,11 @@
static void
android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
(JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
- jarray _lengthArray = (jarray) 0;
+ jintArray _lengthArray = (jintArray) 0;
jint _lengthBufferOffset = (jint) 0;
- jarray _sizeArray = (jarray) 0;
+ jintArray _sizeArray = (jintArray) 0;
jint _sizeBufferOffset = (jint) 0;
- jarray _typeArray = (jarray) 0;
+ jintArray _typeArray = (jintArray) 0;
jint _typeBufferOffset = (jint) 0;
jint _lengthRemaining;
GLsizei *length = (GLsizei *) 0;
@@ -1786,19 +1900,19 @@
jint _typeRemaining;
GLenum *type = (GLenum *) 0;
- length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
- size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
- type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
+ length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
+ size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
+ type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
if (length == NULL) {
- char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
+ char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
}
if (size == NULL) {
- char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
size = (GLint *) (_sizeBase + _sizeBufferOffset);
}
if (type == NULL) {
- char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
type = (GLenum *) (_typeBase + _typeBufferOffset);
}
glGetActiveAttrib(
@@ -1811,13 +1925,13 @@
reinterpret_cast<char *>(name)
);
if (_typeArray) {
- releasePointer(_env, _typeArray, type, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
}
if (_sizeArray) {
- releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
}
if (_lengthArray) {
- releasePointer(_env, _lengthArray, length, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
}
}
@@ -1862,7 +1976,7 @@
}
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
size_base = (GLint *)
- _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ _env->GetIntArrayElements(size_ref, (jboolean *)0);
size = size_base + sizeOffset;
if (!type_ref) {
@@ -1879,7 +1993,7 @@
}
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
type_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ _env->GetIntArrayElements(type_ref, (jboolean *)0);
type = type_base + typeOffset;
glGetActiveAttrib(
@@ -1893,11 +2007,11 @@
);
exit:
if (type_base) {
- _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
_exception ? JNI_ABORT: 0);
}
if (size_base) {
- _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
_exception ? JNI_ABORT: 0);
}
if (_exception != 1) {
@@ -1920,9 +2034,9 @@
static jstring
android_glGetActiveAttrib2
(JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
- jarray _sizeArray = (jarray) 0;
+ jintArray _sizeArray = (jintArray) 0;
jint _sizeBufferOffset = (jint) 0;
- jarray _typeArray = (jarray) 0;
+ jintArray _typeArray = (jintArray) 0;
jint _typeBufferOffset = (jint) 0;
jint _lengthRemaining;
GLsizei *length = (GLsizei *) 0;
@@ -1945,14 +2059,14 @@
return NULL;
}
- size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
- type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
+ size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
+ type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
if (size == NULL) {
- char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
size = (GLint *) (_sizeBase + _sizeBufferOffset);
}
if (type == NULL) {
- char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
type = (GLenum *) (_typeBase + _typeBufferOffset);
}
glGetActiveAttrib(
@@ -1966,10 +2080,10 @@
);
if (_typeArray) {
- releasePointer(_env, _typeArray, type, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
}
if (_sizeArray) {
- releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
}
result = _env->NewStringUTF(buf);
if (buf) {
@@ -2011,7 +2125,7 @@
}
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
length_base = (GLsizei *)
- _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
length = length_base + lengthOffset;
if (!size_ref) {
@@ -2028,7 +2142,7 @@
}
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
size_base = (GLint *)
- _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ _env->GetIntArrayElements(size_ref, (jboolean *)0);
size = size_base + sizeOffset;
if (!type_ref) {
@@ -2045,7 +2159,7 @@
}
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
type_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ _env->GetIntArrayElements(type_ref, (jboolean *)0);
type = type_base + typeOffset;
if (!name_ref) {
@@ -2062,7 +2176,7 @@
}
_nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
name_base = (char *)
- _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
+ _env->GetByteArrayElements(name_ref, (jboolean *)0);
name = name_base + nameOffset;
glGetActiveUniform(
@@ -2077,19 +2191,19 @@
exit:
if (name_base) {
- _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
+ _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
_exception ? JNI_ABORT: 0);
}
if (type_base) {
- _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
_exception ? JNI_ABORT: 0);
}
if (size_base) {
- _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
_exception ? JNI_ABORT: 0);
}
if (length_base) {
- _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
+ _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2101,11 +2215,11 @@
static void
android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
(JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
- jarray _lengthArray = (jarray) 0;
+ jintArray _lengthArray = (jintArray) 0;
jint _lengthBufferOffset = (jint) 0;
- jarray _sizeArray = (jarray) 0;
+ jintArray _sizeArray = (jintArray) 0;
jint _sizeBufferOffset = (jint) 0;
- jarray _typeArray = (jarray) 0;
+ jintArray _typeArray = (jintArray) 0;
jint _typeBufferOffset = (jint) 0;
jint _lengthRemaining;
GLsizei *length = (GLsizei *) 0;
@@ -2114,19 +2228,19 @@
jint _typeRemaining;
GLenum *type = (GLenum *) 0;
- length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
- size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
- type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
+ length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
+ size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
+ type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
if (length == NULL) {
- char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
+ char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
}
if (size == NULL) {
- char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
size = (GLint *) (_sizeBase + _sizeBufferOffset);
}
if (type == NULL) {
- char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
type = (GLenum *) (_typeBase + _typeBufferOffset);
}
glGetActiveUniform(
@@ -2139,13 +2253,13 @@
reinterpret_cast<char *>(name)
);
if (_typeArray) {
- releasePointer(_env, _typeArray, type, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
}
if (_sizeArray) {
- releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
}
if (_lengthArray) {
- releasePointer(_env, _lengthArray, length, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
}
}
@@ -2193,7 +2307,7 @@
}
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
size_base = (GLint *)
- _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ _env->GetIntArrayElements(size_ref, (jboolean *)0);
size = size_base + sizeOffset;
if (!type_ref) {
@@ -2210,7 +2324,7 @@
}
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
type_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ _env->GetIntArrayElements(type_ref, (jboolean *)0);
type = type_base + typeOffset;
glGetActiveUniform(
@@ -2225,11 +2339,11 @@
exit:
if (type_base) {
- _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
_exception ? JNI_ABORT: 0);
}
if (size_base) {
- _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
_exception ? JNI_ABORT: 0);
}
if (_exception != 1) {
@@ -2251,9 +2365,9 @@
static jstring
android_glGetActiveUniform2
(JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
- jarray _sizeArray = (jarray) 0;
+ jintArray _sizeArray = (jintArray) 0;
jint _sizeBufferOffset = (jint) 0;
- jarray _typeArray = (jarray) 0;
+ jintArray _typeArray = (jintArray) 0;
jint _typeBufferOffset = (jint) 0;
jint _sizeRemaining;
GLint *size = (GLint *) 0;
@@ -2273,15 +2387,15 @@
return NULL;
}
- size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
- type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
+ size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
+ type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
if (size == NULL) {
- char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
size = (GLint *) (_sizeBase + _sizeBufferOffset);
}
if (type == NULL) {
- char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
type = (GLenum *) (_typeBase + _typeBufferOffset);
}
glGetActiveUniform(
@@ -2295,10 +2409,10 @@
);
if (_typeArray) {
- releasePointer(_env, _typeArray, type, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
}
if (_sizeArray) {
- releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
}
result = _env->NewStringUTF(buf);
if (buf) {
@@ -2340,7 +2454,7 @@
goto exit;
}
count_base = (GLsizei *)
- _env->GetPrimitiveArrayCritical(count_ref, (jboolean *)0);
+ _env->GetIntArrayElements(count_ref, (jboolean *)0);
count = count_base + countOffset;
if (!shaders_ref) {
@@ -2363,7 +2477,7 @@
goto exit;
}
shaders_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0);
+ _env->GetIntArrayElements(shaders_ref, (jboolean *)0);
shaders = shaders_base + shadersOffset;
glGetAttachedShaders(
@@ -2375,11 +2489,11 @@
exit:
if (shaders_base) {
- _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base,
+ _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base,
_exception ? JNI_ABORT: 0);
}
if (count_base) {
- _env->ReleasePrimitiveArrayCritical(count_ref, count_base,
+ _env->ReleaseIntArrayElements(count_ref, (jint*)count_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2394,9 +2508,9 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _countArray = (jarray) 0;
+ jintArray _countArray = (jintArray) 0;
jint _countBufferOffset = (jint) 0;
- jarray _shadersArray = (jarray) 0;
+ jintArray _shadersArray = (jintArray) 0;
jint _shadersBufferOffset = (jint) 0;
jint _countRemaining;
GLsizei *count = (GLsizei *) 0;
@@ -2404,7 +2518,7 @@
GLuint *shaders = (GLuint *) 0;
if (count_buf) {
- count = (GLsizei *)getPointer(_env, count_buf, &_countArray, &_countRemaining, &_countBufferOffset);
+ count = (GLsizei *)getPointer(_env, count_buf, (jarray*)&_countArray, &_countRemaining, &_countBufferOffset);
if (_countRemaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2413,7 +2527,7 @@
}
}
if (shaders_buf) {
- shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
+ shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
if (_shadersRemaining < maxcount) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2422,11 +2536,11 @@
}
}
if (count_buf && count == NULL) {
- char * _countBase = (char *)_env->GetPrimitiveArrayCritical(_countArray, (jboolean *) 0);
+ char * _countBase = (char *)_env->GetIntArrayElements(_countArray, (jboolean *) 0);
count = (GLsizei *) (_countBase + _countBufferOffset);
}
if (shaders_buf && shaders == NULL) {
- char * _shadersBase = (char *)_env->GetPrimitiveArrayCritical(_shadersArray, (jboolean *) 0);
+ char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0);
shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
}
glGetAttachedShaders(
@@ -2438,10 +2552,10 @@
exit:
if (_shadersArray) {
- releasePointer(_env, _shadersArray, shaders, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, _exception ? JNI_ABORT : 0);
}
if (_countArray) {
- releasePointer(_env, _countArray, count, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_countArray, (jint*)count, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2486,14 +2600,16 @@
static void
android_glGetBooleanv__I_3ZI
(JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
- get<jbooleanArray, GLboolean, glGetBooleanv>(_env, _this, pname, params_ref, offset);
+ get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>(
+ _env, _this, pname, params_ref, offset);
}
/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
static void
android_glGetBooleanv__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- getarray<GLboolean, glGetBooleanv>(_env, _this, pname, params_buf);
+ getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>(
+ _env, _this, pname, params_buf);
}
/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
static void
@@ -2526,7 +2642,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetBufferParameteriv(
@@ -2537,7 +2653,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2552,12 +2668,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2565,7 +2681,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetBufferParameteriv(
@@ -2576,7 +2692,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2596,14 +2712,16 @@
static void
android_glGetFloatv__I_3FI
(JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
- get<jfloatArray, GLfloat, glGetFloatv>(_env, _this, pname, params_ref, offset);
+ get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>(
+ _env, _this, pname, params_ref, offset);
}
/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
static void
android_glGetFloatv__ILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- getarray<GLfloat, glGetFloatv>(_env, _this, pname, params_buf);
+ getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>(
+ _env, _this, pname, params_buf);
}
/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
static void
@@ -2630,7 +2748,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetFramebufferAttachmentParameteriv(
@@ -2642,7 +2760,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2654,14 +2772,14 @@
static void
android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetFramebufferAttachmentParameteriv(
@@ -2671,7 +2789,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -2679,16 +2797,17 @@
static void
android_glGetIntegerv__I_3II
(JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
- get<jintArray, GLint, glGetIntegerv>(_env, _this, pname, params_ref, offset);
+ get<jintArray, IntArrayGetter, jint*, IntArrayReleaser, GLint, glGetIntegerv>(
+ _env, _this, pname, params_ref, offset);
}
/* void glGetIntegerv ( GLenum pname, GLint *params ) */
static void
android_glGetIntegerv__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- getarray<GLint, glGetIntegerv>(_env, _this, pname, params_buf);
+ getarray<GLint, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetIntegerv>(
+ _env, _this, pname, params_buf);
}
-
/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
static void
android_glGetProgramiv__II_3II
@@ -2720,7 +2839,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetProgramiv(
@@ -2731,7 +2850,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2746,12 +2865,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2759,7 +2878,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetProgramiv(
@@ -2770,7 +2889,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2827,7 +2946,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetRenderbufferParameteriv(
@@ -2838,7 +2957,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2853,12 +2972,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2866,7 +2985,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetRenderbufferParameteriv(
@@ -2877,7 +2996,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2915,7 +3034,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetShaderiv(
@@ -2926,7 +3045,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2941,12 +3060,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -2954,7 +3073,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetShaderiv(
@@ -2965,7 +3084,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -3025,7 +3144,7 @@
goto exit;
}
range_base = (GLint *)
- _env->GetPrimitiveArrayCritical(range_ref, (jboolean *)0);
+ _env->GetIntArrayElements(range_ref, (jboolean *)0);
range = range_base + rangeOffset;
if (!precision_ref) {
@@ -3048,7 +3167,7 @@
goto exit;
}
precision_base = (GLint *)
- _env->GetPrimitiveArrayCritical(precision_ref, (jboolean *)0);
+ _env->GetIntArrayElements(precision_ref, (jboolean *)0);
precision = precision_base + precisionOffset;
glGetShaderPrecisionFormat(
@@ -3060,11 +3179,11 @@
exit:
if (precision_base) {
- _env->ReleasePrimitiveArrayCritical(precision_ref, precision_base,
+ _env->ReleaseIntArrayElements(precision_ref, (jint*)precision_base,
_exception ? JNI_ABORT: 0);
}
if (range_base) {
- _env->ReleasePrimitiveArrayCritical(range_ref, range_base,
+ _env->ReleaseIntArrayElements(range_ref, (jint*)range_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3079,23 +3198,23 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _rangeArray = (jarray) 0;
+ jintArray _rangeArray = (jintArray) 0;
jint _rangeBufferOffset = (jint) 0;
- jarray _precisionArray = (jarray) 0;
+ jintArray _precisionArray = (jintArray) 0;
jint _precisionBufferOffset = (jint) 0;
jint _rangeRemaining;
GLint *range = (GLint *) 0;
jint _precisionRemaining;
GLint *precision = (GLint *) 0;
- range = (GLint *)getPointer(_env, range_buf, &_rangeArray, &_rangeRemaining, &_rangeBufferOffset);
+ range = (GLint *)getPointer(_env, range_buf, (jarray*)&_rangeArray, &_rangeRemaining, &_rangeBufferOffset);
if (_rangeRemaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
_exceptionMessage = "remaining() < 1 < needed";
goto exit;
}
- precision = (GLint *)getPointer(_env, precision_buf, &_precisionArray, &_precisionRemaining, &_precisionBufferOffset);
+ precision = (GLint *)getPointer(_env, precision_buf, (jarray*)&_precisionArray, &_precisionRemaining, &_precisionBufferOffset);
if (_precisionRemaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -3103,11 +3222,11 @@
goto exit;
}
if (range == NULL) {
- char * _rangeBase = (char *)_env->GetPrimitiveArrayCritical(_rangeArray, (jboolean *) 0);
+ char * _rangeBase = (char *)_env->GetIntArrayElements(_rangeArray, (jboolean *) 0);
range = (GLint *) (_rangeBase + _rangeBufferOffset);
}
if (precision == NULL) {
- char * _precisionBase = (char *)_env->GetPrimitiveArrayCritical(_precisionArray, (jboolean *) 0);
+ char * _precisionBase = (char *)_env->GetIntArrayElements(_precisionArray, (jboolean *) 0);
precision = (GLint *) (_precisionBase + _precisionBufferOffset);
}
glGetShaderPrecisionFormat(
@@ -3119,10 +3238,10 @@
exit:
if (_precisionArray) {
- releasePointer(_env, _precisionArray, precision, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_precisionArray, (jint*)precision, _exception ? JNI_ABORT : 0);
}
if (_rangeArray) {
- releasePointer(_env, _rangeArray, range, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_rangeArray, (jint*)range, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -3157,7 +3276,7 @@
}
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
length_base = (GLsizei *)
- _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
length = length_base + lengthOffset;
if (!source_ref) {
@@ -3174,7 +3293,7 @@
}
_sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
source_base = (char *)
- _env->GetPrimitiveArrayCritical(source_ref, (jboolean *)0);
+ _env->GetByteArrayElements(source_ref, (jboolean *)0);
source = source_base + sourceOffset;
glGetShaderSource(
@@ -3186,11 +3305,11 @@
exit:
if (source_base) {
- _env->ReleasePrimitiveArrayCritical(source_ref, source_base,
+ _env->ReleaseByteArrayElements(source_ref, (jbyte*)source_base,
_exception ? JNI_ABORT: 0);
}
if (length_base) {
- _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
+ _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3202,14 +3321,14 @@
static void
android_glGetShaderSource__IILjava_nio_IntBuffer_2B
(JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLsizei *length = (GLsizei *) 0;
- length = (GLsizei *)getPointer(_env, length_buf, &_array, &_remaining, &_bufferOffset);
+ length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (length == NULL) {
- char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _lengthBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
length = (GLsizei *) (_lengthBase + _bufferOffset);
}
glGetShaderSource(
@@ -3219,7 +3338,7 @@
reinterpret_cast<char *>(source)
);
if (_array) {
- releasePointer(_env, _array, length, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _array, (jint*)length, JNI_TRUE);
}
}
@@ -3276,7 +3395,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexParameterfv(
@@ -3287,7 +3406,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3302,12 +3421,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -3315,7 +3434,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetTexParameterfv(
@@ -3326,7 +3445,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -3364,7 +3483,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexParameteriv(
@@ -3375,7 +3494,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3390,12 +3509,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -3403,7 +3522,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetTexParameteriv(
@@ -3414,7 +3533,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -3452,7 +3571,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetUniformfv(
@@ -3463,7 +3582,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3478,12 +3597,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -3491,7 +3610,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetUniformfv(
@@ -3502,7 +3621,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -3540,7 +3659,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetUniformiv(
@@ -3551,7 +3670,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3566,12 +3685,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -3579,7 +3698,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetUniformiv(
@@ -3590,7 +3709,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -3673,7 +3792,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetVertexAttribfv(
@@ -3684,7 +3803,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3699,12 +3818,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_CURRENT_VERTEX_ATTRIB)
@@ -3723,7 +3842,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetVertexAttribfv(
@@ -3734,7 +3853,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -3783,7 +3902,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetVertexAttribiv(
@@ -3794,7 +3913,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3809,12 +3928,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_CURRENT_VERTEX_ATTRIB)
@@ -3833,7 +3952,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetVertexAttribiv(
@@ -3844,7 +3963,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -3985,7 +4104,7 @@
jint _remaining;
GLvoid *pixels = (GLvoid *) 0;
- pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
+ pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (pixels == NULL) {
char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
@@ -4074,10 +4193,10 @@
}
_shadersRemaining = _env->GetArrayLength(shaders_ref) - offset;
shaders_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0);
+ _env->GetIntArrayElements(shaders_ref, (jboolean *)0);
shaders = shaders_base + offset;
- binary = (GLvoid *)getPointer(_env, binary_buf, &_array, &_binaryRemaining, &_bufferOffset);
+ binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_array, &_binaryRemaining, &_bufferOffset);
if (_binaryRemaining < length) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4101,7 +4220,7 @@
releasePointer(_env, _array, binary, JNI_FALSE);
}
if (shaders_base) {
- _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base,
+ _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base,
JNI_ABORT);
}
if (_exception) {
@@ -4116,17 +4235,17 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _shadersArray = (jarray) 0;
+ jintArray _shadersArray = (jintArray) 0;
jint _shadersBufferOffset = (jint) 0;
- jarray _binaryArray = (jarray) 0;
+ jintArray _binaryArray = (jintArray) 0;
jint _binaryBufferOffset = (jint) 0;
jint _shadersRemaining;
GLuint *shaders = (GLuint *) 0;
jint _binaryRemaining;
GLvoid *binary = (GLvoid *) 0;
- shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
- binary = (GLvoid *)getPointer(_env, binary_buf, &_binaryArray, &_binaryRemaining, &_binaryBufferOffset);
+ shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
+ binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_binaryArray, &_binaryRemaining, &_binaryBufferOffset);
if (_binaryRemaining < length) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4134,7 +4253,7 @@
goto exit;
}
if (shaders == NULL) {
- char * _shadersBase = (char *)_env->GetPrimitiveArrayCritical(_shadersArray, (jboolean *) 0);
+ char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0);
shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
}
if (binary == NULL) {
@@ -4154,7 +4273,7 @@
releasePointer(_env, _binaryArray, binary, JNI_FALSE);
}
if (_shadersArray) {
- releasePointer(_env, _shadersArray, shaders, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -4253,7 +4372,7 @@
GLvoid *pixels = (GLvoid *) 0;
if (pixels_buf) {
- pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
+ pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
}
if (pixels_buf && pixels == NULL) {
char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
@@ -4317,7 +4436,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexParameterfv(
@@ -4328,7 +4447,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -4343,12 +4462,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4356,7 +4475,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glTexParameterfv(
@@ -4367,7 +4486,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -4416,7 +4535,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexParameteriv(
@@ -4427,7 +4546,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -4442,12 +4561,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4455,7 +4574,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glTexParameteriv(
@@ -4466,7 +4585,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -4483,7 +4602,7 @@
GLvoid *pixels = (GLvoid *) 0;
if (pixels_buf) {
- pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
+ pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
}
if (pixels_buf && pixels == NULL) {
char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
@@ -4546,7 +4665,7 @@
goto exit;
}
v_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(v_ref, (jboolean *)0);
v = v_base + offset;
glUniform1fv(
@@ -4557,7 +4676,7 @@
exit:
if (v_base) {
- _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
+ _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
JNI_ABORT);
}
if (_exception) {
@@ -4572,12 +4691,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *v = (GLfloat *) 0;
- v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
+ v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < count) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4585,7 +4704,7 @@
goto exit;
}
if (v == NULL) {
- char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
v = (GLfloat *) (_vBase + _bufferOffset);
}
glUniform1fv(
@@ -4596,7 +4715,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, v, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -4644,7 +4763,7 @@
goto exit;
}
v_base = (GLint *)
- _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
+ _env->GetIntArrayElements(v_ref, (jboolean *)0);
v = v_base + offset;
glUniform1iv(
@@ -4655,7 +4774,7 @@
exit:
if (v_base) {
- _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
+ _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
JNI_ABORT);
}
if (_exception) {
@@ -4670,12 +4789,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *v = (GLint *) 0;
- v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
+ v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < count) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4683,7 +4802,7 @@
goto exit;
}
if (v == NULL) {
- char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
v = (GLint *) (_vBase + _bufferOffset);
}
glUniform1iv(
@@ -4694,7 +4813,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, v, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -4743,7 +4862,7 @@
goto exit;
}
v_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(v_ref, (jboolean *)0);
v = v_base + offset;
glUniform2fv(
@@ -4754,7 +4873,7 @@
exit:
if (v_base) {
- _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
+ _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
JNI_ABORT);
}
if (_exception) {
@@ -4769,12 +4888,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *v = (GLfloat *) 0;
- v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
+ v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < count*2) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4782,7 +4901,7 @@
goto exit;
}
if (v == NULL) {
- char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
v = (GLfloat *) (_vBase + _bufferOffset);
}
glUniform2fv(
@@ -4793,7 +4912,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, v, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -4842,7 +4961,7 @@
goto exit;
}
v_base = (GLint *)
- _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
+ _env->GetIntArrayElements(v_ref, (jboolean *)0);
v = v_base + offset;
glUniform2iv(
@@ -4853,7 +4972,7 @@
exit:
if (v_base) {
- _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
+ _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
JNI_ABORT);
}
if (_exception) {
@@ -4868,12 +4987,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *v = (GLint *) 0;
- v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
+ v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < count*2) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4881,7 +5000,7 @@
goto exit;
}
if (v == NULL) {
- char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
v = (GLint *) (_vBase + _bufferOffset);
}
glUniform2iv(
@@ -4892,7 +5011,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, v, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -4942,7 +5061,7 @@
goto exit;
}
v_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(v_ref, (jboolean *)0);
v = v_base + offset;
glUniform3fv(
@@ -4953,7 +5072,7 @@
exit:
if (v_base) {
- _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
+ _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
JNI_ABORT);
}
if (_exception) {
@@ -4968,12 +5087,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *v = (GLfloat *) 0;
- v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
+ v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < count*3) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4981,7 +5100,7 @@
goto exit;
}
if (v == NULL) {
- char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
v = (GLfloat *) (_vBase + _bufferOffset);
}
glUniform3fv(
@@ -4992,7 +5111,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, v, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5042,7 +5161,7 @@
goto exit;
}
v_base = (GLint *)
- _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
+ _env->GetIntArrayElements(v_ref, (jboolean *)0);
v = v_base + offset;
glUniform3iv(
@@ -5053,7 +5172,7 @@
exit:
if (v_base) {
- _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
+ _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
JNI_ABORT);
}
if (_exception) {
@@ -5068,12 +5187,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *v = (GLint *) 0;
- v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
+ v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < count*3) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -5081,7 +5200,7 @@
goto exit;
}
if (v == NULL) {
- char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
v = (GLint *) (_vBase + _bufferOffset);
}
glUniform3iv(
@@ -5092,7 +5211,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, v, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5143,7 +5262,7 @@
goto exit;
}
v_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(v_ref, (jboolean *)0);
v = v_base + offset;
glUniform4fv(
@@ -5154,7 +5273,7 @@
exit:
if (v_base) {
- _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
+ _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
JNI_ABORT);
}
if (_exception) {
@@ -5169,12 +5288,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *v = (GLfloat *) 0;
- v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
+ v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < count*4) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -5182,7 +5301,7 @@
goto exit;
}
if (v == NULL) {
- char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
v = (GLfloat *) (_vBase + _bufferOffset);
}
glUniform4fv(
@@ -5193,7 +5312,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, v, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5244,7 +5363,7 @@
goto exit;
}
v_base = (GLint *)
- _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
+ _env->GetIntArrayElements(v_ref, (jboolean *)0);
v = v_base + offset;
glUniform4iv(
@@ -5255,7 +5374,7 @@
exit:
if (v_base) {
- _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
+ _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
JNI_ABORT);
}
if (_exception) {
@@ -5270,12 +5389,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *v = (GLint *) 0;
- v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
+ v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < count*4) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -5283,7 +5402,7 @@
goto exit;
}
if (v == NULL) {
- char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
v = (GLint *) (_vBase + _bufferOffset);
}
glUniform4iv(
@@ -5294,7 +5413,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, v, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5332,7 +5451,7 @@
goto exit;
}
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glUniformMatrix2fv(
@@ -5344,7 +5463,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -5359,12 +5478,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < count*4) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -5372,7 +5491,7 @@
goto exit;
}
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glUniformMatrix2fv(
@@ -5384,7 +5503,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5422,7 +5541,7 @@
goto exit;
}
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glUniformMatrix3fv(
@@ -5434,7 +5553,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -5449,12 +5568,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < count*9) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -5462,7 +5581,7 @@
goto exit;
}
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glUniformMatrix3fv(
@@ -5474,7 +5593,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5512,7 +5631,7 @@
goto exit;
}
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glUniformMatrix4fv(
@@ -5524,7 +5643,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -5539,12 +5658,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < count*16) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -5552,7 +5671,7 @@
goto exit;
}
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glUniformMatrix4fv(
@@ -5564,7 +5683,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5630,7 +5749,7 @@
goto exit;
}
values_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(values_ref, (jboolean *)0);
values = values_base + offset;
glVertexAttrib1fv(
@@ -5640,7 +5759,7 @@
exit:
if (values_base) {
- _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
+ _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
JNI_ABORT);
}
if (_exception) {
@@ -5655,12 +5774,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *values = (GLfloat *) 0;
- values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
+ values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -5668,7 +5787,7 @@
goto exit;
}
if (values == NULL) {
- char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
values = (GLfloat *) (_valuesBase + _bufferOffset);
}
glVertexAttrib1fv(
@@ -5678,7 +5797,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, values, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5727,7 +5846,7 @@
goto exit;
}
values_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(values_ref, (jboolean *)0);
values = values_base + offset;
glVertexAttrib2fv(
@@ -5737,7 +5856,7 @@
exit:
if (values_base) {
- _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
+ _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
JNI_ABORT);
}
if (_exception) {
@@ -5752,12 +5871,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *values = (GLfloat *) 0;
- values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
+ values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 2) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -5765,7 +5884,7 @@
goto exit;
}
if (values == NULL) {
- char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
values = (GLfloat *) (_valuesBase + _bufferOffset);
}
glVertexAttrib2fv(
@@ -5775,7 +5894,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, values, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5825,7 +5944,7 @@
goto exit;
}
values_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(values_ref, (jboolean *)0);
values = values_base + offset;
glVertexAttrib3fv(
@@ -5835,7 +5954,7 @@
exit:
if (values_base) {
- _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
+ _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
JNI_ABORT);
}
if (_exception) {
@@ -5850,12 +5969,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *values = (GLfloat *) 0;
- values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
+ values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 3) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -5863,7 +5982,7 @@
goto exit;
}
if (values == NULL) {
- char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
values = (GLfloat *) (_valuesBase + _bufferOffset);
}
glVertexAttrib3fv(
@@ -5873,7 +5992,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, values, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5924,7 +6043,7 @@
goto exit;
}
values_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(values_ref, (jboolean *)0);
values = values_base + offset;
glVertexAttrib4fv(
@@ -5934,7 +6053,7 @@
exit:
if (values_base) {
- _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
+ _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
JNI_ABORT);
}
if (_exception) {
@@ -5949,12 +6068,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *values = (GLfloat *) 0;
- values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset);
+ values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 4) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -5962,7 +6081,7 @@
goto exit;
}
if (values == NULL) {
- char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
values = (GLfloat *) (_valuesBase + _bufferOffset);
}
glVertexAttrib4fv(
@@ -5972,7 +6091,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, values, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
diff --git a/core/jni/android_opengl_GLES30.cpp b/core/jni/android_opengl_GLES30.cpp
index 226162d..1d92cd4 100644
--- a/core/jni/android_opengl_GLES30.cpp
+++ b/core/jni/android_opengl_GLES30.cpp
@@ -126,6 +126,116 @@
return NULL;
}
+class ByteArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
+ return _env->GetByteArrayElements(array, is_copy);
+ }
+};
+class BooleanArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
+ return _env->GetBooleanArrayElements(array, is_copy);
+ }
+};
+class CharArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
+ return _env->GetCharArrayElements(array, is_copy);
+ }
+};
+class ShortArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
+ return _env->GetShortArrayElements(array, is_copy);
+ }
+};
+class IntArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
+ return _env->GetIntArrayElements(array, is_copy);
+ }
+};
+class LongArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
+ return _env->GetLongArrayElements(array, is_copy);
+ }
+};
+class FloatArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
+ return _env->GetFloatArrayElements(array, is_copy);
+ }
+};
+class DoubleArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
+ return _env->GetDoubleArrayElements(array, is_copy);
+ }
+};
+
+template<typename JTYPEARRAY, typename ARRAYGETTER>
+static void*
+getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
+ return ARRAYGETTER::Get(_env, array, is_copy);
+}
+
+class ByteArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
+ _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class BooleanArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
+ _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class CharArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
+ _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class ShortArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
+ _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class IntArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
+ _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class LongArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
+ _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class FloatArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
+ _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class DoubleArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
+ _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+
+template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
+static void
+releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
+ ARRAYRELEASER::Release(_env, array, data, commit);
+}
+
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -229,7 +339,8 @@
return needed;
}
-template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
static void
get
(JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
@@ -264,8 +375,8 @@
_exceptionMessage = "length - offset < needed";
goto exit;
}
- params_base = (CTYPE *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, params_ref, (jboolean *)0);
params = params_base + offset;
GET(
@@ -275,8 +386,8 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
- _exception ? JNI_ABORT: 0);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, params_ref, params_base, !_exception);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -284,20 +395,21 @@
}
-template <typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
static void
getarray
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
jint _exception = 0;
const char * _exceptionType;
const char * _exceptionMessage;
- jarray _array = (jarray) 0;
+ JTYPEARRAY _array = (JTYPEARRAY) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
CTYPE *params = (CTYPE *) 0;
int _needed = 0;
- params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
_remaining /= sizeof(CTYPE); // convert from bytes to item count
_needed = getNeededCount(pname);
// if we didn't find this pname, we just assume the user passed
@@ -310,7 +422,8 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, _array, (jboolean *) 0);
params = (CTYPE *) (_paramsBase + _bufferOffset);
}
GET(
@@ -320,7 +433,8 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -346,7 +460,7 @@
jint _remaining;
GLvoid *indices = (GLvoid *) 0;
- indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset);
+ indices = (GLvoid *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (indices == NULL) {
char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
indices = (GLvoid *) (_indicesBase + _bufferOffset);
@@ -387,7 +501,7 @@
jint _remaining;
GLvoid *pixels = (GLvoid *) 0;
- pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
+ pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (pixels == NULL) {
char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
@@ -436,7 +550,7 @@
jint _remaining;
GLvoid *pixels = (GLvoid *) 0;
- pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
+ pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (pixels == NULL) {
char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
@@ -504,7 +618,7 @@
jint _remaining;
GLvoid *data = (GLvoid *) 0;
- data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (data == NULL) {
char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
data = (GLvoid *) (_dataBase + _bufferOffset);
@@ -551,7 +665,7 @@
jint _remaining;
GLvoid *data = (GLvoid *) 0;
- data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (data == NULL) {
char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
data = (GLvoid *) (_dataBase + _bufferOffset);
@@ -618,7 +732,7 @@
}
_remaining = _env->GetArrayLength(ids_ref) - offset;
ids_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(ids_ref, (jboolean *)0);
+ _env->GetIntArrayElements(ids_ref, (jboolean *)0);
ids = ids_base + offset;
glGenQueries(
@@ -628,7 +742,7 @@
exit:
if (ids_base) {
- _env->ReleasePrimitiveArrayCritical(ids_ref, ids_base,
+ _env->ReleaseIntArrayElements(ids_ref, (jint*)ids_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -640,14 +754,14 @@
static void
android_glGenQueries__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint n, jobject ids_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *ids = (GLuint *) 0;
- ids = (GLuint *)getPointer(_env, ids_buf, &_array, &_remaining, &_bufferOffset);
+ ids = (GLuint *)getPointer(_env, ids_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (ids == NULL) {
- char * _idsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _idsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
ids = (GLuint *) (_idsBase + _bufferOffset);
}
glGenQueries(
@@ -655,7 +769,7 @@
(GLuint *)ids
);
if (_array) {
- releasePointer(_env, _array, ids, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)ids, 0);
}
}
@@ -684,7 +798,7 @@
}
_remaining = _env->GetArrayLength(ids_ref) - offset;
ids_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(ids_ref, (jboolean *)0);
+ _env->GetIntArrayElements(ids_ref, (jboolean *)0);
ids = ids_base + offset;
glDeleteQueries(
@@ -694,7 +808,7 @@
exit:
if (ids_base) {
- _env->ReleasePrimitiveArrayCritical(ids_ref, ids_base,
+ _env->ReleaseIntArrayElements(ids_ref, (jint*)ids_base,
JNI_ABORT);
}
if (_exception) {
@@ -706,14 +820,14 @@
static void
android_glDeleteQueries__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint n, jobject ids_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *ids = (GLuint *) 0;
- ids = (GLuint *)getPointer(_env, ids_buf, &_array, &_remaining, &_bufferOffset);
+ ids = (GLuint *)getPointer(_env, ids_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (ids == NULL) {
- char * _idsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _idsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
ids = (GLuint *) (_idsBase + _bufferOffset);
}
glDeleteQueries(
@@ -721,7 +835,7 @@
(GLuint *)ids
);
if (_array) {
- releasePointer(_env, _array, ids, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)ids, JNI_ABORT);
}
}
@@ -780,7 +894,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetQueryiv(
@@ -791,7 +905,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -803,14 +917,14 @@
static void
android_glGetQueryiv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetQueryiv(
@@ -819,7 +933,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -848,7 +962,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetQueryObjectuiv(
@@ -859,7 +973,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -871,14 +985,14 @@
static void
android_glGetQueryObjectuiv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint id, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *params = (GLuint *) 0;
- params = (GLuint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLuint *) (_paramsBase + _bufferOffset);
}
glGetQueryObjectuiv(
@@ -887,7 +1001,7 @@
(GLuint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -938,7 +1052,7 @@
}
_remaining = _env->GetArrayLength(bufs_ref) - offset;
bufs_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(bufs_ref, (jboolean *)0);
+ _env->GetIntArrayElements(bufs_ref, (jboolean *)0);
bufs = bufs_base + offset;
glDrawBuffers(
@@ -948,7 +1062,7 @@
exit:
if (bufs_base) {
- _env->ReleasePrimitiveArrayCritical(bufs_ref, bufs_base,
+ _env->ReleaseIntArrayElements(bufs_ref, (jint*)bufs_base,
JNI_ABORT);
}
if (_exception) {
@@ -960,14 +1074,14 @@
static void
android_glDrawBuffers__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint n, jobject bufs_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLenum *bufs = (GLenum *) 0;
- bufs = (GLenum *)getPointer(_env, bufs_buf, &_array, &_remaining, &_bufferOffset);
+ bufs = (GLenum *)getPointer(_env, bufs_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (bufs == NULL) {
- char * _bufsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _bufsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
bufs = (GLenum *) (_bufsBase + _bufferOffset);
}
glDrawBuffers(
@@ -975,7 +1089,7 @@
(GLenum *)bufs
);
if (_array) {
- releasePointer(_env, _array, bufs, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)bufs, JNI_ABORT);
}
}
@@ -1004,7 +1118,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glUniformMatrix2x3fv(
@@ -1016,7 +1130,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1028,14 +1142,14 @@
static void
android_glUniformMatrix2x3fv__IIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glUniformMatrix2x3fv(
@@ -1045,7 +1159,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -1074,7 +1188,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glUniformMatrix3x2fv(
@@ -1086,7 +1200,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1098,14 +1212,14 @@
static void
android_glUniformMatrix3x2fv__IIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glUniformMatrix3x2fv(
@@ -1115,7 +1229,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -1144,7 +1258,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glUniformMatrix2x4fv(
@@ -1156,7 +1270,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1168,14 +1282,14 @@
static void
android_glUniformMatrix2x4fv__IIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glUniformMatrix2x4fv(
@@ -1185,7 +1299,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -1214,7 +1328,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glUniformMatrix4x2fv(
@@ -1226,7 +1340,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1238,14 +1352,14 @@
static void
android_glUniformMatrix4x2fv__IIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glUniformMatrix4x2fv(
@@ -1255,7 +1369,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -1284,7 +1398,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glUniformMatrix3x4fv(
@@ -1296,7 +1410,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1308,14 +1422,14 @@
static void
android_glUniformMatrix3x4fv__IIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glUniformMatrix3x4fv(
@@ -1325,7 +1439,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -1354,7 +1468,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glUniformMatrix4x3fv(
@@ -1366,7 +1480,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1378,14 +1492,14 @@
static void
android_glUniformMatrix4x3fv__IIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glUniformMatrix4x3fv(
@@ -1395,7 +1509,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -1501,7 +1615,7 @@
}
_remaining = _env->GetArrayLength(arrays_ref) - offset;
arrays_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(arrays_ref, (jboolean *)0);
+ _env->GetIntArrayElements(arrays_ref, (jboolean *)0);
arrays = arrays_base + offset;
glDeleteVertexArrays(
@@ -1511,7 +1625,7 @@
exit:
if (arrays_base) {
- _env->ReleasePrimitiveArrayCritical(arrays_ref, arrays_base,
+ _env->ReleaseIntArrayElements(arrays_ref, (jint*)arrays_base,
JNI_ABORT);
}
if (_exception) {
@@ -1523,14 +1637,14 @@
static void
android_glDeleteVertexArrays__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint n, jobject arrays_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *arrays = (GLuint *) 0;
- arrays = (GLuint *)getPointer(_env, arrays_buf, &_array, &_remaining, &_bufferOffset);
+ arrays = (GLuint *)getPointer(_env, arrays_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (arrays == NULL) {
- char * _arraysBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _arraysBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
arrays = (GLuint *) (_arraysBase + _bufferOffset);
}
glDeleteVertexArrays(
@@ -1538,7 +1652,7 @@
(GLuint *)arrays
);
if (_array) {
- releasePointer(_env, _array, arrays, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)arrays, JNI_ABORT);
}
}
@@ -1567,7 +1681,7 @@
}
_remaining = _env->GetArrayLength(arrays_ref) - offset;
arrays_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(arrays_ref, (jboolean *)0);
+ _env->GetIntArrayElements(arrays_ref, (jboolean *)0);
arrays = arrays_base + offset;
glGenVertexArrays(
@@ -1577,7 +1691,7 @@
exit:
if (arrays_base) {
- _env->ReleasePrimitiveArrayCritical(arrays_ref, arrays_base,
+ _env->ReleaseIntArrayElements(arrays_ref, (jint*)arrays_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1589,14 +1703,14 @@
static void
android_glGenVertexArrays__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint n, jobject arrays_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *arrays = (GLuint *) 0;
- arrays = (GLuint *)getPointer(_env, arrays_buf, &_array, &_remaining, &_bufferOffset);
+ arrays = (GLuint *)getPointer(_env, arrays_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (arrays == NULL) {
- char * _arraysBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _arraysBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
arrays = (GLuint *) (_arraysBase + _bufferOffset);
}
glGenVertexArrays(
@@ -1604,7 +1718,7 @@
(GLuint *)arrays
);
if (_array) {
- releasePointer(_env, _array, arrays, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)arrays, 0);
}
}
@@ -1644,7 +1758,7 @@
}
_remaining = _env->GetArrayLength(data_ref) - offset;
data_base = (GLint *)
- _env->GetPrimitiveArrayCritical(data_ref, (jboolean *)0);
+ _env->GetIntArrayElements(data_ref, (jboolean *)0);
data = data_base + offset;
glGetIntegeri_v(
@@ -1655,7 +1769,7 @@
exit:
if (data_base) {
- _env->ReleasePrimitiveArrayCritical(data_ref, data_base,
+ _env->ReleaseIntArrayElements(data_ref, (jint*)data_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1667,14 +1781,14 @@
static void
android_glGetIntegeri_v__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint index, jobject data_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *data = (GLint *) 0;
- data = (GLint *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLint *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (data == NULL) {
- char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _dataBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
data = (GLint *) (_dataBase + _bufferOffset);
}
glGetIntegeri_v(
@@ -1683,7 +1797,7 @@
(GLint *)data
);
if (_array) {
- releasePointer(_env, _array, data, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)data, 0);
}
}
@@ -1810,7 +1924,7 @@
}
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
length_base = (GLsizei *)
- _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
length = length_base + lengthOffset;
if (!size_ref) {
@@ -1827,7 +1941,7 @@
}
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
size_base = (GLint *)
- _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ _env->GetIntArrayElements(size_ref, (jboolean *)0);
size = size_base + sizeOffset;
if (!type_ref) {
@@ -1844,7 +1958,7 @@
}
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
type_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ _env->GetIntArrayElements(type_ref, (jboolean *)0);
type = type_base + typeOffset;
if (!name_ref) {
@@ -1861,7 +1975,7 @@
}
_nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
name_base = (char *)
- _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
+ _env->GetByteArrayElements(name_ref, (jboolean *)0);
name = name_base + nameOffset;
glGetTransformFeedbackVarying(
@@ -1876,19 +1990,19 @@
exit:
if (name_base) {
- _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
+ _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
_exception ? JNI_ABORT: 0);
}
if (type_base) {
- _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
_exception ? JNI_ABORT: 0);
}
if (size_base) {
- _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
_exception ? JNI_ABORT: 0);
}
if (length_base) {
- _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
+ _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1900,11 +2014,11 @@
static void
android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
(JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
- jarray _lengthArray = (jarray) 0;
+ jintArray _lengthArray = (jintArray) 0;
jint _lengthBufferOffset = (jint) 0;
- jarray _sizeArray = (jarray) 0;
+ jintArray _sizeArray = (jintArray) 0;
jint _sizeBufferOffset = (jint) 0;
- jarray _typeArray = (jarray) 0;
+ jintArray _typeArray = (jintArray) 0;
jint _typeBufferOffset = (jint) 0;
jint _lengthRemaining;
GLsizei *length = (GLsizei *) 0;
@@ -1913,19 +2027,19 @@
jint _typeRemaining;
GLenum *type = (GLenum *) 0;
- length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
- size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
- type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
+ length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
+ size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
+ type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
if (length == NULL) {
- char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
+ char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
}
if (size == NULL) {
- char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
size = (GLint *) (_sizeBase + _sizeBufferOffset);
}
if (type == NULL) {
- char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
type = (GLenum *) (_typeBase + _typeBufferOffset);
}
glGetTransformFeedbackVarying(
@@ -1942,13 +2056,13 @@
(char *)static_cast<uintptr_t>(name)
);
if (_typeArray) {
- releasePointer(_env, _typeArray, type, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
}
if (_sizeArray) {
- releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
}
if (_lengthArray) {
- releasePointer(_env, _lengthArray, length, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
}
}
@@ -1993,7 +2107,7 @@
}
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
size_base = (GLint *)
- _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ _env->GetIntArrayElements(size_ref, (jboolean *)0);
size = size_base + sizeOffset;
if (!type_ref) {
@@ -2010,7 +2124,7 @@
}
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
type_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ _env->GetIntArrayElements(type_ref, (jboolean *)0);
type = type_base + typeOffset;
glGetTransformFeedbackVarying(
@@ -2024,11 +2138,11 @@
);
exit:
if (type_base) {
- _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
_exception ? JNI_ABORT: 0);
}
if (size_base) {
- _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
_exception ? JNI_ABORT: 0);
}
if (_exception != 1) {
@@ -2051,9 +2165,9 @@
static jstring
android_glGetTransformFeedbackVarying2
(JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
- jarray _sizeArray = (jarray) 0;
+ jintArray _sizeArray = (jintArray) 0;
jint _sizeBufferOffset = (jint) 0;
- jarray _typeArray = (jarray) 0;
+ jintArray _typeArray = (jintArray) 0;
jint _typeBufferOffset = (jint) 0;
jint _lengthRemaining;
GLsizei *length = (GLsizei *) 0;
@@ -2076,14 +2190,14 @@
return NULL;
}
- size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
- type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
+ size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
+ type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
if (size == NULL) {
- char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
size = (GLint *) (_sizeBase + _sizeBufferOffset);
}
if (type == NULL) {
- char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
type = (GLenum *) (_typeBase + _typeBufferOffset);
}
glGetTransformFeedbackVarying(
@@ -2097,10 +2211,10 @@
);
if (_typeArray) {
- releasePointer(_env, _typeArray, type, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
}
if (_sizeArray) {
- releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
}
result = _env->NewStringUTF(buf);
if (buf) {
@@ -2171,7 +2285,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetVertexAttribIiv(
@@ -2182,7 +2296,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2194,14 +2308,14 @@
static void
android_glGetVertexAttribIiv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetVertexAttribIiv(
@@ -2210,7 +2324,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -2239,7 +2353,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetVertexAttribIuiv(
@@ -2250,7 +2364,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2262,14 +2376,14 @@
static void
android_glGetVertexAttribIuiv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *params = (GLuint *) 0;
- params = (GLuint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLuint *) (_paramsBase + _bufferOffset);
}
glGetVertexAttribIuiv(
@@ -2278,7 +2392,7 @@
(GLuint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -2333,7 +2447,7 @@
}
_remaining = _env->GetArrayLength(v_ref) - offset;
v_base = (GLint *)
- _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
+ _env->GetIntArrayElements(v_ref, (jboolean *)0);
v = v_base + offset;
glVertexAttribI4iv(
@@ -2343,7 +2457,7 @@
exit:
if (v_base) {
- _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
+ _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
JNI_ABORT);
}
if (_exception) {
@@ -2355,14 +2469,14 @@
static void
android_glVertexAttribI4iv__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint index, jobject v_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *v = (GLint *) 0;
- v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
+ v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (v == NULL) {
- char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
v = (GLint *) (_vBase + _bufferOffset);
}
glVertexAttribI4iv(
@@ -2370,7 +2484,7 @@
(GLint *)v
);
if (_array) {
- releasePointer(_env, _array, v, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
}
}
@@ -2399,7 +2513,7 @@
}
_remaining = _env->GetArrayLength(v_ref) - offset;
v_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0);
+ _env->GetIntArrayElements(v_ref, (jboolean *)0);
v = v_base + offset;
glVertexAttribI4uiv(
@@ -2409,7 +2523,7 @@
exit:
if (v_base) {
- _env->ReleasePrimitiveArrayCritical(v_ref, v_base,
+ _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
JNI_ABORT);
}
if (_exception) {
@@ -2421,14 +2535,14 @@
static void
android_glVertexAttribI4uiv__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint index, jobject v_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *v = (GLuint *) 0;
- v = (GLuint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset);
+ v = (GLuint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (v == NULL) {
- char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
v = (GLuint *) (_vBase + _bufferOffset);
}
glVertexAttribI4uiv(
@@ -2436,7 +2550,7 @@
(GLuint *)v
);
if (_array) {
- releasePointer(_env, _array, v, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
}
}
@@ -2465,7 +2579,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetUniformuiv(
@@ -2476,7 +2590,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2488,14 +2602,14 @@
static void
android_glGetUniformuiv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *params = (GLuint *) 0;
- params = (GLuint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLuint *) (_paramsBase + _bufferOffset);
}
glGetUniformuiv(
@@ -2504,7 +2618,7 @@
(GLuint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -2613,7 +2727,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glUniform1uiv(
@@ -2624,7 +2738,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2636,14 +2750,14 @@
static void
android_glUniform1uiv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *value = (GLuint *) 0;
- value = (GLuint *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
value = (GLuint *) (_valueBase + _bufferOffset);
}
glUniform1uiv(
@@ -2652,7 +2766,7 @@
(GLuint *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
}
}
@@ -2681,7 +2795,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glUniform2uiv(
@@ -2692,7 +2806,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2704,14 +2818,14 @@
static void
android_glUniform2uiv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *value = (GLuint *) 0;
- value = (GLuint *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
value = (GLuint *) (_valueBase + _bufferOffset);
}
glUniform2uiv(
@@ -2720,7 +2834,7 @@
(GLuint *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
}
}
@@ -2749,7 +2863,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glUniform3uiv(
@@ -2760,7 +2874,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2772,14 +2886,14 @@
static void
android_glUniform3uiv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *value = (GLuint *) 0;
- value = (GLuint *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
value = (GLuint *) (_valueBase + _bufferOffset);
}
glUniform3uiv(
@@ -2788,7 +2902,7 @@
(GLuint *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
}
}
@@ -2817,7 +2931,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glUniform4uiv(
@@ -2828,7 +2942,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2840,14 +2954,14 @@
static void
android_glUniform4uiv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *value = (GLuint *) 0;
- value = (GLuint *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
value = (GLuint *) (_valueBase + _bufferOffset);
}
glUniform4uiv(
@@ -2856,7 +2970,7 @@
(GLuint *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
}
}
@@ -2885,7 +2999,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glClearBufferiv(
@@ -2896,7 +3010,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2908,14 +3022,14 @@
static void
android_glClearBufferiv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint buffer, jint drawbuffer, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *value = (GLint *) 0;
- value = (GLint *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
value = (GLint *) (_valueBase + _bufferOffset);
}
glClearBufferiv(
@@ -2924,7 +3038,7 @@
(GLint *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
}
}
@@ -2953,7 +3067,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glClearBufferuiv(
@@ -2964,7 +3078,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2976,14 +3090,14 @@
static void
android_glClearBufferuiv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint buffer, jint drawbuffer, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *value = (GLuint *) 0;
- value = (GLuint *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
value = (GLuint *) (_valueBase + _bufferOffset);
}
glClearBufferuiv(
@@ -2992,7 +3106,7 @@
(GLuint *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
}
}
@@ -3021,7 +3135,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glClearBufferfv(
@@ -3032,7 +3146,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -3044,14 +3158,14 @@
static void
android_glClearBufferfv__IILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint buffer, jint drawbuffer, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glClearBufferfv(
@@ -3060,7 +3174,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -3148,7 +3262,7 @@
_exceptionMessage = "not enough space in uniformIndices";
goto exit;
}
- _indices_base = (GLuint*)_env->GetPrimitiveArrayCritical(
+ _indices_base = (GLuint*)_env->GetIntArrayElements(
uniformIndices_ref, 0);
_indices = _indices_base + uniformIndicesOffset;
@@ -3156,8 +3270,8 @@
exit:
if (_indices_base) {
- _env->ReleasePrimitiveArrayCritical(uniformIndices_ref, _indices_base,
- _exception ? JNI_ABORT : 0);
+ _env->ReleaseIntArrayElements(uniformIndices_ref, (jint*)_indices_base,
+ _exception ? JNI_ABORT : 0);
}
for (_i = _count - 1; _i >= 0; _i--) {
if (_names[_i]) {
@@ -3184,7 +3298,7 @@
jint _count = 0;
jint _i;
const char** _names = NULL;
- jarray _uniformIndicesArray = (jarray)0;
+ jintArray _uniformIndicesArray = (jintArray)0;
jint _uniformIndicesRemaining;
jint _uniformIndicesOffset = 0;
GLuint* _indices = NULL;
@@ -3217,11 +3331,11 @@
}
_indices = (GLuint*)getPointer(_env, uniformIndices_buf,
- &_uniformIndicesArray, &_uniformIndicesRemaining,
+ (jarray*)&_uniformIndicesArray, &_uniformIndicesRemaining,
&_uniformIndicesOffset);
if (!_indices) {
- _indicesBase = (char*)_env->GetPrimitiveArrayCritical(
- _uniformIndicesArray, 0);
+ _indicesBase = (char*)_env->GetIntArrayElements(
+ _uniformIndicesArray, 0);
_indices = (GLuint*)(_indicesBase + _uniformIndicesOffset);
}
if (_uniformIndicesRemaining < _count) {
@@ -3235,7 +3349,8 @@
exit:
if (_uniformIndicesArray) {
- releasePointer(_env, _uniformIndicesArray, _indicesBase, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(
+ _env, _uniformIndicesArray, (jint*)_indicesBase, JNI_TRUE);
}
for (_i = _count - 1; _i >= 0; _i--) {
if (_names[_i]) {
@@ -3250,7 +3365,6 @@
jniThrowException(_env, _exceptionType, _exceptionMessage);
}
}
-
/* void glGetActiveUniformsiv ( GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params ) */
static void
android_glGetActiveUniformsiv__II_3III_3II
@@ -3279,7 +3393,7 @@
}
_uniformIndicesRemaining = _env->GetArrayLength(uniformIndices_ref) - uniformIndicesOffset;
uniformIndices_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(uniformIndices_ref, (jboolean *)0);
+ _env->GetIntArrayElements(uniformIndices_ref, (jboolean *)0);
uniformIndices = uniformIndices_base + uniformIndicesOffset;
if (!params_ref) {
@@ -3296,7 +3410,7 @@
}
_paramsRemaining = _env->GetArrayLength(params_ref) - paramsOffset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + paramsOffset;
glGetActiveUniformsiv(
@@ -3309,11 +3423,11 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (uniformIndices_base) {
- _env->ReleasePrimitiveArrayCritical(uniformIndices_ref, uniformIndices_base,
+ _env->ReleaseIntArrayElements(uniformIndices_ref, (jint*)uniformIndices_base,
JNI_ABORT);
}
if (_exception) {
@@ -3325,23 +3439,23 @@
static void
android_glGetActiveUniformsiv__IILjava_nio_IntBuffer_2ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint uniformCount, jobject uniformIndices_buf, jint pname, jobject params_buf) {
- jarray _uniformIndicesArray = (jarray) 0;
+ jintArray _uniformIndicesArray = (jintArray) 0;
jint _uniformIndicesBufferOffset = (jint) 0;
- jarray _paramsArray = (jarray) 0;
+ jintArray _paramsArray = (jintArray) 0;
jint _paramsBufferOffset = (jint) 0;
jint _uniformIndicesRemaining;
GLuint *uniformIndices = (GLuint *) 0;
jint _paramsRemaining;
GLint *params = (GLint *) 0;
- uniformIndices = (GLuint *)getPointer(_env, uniformIndices_buf, &_uniformIndicesArray, &_uniformIndicesRemaining, &_uniformIndicesBufferOffset);
- params = (GLint *)getPointer(_env, params_buf, &_paramsArray, &_paramsRemaining, &_paramsBufferOffset);
+ uniformIndices = (GLuint *)getPointer(_env, uniformIndices_buf, (jarray*)&_uniformIndicesArray, &_uniformIndicesRemaining, &_uniformIndicesBufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_paramsArray, &_paramsRemaining, &_paramsBufferOffset);
if (uniformIndices == NULL) {
- char * _uniformIndicesBase = (char *)_env->GetPrimitiveArrayCritical(_uniformIndicesArray, (jboolean *) 0);
+ char * _uniformIndicesBase = (char *)_env->GetIntArrayElements(_uniformIndicesArray, (jboolean *) 0);
uniformIndices = (GLuint *) (_uniformIndicesBase + _uniformIndicesBufferOffset);
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_paramsArray, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_paramsArray, (jboolean *) 0);
params = (GLint *) (_paramsBase + _paramsBufferOffset);
}
glGetActiveUniformsiv(
@@ -3352,10 +3466,10 @@
(GLint *)params
);
if (_paramsArray) {
- releasePointer(_env, _paramsArray, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_paramsArray, (jint*)params, 0);
}
if (_uniformIndicesArray) {
- releasePointer(_env, _uniformIndicesArray, uniformIndices, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_uniformIndicesArray, (jint*)uniformIndices, JNI_ABORT);
}
}
@@ -3418,7 +3532,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetActiveUniformBlockiv(
@@ -3430,7 +3544,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3442,14 +3556,14 @@
static void
android_glGetActiveUniformBlockiv__IIILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint uniformBlockIndex, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetActiveUniformBlockiv(
@@ -3459,7 +3573,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -3490,7 +3604,7 @@
goto exit;
}
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
- _length_base = (GLsizei*)_env->GetPrimitiveArrayCritical(
+ _length_base = (GLsizei*)_env->GetIntArrayElements(
length_ref, (jboolean*)0);
_length = _length_base + lengthOffset;
@@ -3507,7 +3621,7 @@
goto exit;
}
_nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
- _name_base = (GLchar*)_env->GetPrimitiveArrayCritical(
+ _name_base = (GLchar*)_env->GetByteArrayElements(
name_ref, (jboolean*)0);
_name = _name_base + nameOffset;
@@ -3521,11 +3635,11 @@
exit:
if (_name_base) {
- _env->ReleasePrimitiveArrayCritical(name_ref, _name_base,
+ _env->ReleaseByteArrayElements(name_ref, (jbyte*)_name_base,
_exception ? JNI_ABORT: 0);
}
if (_length_base) {
- _env->ReleasePrimitiveArrayCritical(length_ref, _length_base,
+ _env->ReleaseIntArrayElements(length_ref, (jint*)_length_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3589,7 +3703,6 @@
free(name);
return result;
}
-
/* void glUniformBlockBinding ( GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding ) */
static void
android_glUniformBlockBinding__III
@@ -3651,7 +3764,6 @@
(GLsizei)instanceCount
);
}
-
/* GLsync glFenceSync ( GLenum condition, GLbitfield flags ) */
static jlong
android_glFenceSync__II
@@ -3733,7 +3845,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint64 *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetLongArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetInteger64v(
@@ -3743,7 +3855,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseLongArrayElements(params_ref, (jlong*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3755,14 +3867,14 @@
static void
android_glGetInteger64v__ILjava_nio_LongBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jlongArray _array = (jlongArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint64 *params = (GLint64 *) 0;
- params = (GLint64 *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint64 *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetLongArrayElements(_array, (jboolean *) 0);
params = (GLint64 *) (_paramsBase + _bufferOffset);
}
glGetInteger64v(
@@ -3770,7 +3882,7 @@
(GLint64 *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseLongArrayElements(_array, (jlong*)params, 0);
}
}
@@ -3802,7 +3914,7 @@
}
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
length_base = (GLsizei *)
- _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
length = length_base + lengthOffset;
if (!values_ref) {
@@ -3819,7 +3931,7 @@
}
_valuesRemaining = _env->GetArrayLength(values_ref) - valuesOffset;
values_base = (GLint *)
- _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0);
+ _env->GetIntArrayElements(values_ref, (jboolean *)0);
values = values_base + valuesOffset;
glGetSynciv(
@@ -3832,11 +3944,11 @@
exit:
if (values_base) {
- _env->ReleasePrimitiveArrayCritical(values_ref, values_base,
+ _env->ReleaseIntArrayElements(values_ref, (jint*)values_base,
_exception ? JNI_ABORT: 0);
}
if (length_base) {
- _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
+ _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3848,23 +3960,23 @@
static void
android_glGetSynciv__JIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jlong sync, jint pname, jint bufSize, jobject length_buf, jobject values_buf) {
- jarray _lengthArray = (jarray) 0;
+ jintArray _lengthArray = (jintArray) 0;
jint _lengthBufferOffset = (jint) 0;
- jarray _valuesArray = (jarray) 0;
+ jintArray _valuesArray = (jintArray) 0;
jint _valuesBufferOffset = (jint) 0;
jint _lengthRemaining;
GLsizei *length = (GLsizei *) 0;
jint _valuesRemaining;
GLint *values = (GLint *) 0;
- length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
- values = (GLint *)getPointer(_env, values_buf, &_valuesArray, &_valuesRemaining, &_valuesBufferOffset);
+ length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
+ values = (GLint *)getPointer(_env, values_buf, (jarray*)&_valuesArray, &_valuesRemaining, &_valuesBufferOffset);
if (length == NULL) {
- char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
+ char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
}
if (values == NULL) {
- char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_valuesArray, (jboolean *) 0);
+ char * _valuesBase = (char *)_env->GetIntArrayElements(_valuesArray, (jboolean *) 0);
values = (GLint *) (_valuesBase + _valuesBufferOffset);
}
glGetSynciv(
@@ -3875,10 +3987,10 @@
(GLint *)values
);
if (_valuesArray) {
- releasePointer(_env, _valuesArray, values, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_valuesArray, (jint*)values, 0);
}
if (_lengthArray) {
- releasePointer(_env, _lengthArray, length, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_lengthArray, (jint*)length, 0);
}
}
@@ -3907,7 +4019,7 @@
}
_remaining = _env->GetArrayLength(data_ref) - offset;
data_base = (GLint64 *)
- _env->GetPrimitiveArrayCritical(data_ref, (jboolean *)0);
+ _env->GetLongArrayElements(data_ref, (jboolean *)0);
data = data_base + offset;
glGetInteger64i_v(
@@ -3918,7 +4030,7 @@
exit:
if (data_base) {
- _env->ReleasePrimitiveArrayCritical(data_ref, data_base,
+ _env->ReleaseLongArrayElements(data_ref, (jlong*)data_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3930,14 +4042,14 @@
static void
android_glGetInteger64i_v__IILjava_nio_LongBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint index, jobject data_buf) {
- jarray _array = (jarray) 0;
+ jlongArray _array = (jlongArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint64 *data = (GLint64 *) 0;
- data = (GLint64 *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLint64 *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (data == NULL) {
- char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _dataBase = (char *)_env->GetLongArrayElements(_array, (jboolean *) 0);
data = (GLint64 *) (_dataBase + _bufferOffset);
}
glGetInteger64i_v(
@@ -3946,7 +4058,7 @@
(GLint64 *)data
);
if (_array) {
- releasePointer(_env, _array, data, JNI_TRUE);
+ _env->ReleaseLongArrayElements(_array, (jlong*)data, 0);
}
}
@@ -3975,7 +4087,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint64 *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetLongArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetBufferParameteri64v(
@@ -3986,7 +4098,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseLongArrayElements(params_ref, (jlong*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -3998,14 +4110,14 @@
static void
android_glGetBufferParameteri64v__IILjava_nio_LongBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jlongArray _array = (jlongArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint64 *params = (GLint64 *) 0;
- params = (GLint64 *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint64 *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetLongArrayElements(_array, (jboolean *) 0);
params = (GLint64 *) (_paramsBase + _bufferOffset);
}
glGetBufferParameteri64v(
@@ -4014,7 +4126,7 @@
(GLint64 *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseLongArrayElements(_array, (jlong*)params, 0);
}
}
@@ -4043,7 +4155,7 @@
}
_remaining = _env->GetArrayLength(samplers_ref) - offset;
samplers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(samplers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(samplers_ref, (jboolean *)0);
samplers = samplers_base + offset;
glGenSamplers(
@@ -4053,7 +4165,7 @@
exit:
if (samplers_base) {
- _env->ReleasePrimitiveArrayCritical(samplers_ref, samplers_base,
+ _env->ReleaseIntArrayElements(samplers_ref, (jint*)samplers_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -4065,14 +4177,14 @@
static void
android_glGenSamplers__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint count, jobject samplers_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *samplers = (GLuint *) 0;
- samplers = (GLuint *)getPointer(_env, samplers_buf, &_array, &_remaining, &_bufferOffset);
+ samplers = (GLuint *)getPointer(_env, samplers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (samplers == NULL) {
- char * _samplersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _samplersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
samplers = (GLuint *) (_samplersBase + _bufferOffset);
}
glGenSamplers(
@@ -4080,7 +4192,7 @@
(GLuint *)samplers
);
if (_array) {
- releasePointer(_env, _array, samplers, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)samplers, 0);
}
}
@@ -4109,7 +4221,7 @@
}
_remaining = _env->GetArrayLength(samplers_ref) - offset;
samplers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(samplers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(samplers_ref, (jboolean *)0);
samplers = samplers_base + offset;
glDeleteSamplers(
@@ -4119,7 +4231,7 @@
exit:
if (samplers_base) {
- _env->ReleasePrimitiveArrayCritical(samplers_ref, samplers_base,
+ _env->ReleaseIntArrayElements(samplers_ref, (jint*)samplers_base,
JNI_ABORT);
}
if (_exception) {
@@ -4131,14 +4243,14 @@
static void
android_glDeleteSamplers__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint count, jobject samplers_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *samplers = (GLuint *) 0;
- samplers = (GLuint *)getPointer(_env, samplers_buf, &_array, &_remaining, &_bufferOffset);
+ samplers = (GLuint *)getPointer(_env, samplers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (samplers == NULL) {
- char * _samplersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _samplersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
samplers = (GLuint *) (_samplersBase + _bufferOffset);
}
glDeleteSamplers(
@@ -4146,7 +4258,7 @@
(GLuint *)samplers
);
if (_array) {
- releasePointer(_env, _array, samplers, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)samplers, JNI_ABORT);
}
}
@@ -4207,7 +4319,7 @@
}
_remaining = _env->GetArrayLength(param_ref) - offset;
param_base = (GLint *)
- _env->GetPrimitiveArrayCritical(param_ref, (jboolean *)0);
+ _env->GetIntArrayElements(param_ref, (jboolean *)0);
param = param_base + offset;
glSamplerParameteriv(
@@ -4218,7 +4330,7 @@
exit:
if (param_base) {
- _env->ReleasePrimitiveArrayCritical(param_ref, param_base,
+ _env->ReleaseIntArrayElements(param_ref, (jint*)param_base,
JNI_ABORT);
}
if (_exception) {
@@ -4230,14 +4342,14 @@
static void
android_glSamplerParameteriv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject param_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *param = (GLint *) 0;
- param = (GLint *)getPointer(_env, param_buf, &_array, &_remaining, &_bufferOffset);
+ param = (GLint *)getPointer(_env, param_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (param == NULL) {
- char * _paramBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
param = (GLint *) (_paramBase + _bufferOffset);
}
glSamplerParameteriv(
@@ -4246,7 +4358,7 @@
(GLint *)param
);
if (_array) {
- releasePointer(_env, _array, param, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)param, JNI_ABORT);
}
}
@@ -4286,7 +4398,7 @@
}
_remaining = _env->GetArrayLength(param_ref) - offset;
param_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(param_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(param_ref, (jboolean *)0);
param = param_base + offset;
glSamplerParameterfv(
@@ -4297,7 +4409,7 @@
exit:
if (param_base) {
- _env->ReleasePrimitiveArrayCritical(param_ref, param_base,
+ _env->ReleaseFloatArrayElements(param_ref, (jfloat*)param_base,
JNI_ABORT);
}
if (_exception) {
@@ -4309,14 +4421,14 @@
static void
android_glSamplerParameterfv__IILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject param_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *param = (GLfloat *) 0;
- param = (GLfloat *)getPointer(_env, param_buf, &_array, &_remaining, &_bufferOffset);
+ param = (GLfloat *)getPointer(_env, param_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (param == NULL) {
- char * _paramBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
param = (GLfloat *) (_paramBase + _bufferOffset);
}
glSamplerParameterfv(
@@ -4325,7 +4437,7 @@
(GLfloat *)param
);
if (_array) {
- releasePointer(_env, _array, param, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)param, JNI_ABORT);
}
}
@@ -4354,7 +4466,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetSamplerParameteriv(
@@ -4365,7 +4477,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -4377,14 +4489,14 @@
static void
android_glGetSamplerParameteriv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetSamplerParameteriv(
@@ -4393,7 +4505,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -4422,7 +4534,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetSamplerParameterfv(
@@ -4433,7 +4545,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -4445,14 +4557,14 @@
static void
android_glGetSamplerParameterfv__IILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetSamplerParameterfv(
@@ -4461,7 +4573,7 @@
(GLfloat *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, 0);
}
}
@@ -4510,7 +4622,7 @@
}
_remaining = _env->GetArrayLength(ids_ref) - offset;
ids_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(ids_ref, (jboolean *)0);
+ _env->GetIntArrayElements(ids_ref, (jboolean *)0);
ids = ids_base + offset;
glDeleteTransformFeedbacks(
@@ -4520,7 +4632,7 @@
exit:
if (ids_base) {
- _env->ReleasePrimitiveArrayCritical(ids_ref, ids_base,
+ _env->ReleaseIntArrayElements(ids_ref, (jint*)ids_base,
JNI_ABORT);
}
if (_exception) {
@@ -4532,14 +4644,14 @@
static void
android_glDeleteTransformFeedbacks__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint n, jobject ids_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *ids = (GLuint *) 0;
- ids = (GLuint *)getPointer(_env, ids_buf, &_array, &_remaining, &_bufferOffset);
+ ids = (GLuint *)getPointer(_env, ids_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (ids == NULL) {
- char * _idsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _idsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
ids = (GLuint *) (_idsBase + _bufferOffset);
}
glDeleteTransformFeedbacks(
@@ -4547,7 +4659,7 @@
(GLuint *)ids
);
if (_array) {
- releasePointer(_env, _array, ids, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)ids, JNI_ABORT);
}
}
@@ -4576,7 +4688,7 @@
}
_remaining = _env->GetArrayLength(ids_ref) - offset;
ids_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(ids_ref, (jboolean *)0);
+ _env->GetIntArrayElements(ids_ref, (jboolean *)0);
ids = ids_base + offset;
glGenTransformFeedbacks(
@@ -4586,7 +4698,7 @@
exit:
if (ids_base) {
- _env->ReleasePrimitiveArrayCritical(ids_ref, ids_base,
+ _env->ReleaseIntArrayElements(ids_ref, (jint*)ids_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -4598,14 +4710,14 @@
static void
android_glGenTransformFeedbacks__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint n, jobject ids_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *ids = (GLuint *) 0;
- ids = (GLuint *)getPointer(_env, ids_buf, &_array, &_remaining, &_bufferOffset);
+ ids = (GLuint *)getPointer(_env, ids_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (ids == NULL) {
- char * _idsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _idsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
ids = (GLuint *) (_idsBase + _bufferOffset);
}
glGenTransformFeedbacks(
@@ -4613,7 +4725,7 @@
(GLuint *)ids
);
if (_array) {
- releasePointer(_env, _array, ids, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)ids, 0);
}
}
@@ -4674,7 +4786,7 @@
}
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
length_base = (GLsizei *)
- _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
length = length_base + lengthOffset;
if (!binaryFormat_ref) {
@@ -4691,10 +4803,10 @@
}
_binaryFormatRemaining = _env->GetArrayLength(binaryFormat_ref) - binaryFormatOffset;
binaryFormat_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(binaryFormat_ref, (jboolean *)0);
+ _env->GetIntArrayElements(binaryFormat_ref, (jboolean *)0);
binaryFormat = binaryFormat_base + binaryFormatOffset;
- binary = (GLvoid *)getPointer(_env, binary_buf, &_array, &_binaryRemaining, &_bufferOffset);
+ binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_array, &_binaryRemaining, &_bufferOffset);
if (binary == NULL) {
char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
binary = (GLvoid *) (_binaryBase + _bufferOffset);
@@ -4712,11 +4824,11 @@
releasePointer(_env, _array, binary, _exception ? JNI_FALSE : JNI_TRUE);
}
if (binaryFormat_base) {
- _env->ReleasePrimitiveArrayCritical(binaryFormat_ref, binaryFormat_base,
+ _env->ReleaseIntArrayElements(binaryFormat_ref, (jint*)binaryFormat_base,
_exception ? JNI_ABORT: 0);
}
if (length_base) {
- _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
+ _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -4728,11 +4840,11 @@
static void
android_glGetProgramBinary__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_Buffer_2
(JNIEnv *_env, jobject _this, jint program, jint bufSize, jobject length_buf, jobject binaryFormat_buf, jobject binary_buf) {
- jarray _lengthArray = (jarray) 0;
+ jintArray _lengthArray = (jintArray) 0;
jint _lengthBufferOffset = (jint) 0;
- jarray _binaryFormatArray = (jarray) 0;
+ jintArray _binaryFormatArray = (jintArray) 0;
jint _binaryFormatBufferOffset = (jint) 0;
- jarray _binaryArray = (jarray) 0;
+ jintArray _binaryArray = (jintArray) 0;
jint _binaryBufferOffset = (jint) 0;
jint _lengthRemaining;
GLsizei *length = (GLsizei *) 0;
@@ -4741,15 +4853,15 @@
jint _binaryRemaining;
GLvoid *binary = (GLvoid *) 0;
- length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
- binaryFormat = (GLenum *)getPointer(_env, binaryFormat_buf, &_binaryFormatArray, &_binaryFormatRemaining, &_binaryFormatBufferOffset);
- binary = (GLvoid *)getPointer(_env, binary_buf, &_binaryArray, &_binaryRemaining, &_binaryBufferOffset);
+ length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
+ binaryFormat = (GLenum *)getPointer(_env, binaryFormat_buf, (jarray*)&_binaryFormatArray, &_binaryFormatRemaining, &_binaryFormatBufferOffset);
+ binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_binaryArray, &_binaryRemaining, &_binaryBufferOffset);
if (length == NULL) {
- char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
+ char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
}
if (binaryFormat == NULL) {
- char * _binaryFormatBase = (char *)_env->GetPrimitiveArrayCritical(_binaryFormatArray, (jboolean *) 0);
+ char * _binaryFormatBase = (char *)_env->GetIntArrayElements(_binaryFormatArray, (jboolean *) 0);
binaryFormat = (GLenum *) (_binaryFormatBase + _binaryFormatBufferOffset);
}
if (binary == NULL) {
@@ -4767,10 +4879,10 @@
releasePointer(_env, _binaryArray, binary, JNI_TRUE);
}
if (_binaryFormatArray) {
- releasePointer(_env, _binaryFormatArray, binaryFormat, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_binaryFormatArray, (jint*)binaryFormat, 0);
}
if (_lengthArray) {
- releasePointer(_env, _lengthArray, length, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_lengthArray, (jint*)length, 0);
}
}
@@ -4783,7 +4895,7 @@
jint _remaining;
GLvoid *binary = (GLvoid *) 0;
- binary = (GLvoid *)getPointer(_env, binary_buf, &_array, &_remaining, &_bufferOffset);
+ binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (binary == NULL) {
char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
binary = (GLvoid *) (_binaryBase + _bufferOffset);
@@ -4835,7 +4947,7 @@
}
_remaining = _env->GetArrayLength(attachments_ref) - offset;
attachments_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(attachments_ref, (jboolean *)0);
+ _env->GetIntArrayElements(attachments_ref, (jboolean *)0);
attachments = attachments_base + offset;
glInvalidateFramebuffer(
@@ -4846,7 +4958,7 @@
exit:
if (attachments_base) {
- _env->ReleasePrimitiveArrayCritical(attachments_ref, attachments_base,
+ _env->ReleaseIntArrayElements(attachments_ref, (jint*)attachments_base,
JNI_ABORT);
}
if (_exception) {
@@ -4858,14 +4970,14 @@
static void
android_glInvalidateFramebuffer__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint numAttachments, jobject attachments_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLenum *attachments = (GLenum *) 0;
- attachments = (GLenum *)getPointer(_env, attachments_buf, &_array, &_remaining, &_bufferOffset);
+ attachments = (GLenum *)getPointer(_env, attachments_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (attachments == NULL) {
- char * _attachmentsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _attachmentsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
attachments = (GLenum *) (_attachmentsBase + _bufferOffset);
}
glInvalidateFramebuffer(
@@ -4874,7 +4986,7 @@
(GLenum *)attachments
);
if (_array) {
- releasePointer(_env, _array, attachments, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)attachments, JNI_ABORT);
}
}
@@ -4903,7 +5015,7 @@
}
_remaining = _env->GetArrayLength(attachments_ref) - offset;
attachments_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(attachments_ref, (jboolean *)0);
+ _env->GetIntArrayElements(attachments_ref, (jboolean *)0);
attachments = attachments_base + offset;
glInvalidateSubFramebuffer(
@@ -4918,7 +5030,7 @@
exit:
if (attachments_base) {
- _env->ReleasePrimitiveArrayCritical(attachments_ref, attachments_base,
+ _env->ReleaseIntArrayElements(attachments_ref, (jint*)attachments_base,
JNI_ABORT);
}
if (_exception) {
@@ -4930,14 +5042,14 @@
static void
android_glInvalidateSubFramebuffer__IILjava_nio_IntBuffer_2IIII
(JNIEnv *_env, jobject _this, jint target, jint numAttachments, jobject attachments_buf, jint x, jint y, jint width, jint height) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLenum *attachments = (GLenum *) 0;
- attachments = (GLenum *)getPointer(_env, attachments_buf, &_array, &_remaining, &_bufferOffset);
+ attachments = (GLenum *)getPointer(_env, attachments_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (attachments == NULL) {
- char * _attachmentsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _attachmentsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
attachments = (GLenum *) (_attachmentsBase + _bufferOffset);
}
glInvalidateSubFramebuffer(
@@ -4950,7 +5062,7 @@
(GLsizei)height
);
if (_array) {
- releasePointer(_env, _array, attachments, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)attachments, JNI_ABORT);
}
}
@@ -5006,7 +5118,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetInternalformativ(
@@ -5019,7 +5131,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -5031,14 +5143,14 @@
static void
android_glGetInternalformativ__IIIILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint internalformat, jint pname, jint bufSize, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetInternalformativ(
@@ -5049,7 +5161,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
diff --git a/core/jni/android_opengl_GLES31.cpp b/core/jni/android_opengl_GLES31.cpp
index e5ea950..92ecbe0 100644
--- a/core/jni/android_opengl_GLES31.cpp
+++ b/core/jni/android_opengl_GLES31.cpp
@@ -124,6 +124,116 @@
return NULL;
}
+class ByteArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
+ return _env->GetByteArrayElements(array, is_copy);
+ }
+};
+class BooleanArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
+ return _env->GetBooleanArrayElements(array, is_copy);
+ }
+};
+class CharArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
+ return _env->GetCharArrayElements(array, is_copy);
+ }
+};
+class ShortArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
+ return _env->GetShortArrayElements(array, is_copy);
+ }
+};
+class IntArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
+ return _env->GetIntArrayElements(array, is_copy);
+ }
+};
+class LongArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
+ return _env->GetLongArrayElements(array, is_copy);
+ }
+};
+class FloatArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
+ return _env->GetFloatArrayElements(array, is_copy);
+ }
+};
+class DoubleArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
+ return _env->GetDoubleArrayElements(array, is_copy);
+ }
+};
+
+template<typename JTYPEARRAY, typename ARRAYGETTER>
+static void*
+getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
+ return ARRAYGETTER::Get(_env, array, is_copy);
+}
+
+class ByteArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
+ _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class BooleanArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
+ _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class CharArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
+ _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class ShortArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
+ _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class IntArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
+ _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class LongArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
+ _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class FloatArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
+ _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class DoubleArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
+ _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+
+template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
+static void
+releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
+ ARRAYRELEASER::Release(_env, array, data, commit);
+}
+
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -227,7 +337,8 @@
return needed;
}
-template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
static void
get
(JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
@@ -262,8 +373,8 @@
_exceptionMessage = "length - offset < needed";
goto exit;
}
- params_base = (CTYPE *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, params_ref, (jboolean *)0);
params = params_base + offset;
GET(
@@ -273,8 +384,8 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
- _exception ? JNI_ABORT: 0);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, params_ref, params_base, !_exception);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -282,20 +393,21 @@
}
-template <typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
static void
getarray
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
jint _exception = 0;
const char * _exceptionType;
const char * _exceptionMessage;
- jarray _array = (jarray) 0;
+ JTYPEARRAY _array = (JTYPEARRAY) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
CTYPE *params = (CTYPE *) 0;
int _needed = 0;
- params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
_remaining /= sizeof(CTYPE); // convert from bytes to item count
_needed = getNeededCount(pname);
// if we didn't find this pname, we just assume the user passed
@@ -308,7 +420,8 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, _array, (jboolean *) 0);
params = (CTYPE *) (_paramsBase + _bufferOffset);
}
GET(
@@ -318,7 +431,8 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -410,7 +524,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetFramebufferParameteriv(
@@ -421,7 +535,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -433,14 +547,14 @@
static void
android_glGetFramebufferParameteriv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetFramebufferParameteriv(
@@ -449,7 +563,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -478,7 +592,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetProgramInterfaceiv(
@@ -490,7 +604,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -502,14 +616,14 @@
static void
android_glGetProgramInterfaceiv__IIILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint programInterface, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetProgramInterfaceiv(
@@ -519,7 +633,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -597,7 +711,7 @@
}
_propsRemaining = _env->GetArrayLength(props_ref) - propsOffset;
props_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(props_ref, (jboolean *)0);
+ _env->GetIntArrayElements(props_ref, (jboolean *)0);
props = props_base + propsOffset;
if (!length_ref) {
@@ -614,7 +728,7 @@
}
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
length_base = (GLsizei *)
- _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
length = length_base + lengthOffset;
if (!params_ref) {
@@ -631,7 +745,7 @@
}
_paramsRemaining = _env->GetArrayLength(params_ref) - paramsOffset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + paramsOffset;
glGetProgramResourceiv(
@@ -647,15 +761,15 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (length_base) {
- _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
+ _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
_exception ? JNI_ABORT: 0);
}
if (props_base) {
- _env->ReleasePrimitiveArrayCritical(props_ref, props_base,
+ _env->ReleaseIntArrayElements(props_ref, (jint*)props_base,
JNI_ABORT);
}
if (_exception) {
@@ -667,11 +781,11 @@
static void
android_glGetProgramResourceiv__IIIILjava_nio_IntBuffer_2ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint programInterface, jint index, jint propCount, jobject props_buf, jint bufSize, jobject length_buf, jobject params_buf) {
- jarray _propsArray = (jarray) 0;
+ jintArray _propsArray = (jintArray) 0;
jint _propsBufferOffset = (jint) 0;
- jarray _lengthArray = (jarray) 0;
+ jintArray _lengthArray = (jintArray) 0;
jint _lengthBufferOffset = (jint) 0;
- jarray _paramsArray = (jarray) 0;
+ jintArray _paramsArray = (jintArray) 0;
jint _paramsBufferOffset = (jint) 0;
jint _propsRemaining;
GLenum *props = (GLenum *) 0;
@@ -680,19 +794,19 @@
jint _paramsRemaining;
GLint *params = (GLint *) 0;
- props = (GLenum *)getPointer(_env, props_buf, &_propsArray, &_propsRemaining, &_propsBufferOffset);
- length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
- params = (GLint *)getPointer(_env, params_buf, &_paramsArray, &_paramsRemaining, &_paramsBufferOffset);
+ props = (GLenum *)getPointer(_env, props_buf, (jarray*)&_propsArray, &_propsRemaining, &_propsBufferOffset);
+ length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_paramsArray, &_paramsRemaining, &_paramsBufferOffset);
if (props == NULL) {
- char * _propsBase = (char *)_env->GetPrimitiveArrayCritical(_propsArray, (jboolean *) 0);
+ char * _propsBase = (char *)_env->GetIntArrayElements(_propsArray, (jboolean *) 0);
props = (GLenum *) (_propsBase + _propsBufferOffset);
}
if (length == NULL) {
- char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
+ char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_paramsArray, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_paramsArray, (jboolean *) 0);
params = (GLint *) (_paramsBase + _paramsBufferOffset);
}
glGetProgramResourceiv(
@@ -706,13 +820,13 @@
(GLint *)params
);
if (_paramsArray) {
- releasePointer(_env, _paramsArray, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_paramsArray, (jint*)params, 0);
}
if (_lengthArray) {
- releasePointer(_env, _lengthArray, length, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_lengthArray, (jint*)length, 0);
}
if (_propsArray) {
- releasePointer(_env, _propsArray, props, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_propsArray, (jint*)props, JNI_ABORT);
}
}
@@ -814,7 +928,7 @@
}
_remaining = _env->GetArrayLength(pipelines_ref) - offset;
pipelines_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(pipelines_ref, (jboolean *)0);
+ _env->GetIntArrayElements(pipelines_ref, (jboolean *)0);
pipelines = pipelines_base + offset;
glDeleteProgramPipelines(
@@ -824,7 +938,7 @@
exit:
if (pipelines_base) {
- _env->ReleasePrimitiveArrayCritical(pipelines_ref, pipelines_base,
+ _env->ReleaseIntArrayElements(pipelines_ref, (jint*)pipelines_base,
JNI_ABORT);
}
if (_exception) {
@@ -836,14 +950,14 @@
static void
android_glDeleteProgramPipelines__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint n, jobject pipelines_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *pipelines = (GLuint *) 0;
- pipelines = (GLuint *)getPointer(_env, pipelines_buf, &_array, &_remaining, &_bufferOffset);
+ pipelines = (GLuint *)getPointer(_env, pipelines_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (pipelines == NULL) {
- char * _pipelinesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _pipelinesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
pipelines = (GLuint *) (_pipelinesBase + _bufferOffset);
}
glDeleteProgramPipelines(
@@ -851,7 +965,7 @@
(GLuint *)pipelines
);
if (_array) {
- releasePointer(_env, _array, pipelines, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)pipelines, JNI_ABORT);
}
}
@@ -880,7 +994,7 @@
}
_remaining = _env->GetArrayLength(pipelines_ref) - offset;
pipelines_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(pipelines_ref, (jboolean *)0);
+ _env->GetIntArrayElements(pipelines_ref, (jboolean *)0);
pipelines = pipelines_base + offset;
glGenProgramPipelines(
@@ -890,7 +1004,7 @@
exit:
if (pipelines_base) {
- _env->ReleasePrimitiveArrayCritical(pipelines_ref, pipelines_base,
+ _env->ReleaseIntArrayElements(pipelines_ref, (jint*)pipelines_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -902,14 +1016,14 @@
static void
android_glGenProgramPipelines__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint n, jobject pipelines_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *pipelines = (GLuint *) 0;
- pipelines = (GLuint *)getPointer(_env, pipelines_buf, &_array, &_remaining, &_bufferOffset);
+ pipelines = (GLuint *)getPointer(_env, pipelines_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (pipelines == NULL) {
- char * _pipelinesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _pipelinesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
pipelines = (GLuint *) (_pipelinesBase + _bufferOffset);
}
glGenProgramPipelines(
@@ -917,7 +1031,7 @@
(GLuint *)pipelines
);
if (_array) {
- releasePointer(_env, _array, pipelines, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)pipelines, 0);
}
}
@@ -957,7 +1071,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetProgramPipelineiv(
@@ -968,7 +1082,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -980,14 +1094,14 @@
static void
android_glGetProgramPipelineiv__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pipeline, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetProgramPipelineiv(
@@ -996,7 +1110,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -1175,7 +1289,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniform1iv(
@@ -1187,7 +1301,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1199,14 +1313,14 @@
static void
android_glProgramUniform1iv__IIILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *value = (GLint *) 0;
- value = (GLint *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
value = (GLint *) (_valueBase + _bufferOffset);
}
glProgramUniform1iv(
@@ -1216,7 +1330,7 @@
(GLint *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
}
}
@@ -1245,7 +1359,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniform2iv(
@@ -1257,7 +1371,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1269,14 +1383,14 @@
static void
android_glProgramUniform2iv__IIILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *value = (GLint *) 0;
- value = (GLint *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
value = (GLint *) (_valueBase + _bufferOffset);
}
glProgramUniform2iv(
@@ -1286,7 +1400,7 @@
(GLint *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
}
}
@@ -1315,7 +1429,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniform3iv(
@@ -1327,7 +1441,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1339,14 +1453,14 @@
static void
android_glProgramUniform3iv__IIILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *value = (GLint *) 0;
- value = (GLint *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
value = (GLint *) (_valueBase + _bufferOffset);
}
glProgramUniform3iv(
@@ -1356,7 +1470,7 @@
(GLint *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
}
}
@@ -1385,7 +1499,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniform4iv(
@@ -1397,7 +1511,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1409,14 +1523,14 @@
static void
android_glProgramUniform4iv__IIILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *value = (GLint *) 0;
- value = (GLint *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
value = (GLint *) (_valueBase + _bufferOffset);
}
glProgramUniform4iv(
@@ -1426,7 +1540,7 @@
(GLint *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
}
}
@@ -1455,7 +1569,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniform1uiv(
@@ -1467,7 +1581,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1479,14 +1593,14 @@
static void
android_glProgramUniform1uiv__IIILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *value = (GLuint *) 0;
- value = (GLuint *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
value = (GLuint *) (_valueBase + _bufferOffset);
}
glProgramUniform1uiv(
@@ -1496,7 +1610,7 @@
(GLuint *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
}
}
@@ -1525,7 +1639,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniform2uiv(
@@ -1537,7 +1651,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1549,14 +1663,14 @@
static void
android_glProgramUniform2uiv__IIILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *value = (GLuint *) 0;
- value = (GLuint *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
value = (GLuint *) (_valueBase + _bufferOffset);
}
glProgramUniform2uiv(
@@ -1566,7 +1680,7 @@
(GLuint *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
}
}
@@ -1595,7 +1709,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniform3uiv(
@@ -1607,7 +1721,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1619,14 +1733,14 @@
static void
android_glProgramUniform3uiv__IIILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *value = (GLuint *) 0;
- value = (GLuint *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
value = (GLuint *) (_valueBase + _bufferOffset);
}
glProgramUniform3uiv(
@@ -1636,7 +1750,7 @@
(GLuint *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
}
}
@@ -1665,7 +1779,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetIntArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniform4uiv(
@@ -1677,7 +1791,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1689,14 +1803,14 @@
static void
android_glProgramUniform4uiv__IIILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *value = (GLuint *) 0;
- value = (GLuint *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
value = (GLuint *) (_valueBase + _bufferOffset);
}
glProgramUniform4uiv(
@@ -1706,7 +1820,7 @@
(GLuint *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
}
}
@@ -1735,7 +1849,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniform1fv(
@@ -1747,7 +1861,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1759,14 +1873,14 @@
static void
android_glProgramUniform1fv__IIILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glProgramUniform1fv(
@@ -1776,7 +1890,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -1805,7 +1919,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniform2fv(
@@ -1817,7 +1931,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1829,14 +1943,14 @@
static void
android_glProgramUniform2fv__IIILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glProgramUniform2fv(
@@ -1846,7 +1960,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -1875,7 +1989,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniform3fv(
@@ -1887,7 +2001,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1899,14 +2013,14 @@
static void
android_glProgramUniform3fv__IIILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glProgramUniform3fv(
@@ -1916,7 +2030,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -1945,7 +2059,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniform4fv(
@@ -1957,7 +2071,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -1969,14 +2083,14 @@
static void
android_glProgramUniform4fv__IIILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glProgramUniform4fv(
@@ -1986,7 +2100,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -2015,7 +2129,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniformMatrix2fv(
@@ -2028,7 +2142,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2040,14 +2154,14 @@
static void
android_glProgramUniformMatrix2fv__IIIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glProgramUniformMatrix2fv(
@@ -2058,7 +2172,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -2087,7 +2201,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniformMatrix3fv(
@@ -2100,7 +2214,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2112,14 +2226,14 @@
static void
android_glProgramUniformMatrix3fv__IIIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glProgramUniformMatrix3fv(
@@ -2130,7 +2244,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -2159,7 +2273,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniformMatrix4fv(
@@ -2172,7 +2286,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2184,14 +2298,14 @@
static void
android_glProgramUniformMatrix4fv__IIIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glProgramUniformMatrix4fv(
@@ -2202,7 +2316,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -2231,7 +2345,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniformMatrix2x3fv(
@@ -2244,7 +2358,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2256,14 +2370,14 @@
static void
android_glProgramUniformMatrix2x3fv__IIIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glProgramUniformMatrix2x3fv(
@@ -2274,7 +2388,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -2303,7 +2417,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniformMatrix3x2fv(
@@ -2316,7 +2430,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2328,14 +2442,14 @@
static void
android_glProgramUniformMatrix3x2fv__IIIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glProgramUniformMatrix3x2fv(
@@ -2346,7 +2460,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -2375,7 +2489,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniformMatrix2x4fv(
@@ -2388,7 +2502,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2400,14 +2514,14 @@
static void
android_glProgramUniformMatrix2x4fv__IIIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glProgramUniformMatrix2x4fv(
@@ -2418,7 +2532,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -2447,7 +2561,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniformMatrix4x2fv(
@@ -2460,7 +2574,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2472,14 +2586,14 @@
static void
android_glProgramUniformMatrix4x2fv__IIIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glProgramUniformMatrix4x2fv(
@@ -2490,7 +2604,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -2519,7 +2633,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniformMatrix3x4fv(
@@ -2532,7 +2646,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2544,14 +2658,14 @@
static void
android_glProgramUniformMatrix3x4fv__IIIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glProgramUniformMatrix3x4fv(
@@ -2562,7 +2676,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -2591,7 +2705,7 @@
}
_remaining = _env->GetArrayLength(value_ref) - offset;
value_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(value_ref, (jboolean *)0);
value = value_base + offset;
glProgramUniformMatrix4x3fv(
@@ -2604,7 +2718,7 @@
exit:
if (value_base) {
- _env->ReleasePrimitiveArrayCritical(value_ref, value_base,
+ _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
JNI_ABORT);
}
if (_exception) {
@@ -2616,14 +2730,14 @@
static void
android_glProgramUniformMatrix4x3fv__IIIZLjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *value = (GLfloat *) 0;
- value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset);
+ value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (value == NULL) {
- char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
value = (GLfloat *) (_valueBase + _bufferOffset);
}
glProgramUniformMatrix4x3fv(
@@ -2634,7 +2748,7 @@
(GLfloat *)value
);
if (_array) {
- releasePointer(_env, _array, value, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
}
}
@@ -2706,7 +2820,7 @@
}
_remaining = _env->GetArrayLength(data_ref) - offset;
data_base = (GLboolean *)
- _env->GetPrimitiveArrayCritical(data_ref, (jboolean *)0);
+ _env->GetBooleanArrayElements(data_ref, (jboolean *)0);
data = data_base + offset;
glGetBooleani_v(
@@ -2717,7 +2831,7 @@
exit:
if (data_base) {
- _env->ReleasePrimitiveArrayCritical(data_ref, data_base,
+ _env->ReleaseBooleanArrayElements(data_ref, (jboolean*)data_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2729,14 +2843,14 @@
static void
android_glGetBooleani_v__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint index, jobject data_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLboolean *data = (GLboolean *) 0;
- data = (GLboolean *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLboolean *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (data == NULL) {
- char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _dataBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
data = (GLboolean *) (_dataBase + _bufferOffset);
}
glGetBooleani_v(
@@ -2745,7 +2859,7 @@
(GLboolean *)data
);
if (_array) {
- releasePointer(_env, _array, data, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)data, 0);
}
}
@@ -2806,7 +2920,7 @@
}
_remaining = _env->GetArrayLength(val_ref) - offset;
val_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(val_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(val_ref, (jboolean *)0);
val = val_base + offset;
glGetMultisamplefv(
@@ -2817,7 +2931,7 @@
exit:
if (val_base) {
- _env->ReleasePrimitiveArrayCritical(val_ref, val_base,
+ _env->ReleaseFloatArrayElements(val_ref, (jfloat*)val_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2829,14 +2943,14 @@
static void
android_glGetMultisamplefv__IILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jint index, jobject val_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *val = (GLfloat *) 0;
- val = (GLfloat *)getPointer(_env, val_buf, &_array, &_remaining, &_bufferOffset);
+ val = (GLfloat *)getPointer(_env, val_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (val == NULL) {
- char * _valBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _valBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
val = (GLfloat *) (_valBase + _bufferOffset);
}
glGetMultisamplefv(
@@ -2845,7 +2959,7 @@
(GLfloat *)val
);
if (_array) {
- releasePointer(_env, _array, val, JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)val, 0);
}
}
@@ -2884,7 +2998,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexLevelParameteriv(
@@ -2896,7 +3010,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2908,14 +3022,14 @@
static void
android_glGetTexLevelParameteriv__IIILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint level, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetTexLevelParameteriv(
@@ -2925,7 +3039,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -2954,7 +3068,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexLevelParameterfv(
@@ -2966,7 +3080,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -2978,14 +3092,14 @@
static void
android_glGetTexLevelParameterfv__IIILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint level, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetTexLevelParameterfv(
@@ -2995,7 +3109,7 @@
(GLfloat *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, 0);
}
}
diff --git a/core/jni/android_opengl_GLES31Ext.cpp b/core/jni/android_opengl_GLES31Ext.cpp
index 7317e9f..2856308 100644
--- a/core/jni/android_opengl_GLES31Ext.cpp
+++ b/core/jni/android_opengl_GLES31Ext.cpp
@@ -125,6 +125,116 @@
return NULL;
}
+class ByteArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
+ return _env->GetByteArrayElements(array, is_copy);
+ }
+};
+class BooleanArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
+ return _env->GetBooleanArrayElements(array, is_copy);
+ }
+};
+class CharArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
+ return _env->GetCharArrayElements(array, is_copy);
+ }
+};
+class ShortArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
+ return _env->GetShortArrayElements(array, is_copy);
+ }
+};
+class IntArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
+ return _env->GetIntArrayElements(array, is_copy);
+ }
+};
+class LongArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
+ return _env->GetLongArrayElements(array, is_copy);
+ }
+};
+class FloatArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
+ return _env->GetFloatArrayElements(array, is_copy);
+ }
+};
+class DoubleArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
+ return _env->GetDoubleArrayElements(array, is_copy);
+ }
+};
+
+template<typename JTYPEARRAY, typename ARRAYGETTER>
+static void*
+getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
+ return ARRAYGETTER::Get(_env, array, is_copy);
+}
+
+class ByteArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
+ _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class BooleanArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
+ _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class CharArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
+ _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class ShortArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
+ _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class IntArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
+ _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class LongArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
+ _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class FloatArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
+ _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class DoubleArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
+ _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+
+template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
+static void
+releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
+ ARRAYRELEASER::Release(_env, array, data, commit);
+}
+
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -228,7 +338,8 @@
return needed;
}
-template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
static void
get
(JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
@@ -263,8 +374,8 @@
_exceptionMessage = "length - offset < needed";
goto exit;
}
- params_base = (CTYPE *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, params_ref, (jboolean *)0);
params = params_base + offset;
GET(
@@ -274,8 +385,8 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
- _exception ? JNI_ABORT: 0);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, params_ref, params_base, !_exception);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -283,20 +394,21 @@
}
-template <typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
static void
getarray
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
jint _exception = 0;
const char * _exceptionType;
const char * _exceptionMessage;
- jarray _array = (jarray) 0;
+ JTYPEARRAY _array = (JTYPEARRAY) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
CTYPE *params = (CTYPE *) 0;
int _needed = 0;
- params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
_remaining /= sizeof(CTYPE); // convert from bytes to item count
_needed = getNeededCount(pname);
// if we didn't find this pname, we just assume the user passed
@@ -309,7 +421,8 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, _array, (jboolean *) 0);
params = (CTYPE *) (_paramsBase + _bufferOffset);
}
GET(
@@ -319,7 +432,8 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -359,7 +473,7 @@
}
_remaining = _env->GetArrayLength(ids_ref) - offset;
ids_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(ids_ref, (jboolean *)0);
+ _env->GetIntArrayElements(ids_ref, (jboolean *)0);
ids = ids_base + offset;
glDebugMessageControlKHR(
@@ -373,7 +487,7 @@
exit:
if (ids_base) {
- _env->ReleasePrimitiveArrayCritical(ids_ref, ids_base,
+ _env->ReleaseIntArrayElements(ids_ref, (jint*)ids_base,
JNI_ABORT);
}
if (_exception) {
@@ -385,14 +499,14 @@
static void
android_glDebugMessageControlKHR__IIIILjava_nio_IntBuffer_2Z
(JNIEnv *_env, jobject _this, jint source, jint type, jint severity, jint count, jobject ids_buf, jboolean enabled) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *ids = (GLuint *) 0;
- ids = (GLuint *)getPointer(_env, ids_buf, &_array, &_remaining, &_bufferOffset);
+ ids = (GLuint *)getPointer(_env, ids_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (ids == NULL) {
- char * _idsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _idsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
ids = (GLuint *) (_idsBase + _bufferOffset);
}
glDebugMessageControlKHR(
@@ -404,7 +518,7 @@
(GLboolean)enabled
);
if (_array) {
- releasePointer(_env, _array, ids, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)ids, JNI_ABORT);
}
}
@@ -784,7 +898,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexParameterIivEXT(
@@ -795,7 +909,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -807,14 +921,14 @@
static void
android_glTexParameterIivEXT__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glTexParameterIivEXT(
@@ -823,7 +937,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
}
@@ -852,7 +966,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexParameterIuivEXT(
@@ -863,7 +977,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -875,14 +989,14 @@
static void
android_glTexParameterIuivEXT__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *params = (GLuint *) 0;
- params = (GLuint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLuint *) (_paramsBase + _bufferOffset);
}
glTexParameterIuivEXT(
@@ -891,7 +1005,7 @@
(GLuint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
}
@@ -920,7 +1034,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexParameterIivEXT(
@@ -931,7 +1045,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -943,14 +1057,14 @@
static void
android_glGetTexParameterIivEXT__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetTexParameterIivEXT(
@@ -959,7 +1073,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -988,7 +1102,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexParameterIuivEXT(
@@ -999,7 +1113,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1011,14 +1125,14 @@
static void
android_glGetTexParameterIuivEXT__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *params = (GLuint *) 0;
- params = (GLuint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLuint *) (_paramsBase + _bufferOffset);
}
glGetTexParameterIuivEXT(
@@ -1027,7 +1141,7 @@
(GLuint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -1056,7 +1170,7 @@
}
_remaining = _env->GetArrayLength(param_ref) - offset;
param_base = (GLint *)
- _env->GetPrimitiveArrayCritical(param_ref, (jboolean *)0);
+ _env->GetIntArrayElements(param_ref, (jboolean *)0);
param = param_base + offset;
glSamplerParameterIivEXT(
@@ -1067,7 +1181,7 @@
exit:
if (param_base) {
- _env->ReleasePrimitiveArrayCritical(param_ref, param_base,
+ _env->ReleaseIntArrayElements(param_ref, (jint*)param_base,
JNI_ABORT);
}
if (_exception) {
@@ -1079,14 +1193,14 @@
static void
android_glSamplerParameterIivEXT__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject param_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *param = (GLint *) 0;
- param = (GLint *)getPointer(_env, param_buf, &_array, &_remaining, &_bufferOffset);
+ param = (GLint *)getPointer(_env, param_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (param == NULL) {
- char * _paramBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
param = (GLint *) (_paramBase + _bufferOffset);
}
glSamplerParameterIivEXT(
@@ -1095,7 +1209,7 @@
(GLint *)param
);
if (_array) {
- releasePointer(_env, _array, param, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)param, JNI_ABORT);
}
}
@@ -1124,7 +1238,7 @@
}
_remaining = _env->GetArrayLength(param_ref) - offset;
param_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(param_ref, (jboolean *)0);
+ _env->GetIntArrayElements(param_ref, (jboolean *)0);
param = param_base + offset;
glSamplerParameterIuivEXT(
@@ -1135,7 +1249,7 @@
exit:
if (param_base) {
- _env->ReleasePrimitiveArrayCritical(param_ref, param_base,
+ _env->ReleaseIntArrayElements(param_ref, (jint*)param_base,
JNI_ABORT);
}
if (_exception) {
@@ -1147,14 +1261,14 @@
static void
android_glSamplerParameterIuivEXT__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject param_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *param = (GLuint *) 0;
- param = (GLuint *)getPointer(_env, param_buf, &_array, &_remaining, &_bufferOffset);
+ param = (GLuint *)getPointer(_env, param_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (param == NULL) {
- char * _paramBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
param = (GLuint *) (_paramBase + _bufferOffset);
}
glSamplerParameterIuivEXT(
@@ -1163,7 +1277,7 @@
(GLuint *)param
);
if (_array) {
- releasePointer(_env, _array, param, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)param, JNI_ABORT);
}
}
@@ -1192,7 +1306,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetSamplerParameterIivEXT(
@@ -1203,7 +1317,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1215,14 +1329,14 @@
static void
android_glGetSamplerParameterIivEXT__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetSamplerParameterIivEXT(
@@ -1231,7 +1345,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -1260,7 +1374,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetSamplerParameterIuivEXT(
@@ -1271,7 +1385,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1283,14 +1397,14 @@
static void
android_glGetSamplerParameterIuivEXT__IILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *params = (GLuint *) 0;
- params = (GLuint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLuint *) (_paramsBase + _bufferOffset);
}
glGetSamplerParameterIuivEXT(
@@ -1299,7 +1413,7 @@
(GLuint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
diff --git a/core/jni/com_google_android_gles_jni_GLImpl.cpp b/core/jni/com_google_android_gles_jni_GLImpl.cpp
index c5f330e..f15f957 100644
--- a/core/jni/com_google_android_gles_jni_GLImpl.cpp
+++ b/core/jni/com_google_android_gles_jni_GLImpl.cpp
@@ -449,7 +449,7 @@
jint _remaining;
GLvoid *data = (GLvoid *) 0;
- data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (data == NULL) {
char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
data = (GLvoid *) (_dataBase + _bufferOffset);
@@ -478,7 +478,7 @@
jint _remaining;
GLvoid *data = (GLvoid *) 0;
- data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (data == NULL) {
char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
data = (GLvoid *) (_dataBase + _bufferOffset);
@@ -571,7 +571,7 @@
goto exit;
}
textures_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
+ _env->GetIntArrayElements(textures_ref, (jboolean *)0);
textures = textures_base + offset;
glDeleteTextures(
@@ -581,7 +581,7 @@
exit:
if (textures_base) {
- _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
+ _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
JNI_ABORT);
}
if (_exception) {
@@ -596,12 +596,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *textures = (GLuint *) 0;
- textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
+ textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -609,7 +609,7 @@
goto exit;
}
if (textures == NULL) {
- char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
textures = (GLuint *) (_texturesBase + _bufferOffset);
}
glDeleteTextures(
@@ -619,7 +619,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, textures, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)textures, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -705,7 +705,7 @@
jint _remaining;
GLvoid *indices = (GLvoid *) 0;
- indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset);
+ indices = (GLvoid *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < count) {
_exception = 1;
_exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
@@ -830,7 +830,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glFogfv(
@@ -840,7 +840,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -855,12 +855,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_FOG_MODE)
@@ -893,7 +893,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glFogfv(
@@ -903,7 +903,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -976,7 +976,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glFogxv(
@@ -986,7 +986,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -1001,12 +1001,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_FOG_MODE)
@@ -1039,7 +1039,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glFogxv(
@@ -1049,7 +1049,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1124,7 +1124,7 @@
goto exit;
}
textures_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
+ _env->GetIntArrayElements(textures_ref, (jboolean *)0);
textures = textures_base + offset;
glGenTextures(
@@ -1134,7 +1134,7 @@
exit:
if (textures_base) {
- _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
+ _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1149,12 +1149,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *textures = (GLuint *) 0;
- textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset);
+ textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -1162,7 +1162,7 @@
goto exit;
}
if (textures == NULL) {
- char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
textures = (GLuint *) (_texturesBase + _bufferOffset);
}
glGenTextures(
@@ -1172,7 +1172,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)textures, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -1550,7 +1550,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetIntegerv(
@@ -1560,7 +1560,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -1575,12 +1575,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_ALPHA_BITS)
@@ -1919,7 +1919,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetIntegerv(
@@ -1929,7 +1929,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2008,7 +2008,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glLightModelfv(
@@ -2018,7 +2018,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2033,12 +2033,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_LIGHT_MODEL_TWO_SIDE)
@@ -2062,7 +2062,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glLightModelfv(
@@ -2072,7 +2072,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2136,7 +2136,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glLightModelxv(
@@ -2146,7 +2146,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2161,12 +2161,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_LIGHT_MODEL_TWO_SIDE)
@@ -2190,7 +2190,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glLightModelxv(
@@ -2200,7 +2200,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2291,7 +2291,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glLightfv(
@@ -2302,7 +2302,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2317,12 +2317,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_SPOT_EXPONENT)
@@ -2372,7 +2372,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glLightfv(
@@ -2383,7 +2383,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2474,7 +2474,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glLightxv(
@@ -2485,7 +2485,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2500,12 +2500,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_SPOT_EXPONENT)
@@ -2555,7 +2555,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glLightxv(
@@ -2566,7 +2566,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2623,7 +2623,7 @@
}
_remaining = _env->GetArrayLength(m_ref) - offset;
m_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(m_ref, (jboolean *)0);
m = m_base + offset;
glLoadMatrixf(
@@ -2632,7 +2632,7 @@
exit:
if (m_base) {
- _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+ _env->ReleaseFloatArrayElements(m_ref, (jfloat*)m_base,
JNI_ABORT);
}
if (_exception) {
@@ -2644,21 +2644,21 @@
static void
android_glLoadMatrixf__Ljava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jobject m_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *m = (GLfloat *) 0;
- m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
+ m = (GLfloat *)getPointer(_env, m_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (m == NULL) {
- char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _mBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
m = (GLfloat *) (_mBase + _bufferOffset);
}
glLoadMatrixf(
(GLfloat *)m
);
if (_array) {
- releasePointer(_env, _array, m, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)m, JNI_ABORT);
}
}
@@ -2687,7 +2687,7 @@
}
_remaining = _env->GetArrayLength(m_ref) - offset;
m_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+ _env->GetIntArrayElements(m_ref, (jboolean *)0);
m = m_base + offset;
glLoadMatrixx(
@@ -2696,7 +2696,7 @@
exit:
if (m_base) {
- _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+ _env->ReleaseIntArrayElements(m_ref, (jint*)m_base,
JNI_ABORT);
}
if (_exception) {
@@ -2708,21 +2708,21 @@
static void
android_glLoadMatrixx__Ljava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jobject m_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *m = (GLfixed *) 0;
- m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
+ m = (GLfixed *)getPointer(_env, m_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (m == NULL) {
- char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _mBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
m = (GLfixed *) (_mBase + _bufferOffset);
}
glLoadMatrixx(
(GLfixed *)m
);
if (_array) {
- releasePointer(_env, _array, m, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)m, JNI_ABORT);
}
}
@@ -2805,7 +2805,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glMaterialfv(
@@ -2816,7 +2816,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2831,12 +2831,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_SHININESS)
@@ -2872,7 +2872,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glMaterialfv(
@@ -2883,7 +2883,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -2960,7 +2960,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glMaterialxv(
@@ -2971,7 +2971,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -2986,12 +2986,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_SHININESS)
@@ -3027,7 +3027,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glMaterialxv(
@@ -3038,7 +3038,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -3079,7 +3079,7 @@
}
_remaining = _env->GetArrayLength(m_ref) - offset;
m_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(m_ref, (jboolean *)0);
m = m_base + offset;
glMultMatrixf(
@@ -3088,7 +3088,7 @@
exit:
if (m_base) {
- _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+ _env->ReleaseFloatArrayElements(m_ref, (jfloat*)m_base,
JNI_ABORT);
}
if (_exception) {
@@ -3100,21 +3100,21 @@
static void
android_glMultMatrixf__Ljava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jobject m_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *m = (GLfloat *) 0;
- m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
+ m = (GLfloat *)getPointer(_env, m_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (m == NULL) {
- char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _mBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
m = (GLfloat *) (_mBase + _bufferOffset);
}
glMultMatrixf(
(GLfloat *)m
);
if (_array) {
- releasePointer(_env, _array, m, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)m, JNI_ABORT);
}
}
@@ -3143,7 +3143,7 @@
}
_remaining = _env->GetArrayLength(m_ref) - offset;
m_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+ _env->GetIntArrayElements(m_ref, (jboolean *)0);
m = m_base + offset;
glMultMatrixx(
@@ -3152,7 +3152,7 @@
exit:
if (m_base) {
- _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+ _env->ReleaseIntArrayElements(m_ref, (jint*)m_base,
JNI_ABORT);
}
if (_exception) {
@@ -3164,21 +3164,21 @@
static void
android_glMultMatrixx__Ljava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jobject m_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *m = (GLfixed *) 0;
- m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining, &_bufferOffset);
+ m = (GLfixed *)getPointer(_env, m_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (m == NULL) {
- char * _mBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _mBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
m = (GLfixed *) (_mBase + _bufferOffset);
}
glMultMatrixx(
(GLfixed *)m
);
if (_array) {
- releasePointer(_env, _array, m, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)m, JNI_ABORT);
}
}
@@ -3352,7 +3352,7 @@
jint _remaining;
GLvoid *pixels = (GLvoid *) 0;
- pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
+ pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (pixels == NULL) {
char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
@@ -3577,7 +3577,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexEnvfv(
@@ -3588,7 +3588,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -3603,12 +3603,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_TEXTURE_ENV_MODE)
@@ -3638,7 +3638,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glTexEnvfv(
@@ -3649,7 +3649,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -3720,7 +3720,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexEnvxv(
@@ -3731,7 +3731,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -3746,12 +3746,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_TEXTURE_ENV_MODE)
@@ -3781,7 +3781,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glTexEnvxv(
@@ -3792,7 +3792,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -3809,7 +3809,7 @@
GLvoid *pixels = (GLvoid *) 0;
if (pixels_buf) {
- pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
+ pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
}
if (pixels_buf && pixels == NULL) {
char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
@@ -3863,7 +3863,7 @@
GLvoid *pixels = (GLvoid *) 0;
if (pixels_buf) {
- pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset);
+ pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
}
if (pixels_buf && pixels == NULL) {
char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
@@ -3978,7 +3978,7 @@
goto exit;
}
mantissa_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(mantissa_ref, (jboolean *)0);
+ _env->GetIntArrayElements(mantissa_ref, (jboolean *)0);
mantissa = mantissa_base + mantissaOffset;
if (!exponent_ref) {
@@ -4001,7 +4001,7 @@
goto exit;
}
exponent_base = (GLint *)
- _env->GetPrimitiveArrayCritical(exponent_ref, (jboolean *)0);
+ _env->GetIntArrayElements(exponent_ref, (jboolean *)0);
exponent = exponent_base + exponentOffset;
_returnValue = glQueryMatrixxOES(
@@ -4011,11 +4011,11 @@
exit:
if (exponent_base) {
- _env->ReleasePrimitiveArrayCritical(exponent_ref, exponent_base,
+ _env->ReleaseIntArrayElements(exponent_ref, (jint*)exponent_base,
_exception ? JNI_ABORT: 0);
}
if (mantissa_base) {
- _env->ReleasePrimitiveArrayCritical(mantissa_ref, mantissa_base,
+ _env->ReleaseIntArrayElements(mantissa_ref, (jint*)mantissa_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -4031,9 +4031,9 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _mantissaArray = (jarray) 0;
+ jintArray _mantissaArray = (jintArray) 0;
jint _mantissaBufferOffset = (jint) 0;
- jarray _exponentArray = (jarray) 0;
+ jintArray _exponentArray = (jintArray) 0;
jint _exponentBufferOffset = (jint) 0;
GLbitfield _returnValue = -1;
jint _mantissaRemaining;
@@ -4041,14 +4041,14 @@
jint _exponentRemaining;
GLint *exponent = (GLint *) 0;
- mantissa = (GLfixed *)getPointer(_env, mantissa_buf, &_mantissaArray, &_mantissaRemaining, &_mantissaBufferOffset);
+ mantissa = (GLfixed *)getPointer(_env, mantissa_buf, (jarray*)&_mantissaArray, &_mantissaRemaining, &_mantissaBufferOffset);
if (_mantissaRemaining < 16) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
_exceptionMessage = "remaining() < 16 < needed";
goto exit;
}
- exponent = (GLint *)getPointer(_env, exponent_buf, &_exponentArray, &_exponentRemaining, &_exponentBufferOffset);
+ exponent = (GLint *)getPointer(_env, exponent_buf, (jarray*)&_exponentArray, &_exponentRemaining, &_exponentBufferOffset);
if (_exponentRemaining < 16) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4056,11 +4056,11 @@
goto exit;
}
if (mantissa == NULL) {
- char * _mantissaBase = (char *)_env->GetPrimitiveArrayCritical(_mantissaArray, (jboolean *) 0);
+ char * _mantissaBase = (char *)_env->GetIntArrayElements(_mantissaArray, (jboolean *) 0);
mantissa = (GLfixed *) (_mantissaBase + _mantissaBufferOffset);
}
if (exponent == NULL) {
- char * _exponentBase = (char *)_env->GetPrimitiveArrayCritical(_exponentArray, (jboolean *) 0);
+ char * _exponentBase = (char *)_env->GetIntArrayElements(_exponentArray, (jboolean *) 0);
exponent = (GLint *) (_exponentBase + _exponentBufferOffset);
}
_returnValue = glQueryMatrixxOES(
@@ -4070,10 +4070,10 @@
exit:
if (_exponentArray) {
- releasePointer(_env, _exponentArray, exponent, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_exponentArray, (jint*)exponent, _exception ? JNI_ABORT : 0);
}
if (_mantissaArray) {
- releasePointer(_env, _mantissaArray, mantissa, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_mantissaArray, (jint*)mantissa, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -4104,7 +4104,7 @@
GLvoid *data = (GLvoid *) 0;
if (data_buf) {
- data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < size) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4144,7 +4144,7 @@
jint _remaining;
GLvoid *data = (GLvoid *) 0;
- data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset);
+ data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < size) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4202,7 +4202,7 @@
goto exit;
}
equation_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(equation_ref, (jboolean *)0);
equation = equation_base + offset;
glClipPlanef(
@@ -4212,7 +4212,7 @@
exit:
if (equation_base) {
- _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
+ _env->ReleaseFloatArrayElements(equation_ref, (jfloat*)equation_base,
JNI_ABORT);
}
if (_exception) {
@@ -4227,12 +4227,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *equation = (GLfloat *) 0;
- equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset);
+ equation = (GLfloat *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 4) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4240,7 +4240,7 @@
goto exit;
}
if (equation == NULL) {
- char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _equationBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
equation = (GLfloat *) (_equationBase + _bufferOffset);
}
glClipPlanef(
@@ -4250,7 +4250,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, equation, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)equation, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -4288,7 +4288,7 @@
goto exit;
}
equation_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
+ _env->GetIntArrayElements(equation_ref, (jboolean *)0);
equation = equation_base + offset;
glClipPlanex(
@@ -4298,7 +4298,7 @@
exit:
if (equation_base) {
- _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
+ _env->ReleaseIntArrayElements(equation_ref, (jint*)equation_base,
JNI_ABORT);
}
if (_exception) {
@@ -4313,12 +4313,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *equation = (GLfixed *) 0;
- equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset);
+ equation = (GLfixed *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 4) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4326,7 +4326,7 @@
goto exit;
}
if (equation == NULL) {
- char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _equationBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
equation = (GLfixed *) (_equationBase + _bufferOffset);
}
glClipPlanex(
@@ -4336,7 +4336,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, equation, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)equation, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -4398,7 +4398,7 @@
goto exit;
}
buffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
buffers = buffers_base + offset;
glDeleteBuffers(
@@ -4408,7 +4408,7 @@
exit:
if (buffers_base) {
- _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
+ _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
JNI_ABORT);
}
if (_exception) {
@@ -4423,12 +4423,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *buffers = (GLuint *) 0;
- buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
+ buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4436,7 +4436,7 @@
goto exit;
}
if (buffers == NULL) {
- char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
buffers = (GLuint *) (_buffersBase + _bufferOffset);
}
glDeleteBuffers(
@@ -4446,7 +4446,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, buffers, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -4502,7 +4502,7 @@
goto exit;
}
buffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
buffers = buffers_base + offset;
glGenBuffers(
@@ -4512,7 +4512,7 @@
exit:
if (buffers_base) {
- _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
+ _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -4527,12 +4527,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *buffers = (GLuint *) 0;
- buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset);
+ buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -4540,7 +4540,7 @@
goto exit;
}
if (buffers == NULL) {
- char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
buffers = (GLuint *) (_buffersBase + _bufferOffset);
}
glGenBuffers(
@@ -4550,7 +4550,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -4582,7 +4582,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLboolean *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetBooleanArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetBooleanv(
@@ -4592,7 +4592,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseBooleanArrayElements(params_ref, (jboolean*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -4604,14 +4604,14 @@
static void
android_glGetBooleanv__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLboolean *params = (GLboolean *) 0;
- params = (GLboolean *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLboolean *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLboolean *) (_paramsBase + _bufferOffset);
}
glGetBooleanv(
@@ -4619,7 +4619,7 @@
(GLboolean *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -4664,7 +4664,7 @@
}
_remaining = _env->GetArrayLength(eqn_ref) - offset;
eqn_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(eqn_ref, (jboolean *)0);
eqn = eqn_base + offset;
glGetClipPlanef(
@@ -4674,7 +4674,7 @@
exit:
if (eqn_base) {
- _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
+ _env->ReleaseFloatArrayElements(eqn_ref, (jfloat*)eqn_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -4686,14 +4686,14 @@
static void
android_glGetClipPlanef__ILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *eqn = (GLfloat *) 0;
- eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset);
+ eqn = (GLfloat *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (eqn == NULL) {
- char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _eqnBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
eqn = (GLfloat *) (_eqnBase + _bufferOffset);
}
glGetClipPlanef(
@@ -4701,7 +4701,7 @@
(GLfloat *)eqn
);
if (_array) {
- releasePointer(_env, _array, eqn, JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)eqn, 0);
}
}
@@ -4730,7 +4730,7 @@
}
_remaining = _env->GetArrayLength(eqn_ref) - offset;
eqn_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
+ _env->GetIntArrayElements(eqn_ref, (jboolean *)0);
eqn = eqn_base + offset;
glGetClipPlanex(
@@ -4740,7 +4740,7 @@
exit:
if (eqn_base) {
- _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
+ _env->ReleaseIntArrayElements(eqn_ref, (jint*)eqn_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -4752,14 +4752,14 @@
static void
android_glGetClipPlanex__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *eqn = (GLfixed *) 0;
- eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset);
+ eqn = (GLfixed *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (eqn == NULL) {
- char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _eqnBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
eqn = (GLfixed *) (_eqnBase + _bufferOffset);
}
glGetClipPlanex(
@@ -4767,7 +4767,7 @@
(GLfixed *)eqn
);
if (_array) {
- releasePointer(_env, _array, eqn, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)eqn, 0);
}
}
@@ -4796,7 +4796,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetFixedv(
@@ -4806,7 +4806,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -4818,14 +4818,14 @@
static void
android_glGetFixedv__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetFixedv(
@@ -4833,7 +4833,7 @@
(GLfixed *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -4862,7 +4862,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetFloatv(
@@ -4872,7 +4872,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -4884,14 +4884,14 @@
static void
android_glGetFloatv__ILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetFloatv(
@@ -4899,7 +4899,7 @@
(GLfloat *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, 0);
}
}
@@ -4976,7 +4976,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetLightfv(
@@ -4987,7 +4987,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -5002,12 +5002,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_SPOT_EXPONENT)
@@ -5057,7 +5057,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetLightfv(
@@ -5068,7 +5068,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5148,7 +5148,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetLightxv(
@@ -5159,7 +5159,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -5174,12 +5174,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_SPOT_EXPONENT)
@@ -5229,7 +5229,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetLightxv(
@@ -5240,7 +5240,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5306,7 +5306,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetMaterialfv(
@@ -5317,7 +5317,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -5332,12 +5332,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_SHININESS)
@@ -5373,7 +5373,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetMaterialfv(
@@ -5384,7 +5384,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5450,7 +5450,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetMaterialxv(
@@ -5461,7 +5461,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -5476,12 +5476,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_SHININESS)
@@ -5517,7 +5517,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetMaterialxv(
@@ -5528,7 +5528,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5588,7 +5588,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexEnviv(
@@ -5599,7 +5599,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -5614,12 +5614,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_TEXTURE_ENV_MODE)
@@ -5649,7 +5649,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetTexEnviv(
@@ -5660,7 +5660,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5720,7 +5720,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexEnvxv(
@@ -5731,7 +5731,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -5746,12 +5746,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_TEXTURE_ENV_MODE)
@@ -5781,7 +5781,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetTexEnvxv(
@@ -5792,7 +5792,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5830,7 +5830,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexParameterfv(
@@ -5841,7 +5841,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -5856,12 +5856,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -5869,7 +5869,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetTexParameterfv(
@@ -5880,7 +5880,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -5918,7 +5918,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexParameteriv(
@@ -5929,7 +5929,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -5944,12 +5944,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -5957,7 +5957,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetTexParameteriv(
@@ -5968,7 +5968,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -6006,7 +6006,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexParameterxv(
@@ -6017,7 +6017,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -6032,12 +6032,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -6045,7 +6045,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glGetTexParameterxv(
@@ -6056,7 +6056,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -6148,7 +6148,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glPointParameterfv(
@@ -6158,7 +6158,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -6173,12 +6173,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -6186,7 +6186,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glPointParameterfv(
@@ -6196,7 +6196,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -6244,7 +6244,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glPointParameterxv(
@@ -6254,7 +6254,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -6269,12 +6269,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -6282,7 +6282,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glPointParameterxv(
@@ -6292,7 +6292,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -6398,7 +6398,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexEnviv(
@@ -6409,7 +6409,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -6424,12 +6424,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
int _needed;
switch (pname) {
#if defined(GL_TEXTURE_ENV_MODE)
@@ -6459,7 +6459,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glTexEnviv(
@@ -6470,7 +6470,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -6508,7 +6508,7 @@
goto exit;
}
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexParameterfv(
@@ -6519,7 +6519,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -6534,12 +6534,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -6547,7 +6547,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glTexParameterfv(
@@ -6558,7 +6558,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -6607,7 +6607,7 @@
goto exit;
}
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexParameteriv(
@@ -6618,7 +6618,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -6633,12 +6633,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -6646,7 +6646,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glTexParameteriv(
@@ -6657,7 +6657,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -6695,7 +6695,7 @@
goto exit;
}
params_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexParameterxv(
@@ -6706,7 +6706,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
JNI_ABORT);
}
if (_exception) {
@@ -6721,12 +6721,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *params = (GLfixed *) 0;
- params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 1) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -6734,7 +6734,7 @@
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLfixed *) (_paramsBase + _bufferOffset);
}
glTexParameterxv(
@@ -6745,7 +6745,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, params, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -6817,7 +6817,7 @@
goto exit;
}
coords_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(coords_ref, (jboolean *)0);
coords = coords_base + offset;
glDrawTexfvOES(
@@ -6826,7 +6826,7 @@
exit:
if (coords_base) {
- _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base,
+ _env->ReleaseFloatArrayElements(coords_ref, (jfloat*)coords_base,
JNI_ABORT);
}
if (_exception) {
@@ -6841,12 +6841,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *coords = (GLfloat *) 0;
- coords = (GLfloat *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset);
+ coords = (GLfloat *)getPointer(_env, coords_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 5) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -6854,7 +6854,7 @@
goto exit;
}
if (coords == NULL) {
- char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _coordsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
coords = (GLfloat *) (_coordsBase + _bufferOffset);
}
glDrawTexfvOES(
@@ -6863,7 +6863,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, coords, JNI_FALSE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)coords, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -6914,7 +6914,7 @@
goto exit;
}
coords_base = (GLint *)
- _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0);
+ _env->GetIntArrayElements(coords_ref, (jboolean *)0);
coords = coords_base + offset;
glDrawTexivOES(
@@ -6923,7 +6923,7 @@
exit:
if (coords_base) {
- _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base,
+ _env->ReleaseIntArrayElements(coords_ref, (jint*)coords_base,
JNI_ABORT);
}
if (_exception) {
@@ -6938,12 +6938,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *coords = (GLint *) 0;
- coords = (GLint *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset);
+ coords = (GLint *)getPointer(_env, coords_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 5) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -6951,7 +6951,7 @@
goto exit;
}
if (coords == NULL) {
- char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _coordsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
coords = (GLint *) (_coordsBase + _bufferOffset);
}
glDrawTexivOES(
@@ -6960,7 +6960,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, coords, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)coords, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -7011,7 +7011,7 @@
goto exit;
}
coords_base = (GLshort *)
- _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0);
+ _env->GetShortArrayElements(coords_ref, (jboolean *)0);
coords = coords_base + offset;
glDrawTexsvOES(
@@ -7020,7 +7020,7 @@
exit:
if (coords_base) {
- _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base,
+ _env->ReleaseShortArrayElements(coords_ref, (jshort*)coords_base,
JNI_ABORT);
}
if (_exception) {
@@ -7035,12 +7035,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jshortArray _array = (jshortArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLshort *coords = (GLshort *) 0;
- coords = (GLshort *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset);
+ coords = (GLshort *)getPointer(_env, coords_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 5) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -7048,7 +7048,7 @@
goto exit;
}
if (coords == NULL) {
- char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _coordsBase = (char *)_env->GetShortArrayElements(_array, (jboolean *) 0);
coords = (GLshort *) (_coordsBase + _bufferOffset);
}
glDrawTexsvOES(
@@ -7057,7 +7057,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, coords, JNI_FALSE);
+ _env->ReleaseShortArrayElements(_array, (jshort*)coords, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -7108,7 +7108,7 @@
goto exit;
}
coords_base = (GLfixed *)
- _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0);
+ _env->GetIntArrayElements(coords_ref, (jboolean *)0);
coords = coords_base + offset;
glDrawTexxvOES(
@@ -7117,7 +7117,7 @@
exit:
if (coords_base) {
- _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base,
+ _env->ReleaseIntArrayElements(coords_ref, (jint*)coords_base,
JNI_ABORT);
}
if (_exception) {
@@ -7132,12 +7132,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfixed *coords = (GLfixed *) 0;
- coords = (GLfixed *)getPointer(_env, coords_buf, &_array, &_remaining, &_bufferOffset);
+ coords = (GLfixed *)getPointer(_env, coords_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < 5) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -7145,7 +7145,7 @@
goto exit;
}
if (coords == NULL) {
- char * _coordsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _coordsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
coords = (GLfixed *) (_coordsBase + _bufferOffset);
}
glDrawTexxvOES(
@@ -7154,7 +7154,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, coords, JNI_FALSE);
+ _env->ReleaseIntArrayElements(_array, (jint*)coords, JNI_ABORT);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -7368,7 +7368,7 @@
goto exit;
}
framebuffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
framebuffers = framebuffers_base + offset;
glDeleteFramebuffersOES(
@@ -7378,7 +7378,7 @@
exit:
if (framebuffers_base) {
- _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
+ _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -7398,12 +7398,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *framebuffers = (GLuint *) 0;
- framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset);
+ framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -7411,7 +7411,7 @@
goto exit;
}
if (framebuffers == NULL) {
- char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
}
glDeleteFramebuffersOES(
@@ -7421,7 +7421,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -7464,7 +7464,7 @@
goto exit;
}
renderbuffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
renderbuffers = renderbuffers_base + offset;
glDeleteRenderbuffersOES(
@@ -7474,7 +7474,7 @@
exit:
if (renderbuffers_base) {
- _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
+ _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -7494,12 +7494,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *renderbuffers = (GLuint *) 0;
- renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset);
+ renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -7507,7 +7507,7 @@
goto exit;
}
if (renderbuffers == NULL) {
- char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
}
glDeleteRenderbuffersOES(
@@ -7517,7 +7517,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -7609,7 +7609,7 @@
goto exit;
}
framebuffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
framebuffers = framebuffers_base + offset;
glGenFramebuffersOES(
@@ -7619,7 +7619,7 @@
exit:
if (framebuffers_base) {
- _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base,
+ _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -7639,12 +7639,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *framebuffers = (GLuint *) 0;
- framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset);
+ framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -7652,7 +7652,7 @@
goto exit;
}
if (framebuffers == NULL) {
- char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
}
glGenFramebuffersOES(
@@ -7662,7 +7662,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -7705,7 +7705,7 @@
goto exit;
}
renderbuffers_base = (GLuint *)
- _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0);
+ _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
renderbuffers = renderbuffers_base + offset;
glGenRenderbuffersOES(
@@ -7715,7 +7715,7 @@
exit:
if (renderbuffers_base) {
- _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base,
+ _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -7735,12 +7735,12 @@
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLuint *renderbuffers = (GLuint *) 0;
- renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset);
+ renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (_remaining < n) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -7748,7 +7748,7 @@
goto exit;
}
if (renderbuffers == NULL) {
- char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
}
glGenRenderbuffersOES(
@@ -7758,7 +7758,7 @@
exit:
if (_array) {
- releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, _exception ? JNI_ABORT : 0);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -7795,7 +7795,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetFramebufferAttachmentParameterivOES(
@@ -7807,7 +7807,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -7824,14 +7824,14 @@
"glGetFramebufferAttachmentParameterivOES");
return;
}
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetFramebufferAttachmentParameterivOES(
@@ -7841,7 +7841,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -7875,7 +7875,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetRenderbufferParameterivOES(
@@ -7886,7 +7886,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -7903,14 +7903,14 @@
"glGetRenderbufferParameterivOES");
return;
}
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetRenderbufferParameterivOES(
@@ -7919,7 +7919,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -7953,7 +7953,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexGenfv(
@@ -7964,7 +7964,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -7981,14 +7981,14 @@
"glGetTexGenfv");
return;
}
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glGetTexGenfv(
@@ -7997,7 +7997,7 @@
(GLfloat *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, 0);
}
}
@@ -8031,7 +8031,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexGeniv(
@@ -8042,7 +8042,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -8059,14 +8059,14 @@
"glGetTexGeniv");
return;
}
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetTexGeniv(
@@ -8075,7 +8075,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -8109,7 +8109,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glGetTexGenxv(
@@ -8120,7 +8120,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -8137,14 +8137,14 @@
"glGetTexGenxv");
return;
}
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glGetTexGenxv(
@@ -8153,7 +8153,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -8252,7 +8252,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLfloat *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetFloatArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexGenfv(
@@ -8263,7 +8263,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -8280,14 +8280,14 @@
"glTexGenfv");
return;
}
- jarray _array = (jarray) 0;
+ jfloatArray _array = (jfloatArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLfloat *params = (GLfloat *) 0;
- params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
params = (GLfloat *) (_paramsBase + _bufferOffset);
}
glTexGenfv(
@@ -8296,7 +8296,7 @@
(GLfloat *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseFloatArrayElements(_array, (jfloat*)params, 0);
}
}
@@ -8346,7 +8346,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexGeniv(
@@ -8357,7 +8357,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -8374,14 +8374,14 @@
"glTexGeniv");
return;
}
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glTexGeniv(
@@ -8390,7 +8390,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
@@ -8440,7 +8440,7 @@
}
_remaining = _env->GetArrayLength(params_ref) - offset;
params_base = (GLint *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ _env->GetIntArrayElements(params_ref, (jboolean *)0);
params = params_base + offset;
glTexGenxv(
@@ -8451,7 +8451,7 @@
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+ _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -8468,14 +8468,14 @@
"glTexGenxv");
return;
}
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLint *params = (GLint *) 0;
- params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
params = (GLint *) (_paramsBase + _bufferOffset);
}
glTexGenxv(
@@ -8484,7 +8484,7 @@
(GLint *)params
);
if (_array) {
- releasePointer(_env, _array, params, JNI_TRUE);
+ _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
}
}
diff --git a/core/res/res/drawable/ic_eject_24dp.xml b/core/res/res/drawable/ic_eject_24dp.xml
new file mode 100644
index 0000000..1bb351a
--- /dev/null
+++ b/core/res/res/drawable/ic_eject_24dp.xml
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M5 17h14v2H5zm7,-12L5.33 15h13.34z"/>
+</vector>
diff --git a/core/res/res/drawable/ic_folder_24dp.xml b/core/res/res/drawable/ic_folder_24dp.xml
new file mode 100644
index 0000000..9a386ca
--- /dev/null
+++ b/core/res/res/drawable/ic_folder_24dp.xml
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M20 8H8c-2.21 0,-3.98 1.79,-3.98 4L4 36c0 2.21 1.79 4 4 4h32c2.21 0 4,-1.79 4,-4V16c0,-2.21,-1.79,-4,-4,-4H24l-4,-4z"/>
+</vector>
diff --git a/core/res/res/drawable/ic_perm_device_info.xml b/core/res/res/drawable/ic_perm_device_info.xml
new file mode 100644
index 0000000..ef91c74
--- /dev/null
+++ b/core/res/res/drawable/ic_perm_device_info.xml
@@ -0,0 +1,24 @@
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24.0dp"
+ android:height="24.0dp"
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M26.0,14.0l-4.0,0.0l0.0,4.0l4.0,0.0l0.0,-4.0zm0.0,8.0l-4.0,0.0l0.0,12.0l4.0,0.0L26.0,22.0zm8.0,-19.98L14.0,2.0c-2.21,0.0 -4.0,1.79 -4.0,4.0l0.0,36.0c0.0,2.21 1.79,4.0 4.0,4.0l20.0,0.0c2.21,0.0 4.0,-1.79 4.0,-4.0L38.0,6.0c0.0,-2.21 -1.79,-3.98 -4.0,-3.98zM34.0,38.0L14.0,38.0L14.0,10.0l20.0,0.0l0.0,28.0z"/>
+</vector>
diff --git a/core/res/res/drawable/ic_sd_card_48dp.xml b/core/res/res/drawable/ic_sd_card_48dp.xml
new file mode 100644
index 0000000..90bab47
--- /dev/null
+++ b/core/res/res/drawable/ic_sd_card_48dp.xml
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M36 4H20L8.04 16 8 40c0 2.2 1.8 4 4 4h24c2.2 0 4,-1.8 4,-4V8c0,-2.2,-1.8,-4,-4,-4zM24 16h-4V8h4v8zm6 0h-4V8h4v8zm6 0h-4V8h4v8z"/>
+</vector>
diff --git a/core/res/res/drawable/ic_settings_24dp.xml b/core/res/res/drawable/ic_settings_24dp.xml
new file mode 100644
index 0000000..fc75f04
--- /dev/null
+++ b/core/res/res/drawable/ic_settings_24dp.xml
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M38.86 25.95c.08,-.64.14,-1.29.14,-1.95s-.06,-1.31,-.14,-1.95l4.23,-3.31c.38,-.3.49,-.84.24,-1.28l-4,-6.93c-.25,-.43,-.77,-.61,-1.22,-.43l-4.98 2.01c-1.03,-.79,-2.16,-1.46,-3.38,-1.97L29 4.84c-.09,-.47,-.5,-.84,-1,-.84h-8c-.5 0,-.91.37,-.99.84l-.75 5.3c-1.22.51,-2.35 1.17,-3.38 1.97L9.9 10.1c-.45,-.17,-.97 0,-1.22.43l-4 6.93c-.25.43,-.14.97.24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31.14 1.95l-4.22 3.31c-.38.3,-.49.84,-.24 1.28l4 6.93c.25.43.77.61 1.22.43l4.98,-2.01c1.03.79 2.16 1.46 3.38 1.97l.75 5.3c.08.47.49.84.99.84h8c.5 0 .91,-.37.99,-.84l.75,-5.3c1.22,-.51 2.35,-1.17 3.38,-1.97l4.98 2.01c.45.17.97 0 1.22,-.43l4,-6.93c.25,-.43.14,-.97,-.24,-1.28l-4.22,-3.31zM24 31c-3.87 0,-7,-3.13,-7,-7s3.13,-7 7,-7 7 3.13 7 7,-3.13 7,-7 7z"/>
+</vector>
diff --git a/core/res/res/drawable/ic_storage_48dp.xml b/core/res/res/drawable/ic_storage_48dp.xml
new file mode 100644
index 0000000..14233a4
--- /dev/null
+++ b/core/res/res/drawable/ic_storage_48dp.xml
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M4 40h40v-8H4v8zm4,-6h4v4H8v-4zM4 8v8h40V8H4zm8 6H8v-4h4v4zM4 28h40v-8H4v8zm4,-6h4v4H8v-4z"/>
+</vector>
diff --git a/core/res/res/drawable/ic_usb_48dp.xml b/core/res/res/drawable/ic_usb_48dp.xml
new file mode 100644
index 0000000..b2ec709
--- /dev/null
+++ b/core/res/res/drawable/ic_usb_48dp.xml
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M30 14v8h2v4h-6V10h4l-6,-8,-6 8h4v16h-6v-4.14c1.41,-.73 2.4,-2.16 2.4,-3.86 0,-2.43,-1.97,-4.4,-4.4,-4.4,-2.43 0,-4.4 1.97,-4.4 4.4 0 1.7.99 3.13 2.4 3.86V26c0 2.21 1.79 4 4 4h6v6.1c-1.42.73,-2.4 2.19,-2.4 3.9 0 2.43 1.97 4.4 4.4 4.4 2.43 0 4.4,-1.97 4.4,-4.4 0,-1.71,-.98,-3.17,-2.4,-3.9V30h6c2.21 0 4,-1.79 4,-4v-4h2v-8h-8z"/>
+</vector>
diff --git a/core/res/res/layout/select_dialog_multichoice_material.xml b/core/res/res/layout/select_dialog_multichoice_material.xml
index e21df73..36e8e57 100644
--- a/core/res/res/layout/select_dialog_multichoice_material.xml
+++ b/core/res/res/layout/select_dialog_multichoice_material.xml
@@ -25,6 +25,6 @@
android:gravity="center_vertical"
android:paddingStart="@dimen/select_dialog_padding_start_material"
android:paddingEnd="?attr/dialogPreferredPadding"
- android:checkMark="?attr/listChoiceIndicatorMultiple"
- android:checkMarkGravity="start"
+ android:drawableStart="?attr/listChoiceIndicatorMultiple"
+ android:drawablePadding="20dp"
android:ellipsize="marquee" />
diff --git a/core/res/res/layout/select_dialog_singlechoice_material.xml b/core/res/res/layout/select_dialog_singlechoice_material.xml
index 3828317..995272a 100644
--- a/core/res/res/layout/select_dialog_singlechoice_material.xml
+++ b/core/res/res/layout/select_dialog_singlechoice_material.xml
@@ -25,6 +25,6 @@
android:gravity="center_vertical"
android:paddingStart="@dimen/select_dialog_padding_start_material"
android:paddingEnd="?attr/dialogPreferredPadding"
- android:checkMark="?attr/listChoiceIndicatorSingle"
- android:checkMarkGravity="start"
+ android:drawableStart="?attr/listChoiceIndicatorSingle"
+ android:drawablePadding="20dp"
android:ellipsize="marquee" />
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 5b564e1..f249c4a 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1255,6 +1255,9 @@
<!-- Generic error message shown when the fingerprint hardware can't recognize the fingerprint -->
<string name="fingerprint_error_unable_to_process">Try again.</string>
+ <!-- Template to be used to name enrolled fingerprints by default. -->
+ <string name="fingerprint_name_template">Finger <xliff:g id="fingerId" example="1">%d</xliff:g></string>
+
<!-- Array containing custom error messages from vendor. Vendor is expected to add and translate these strings -->
<string-array name="fingerprint_error_vendor">
</string-array>
@@ -2916,18 +2919,20 @@
<!-- USB_STORAGE_ERROR dialog ok button-->
<string name="dlg_ok">OK</string>
+ <!-- USB_PREFERENCES: Notification for when the user connected to the charger only. This is the title -->
+ <string name="usb_charging_notification_title">USB for charging</string>
<!-- USB_PREFERENCES: Notification for when the user connects the phone to a computer via USB in MTP mode. This is the title -->
- <string name="usb_mtp_notification_title">Connected as a media device</string>
+ <string name="usb_mtp_notification_title">USB for file transfer</string>
<!-- USB_PREFERENCES: Notification for when the user connects the phone to a computer via USB in PTP mode. This is the title -->
- <string name="usb_ptp_notification_title">Connected as a camera</string>
+ <string name="usb_ptp_notification_title">USB for photo transfer</string>
<!-- USB_PREFERENCES: Notification for when the user connects the phone to a computer via USB in MIDI mode. This is the title -->
- <string name="usb_midi_notification_title">Connected as a MIDI device</string>
+ <string name="usb_midi_notification_title">USB for MIDI</string>
<!-- USB_PREFERENCES: Notification for when the user connects the phone to a computer via USB in mass storage mode (for installer CD image). This is the title -->
<string name="usb_cd_installer_notification_title">Connected as an installer</string>
<!-- USB_PREFERENCES: Notification for when a USB accessory is attached. This is the title -->
<string name="usb_accessory_notification_title">Connected to a USB accessory</string>
<!-- See USB_PREFERENCES. This is the message. -->
- <string name="usb_notification_message">Touch for other USB options.</string>
+ <string name="usb_notification_message">Touch for more options.</string>
<!-- External media format dialog strings -->
<!-- This is the label for the activity, and should never be visible to the user. -->
@@ -4031,24 +4036,48 @@
<item quantity="other">For %1$d minutes (until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g>)</item>
</plurals>
+ <!-- Zen mode condition - summary: time duration in minutes (short version). [CHAR LIMIT=NONE] -->
+ <plurals name="zen_mode_duration_minutes_summary_short">
+ <item quantity="one">For 1 min (until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g>)</item>
+ <item quantity="other">For %1$d min (until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g>)</item>
+ </plurals>
+
<!-- Zen mode condition - summary: time duration in hours. [CHAR LIMIT=NONE] -->
<plurals name="zen_mode_duration_hours_summary">
<item quantity="one">For one hour (until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g>)</item>
<item quantity="other">For %1$d hours (until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g>)</item>
</plurals>
+ <!-- Zen mode condition - summary: time duration in hours (short version). [CHAR LIMIT=NONE] -->
+ <plurals name="zen_mode_duration_hours_summary_short">
+ <item quantity="one">For 1 hr (until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g>)</item>
+ <item quantity="other">For %1$d hr (until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g>)</item>
+ </plurals>
+
<!-- Zen mode condition - line one: time duration in minutes. [CHAR LIMIT=NONE] -->
<plurals name="zen_mode_duration_minutes">
<item quantity="one">For one minute</item>
<item quantity="other">For %d minutes</item>
</plurals>
+ <!-- Zen mode condition - line one: time duration in minutes (short version). [CHAR LIMIT=NONE] -->
+ <plurals name="zen_mode_duration_minutes_short">
+ <item quantity="one">For 1 min</item>
+ <item quantity="other">For %d min</item>
+ </plurals>
+
<!-- Zen mode condition - line one: time duration in hours. [CHAR LIMIT=NONE] -->
<plurals name="zen_mode_duration_hours">
<item quantity="one">For one hour</item>
<item quantity="other">For %d hours</item>
</plurals>
+ <!-- Zen mode condition - line one: time duration in hours (short version). [CHAR LIMIT=NONE] -->
+ <plurals name="zen_mode_duration_hours_short">
+ <item quantity="one">For 1 hr</item>
+ <item quantity="other">For %d hr</item>
+ </plurals>
+
<!-- Zen mode condition - line two: ending time. [CHAR LIMIT=NONE] -->
<string name="zen_mode_until">Until <xliff:g id="formattedTime" example="10:00 PM">%1$s</xliff:g></string>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 8f949e1..cc25885 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1790,6 +1790,7 @@
<java-symbol type="string" name="usb_accessory_notification_title" />
<java-symbol type="string" name="usb_cd_installer_notification_title" />
<java-symbol type="string" name="usb_mtp_notification_title" />
+ <java-symbol type="string" name="usb_charging_notification_title" />
<java-symbol type="string" name="usb_notification_message" />
<java-symbol type="string" name="use_physical_keyboard" />
<java-symbol type="string" name="usb_ptp_notification_title" />
@@ -2060,6 +2061,10 @@
<java-symbol type="plurals" name="zen_mode_duration_hours" />
<java-symbol type="plurals" name="zen_mode_duration_minutes_summary" />
<java-symbol type="plurals" name="zen_mode_duration_hours_summary" />
+ <java-symbol type="plurals" name="zen_mode_duration_minutes_short" />
+ <java-symbol type="plurals" name="zen_mode_duration_hours_short" />
+ <java-symbol type="plurals" name="zen_mode_duration_minutes_summary_short" />
+ <java-symbol type="plurals" name="zen_mode_duration_hours_summary_short" />
<java-symbol type="string" name="zen_mode_until" />
<java-symbol type="string" name="zen_mode_feature_name" />
<java-symbol type="string" name="zen_mode_downtime_feature_name" />
@@ -2108,6 +2113,7 @@
<java-symbol type="array" name="fingerprint_acquired_vendor" />
<java-symbol type="string" name="fingerprint_error_canceled" />
<java-symbol type="string" name="fingerprint_error_lockout" />
+ <java-symbol type="string" name="fingerprint_name_template" />
<!-- From various Material changes -->
<java-symbol type="attr" name="titleTextAppearance" />
@@ -2230,6 +2236,13 @@
<java-symbol type="string" name="storage_usb_drive_label" />
<java-symbol type="string" name="storage_usb" />
+ <java-symbol type="drawable" name="ic_eject_24dp" />
+ <java-symbol type="drawable" name="ic_folder_24dp" />
+ <java-symbol type="drawable" name="ic_sd_card_48dp" />
+ <java-symbol type="drawable" name="ic_settings_24dp" />
+ <java-symbol type="drawable" name="ic_storage_48dp" />
+ <java-symbol type="drawable" name="ic_usb_48dp" />
+
<!-- Floating toolbar -->
<java-symbol type="layout" name="floating_popup_container" />
<java-symbol type="layout" name="floating_popup_menu_button" />
@@ -2262,4 +2275,5 @@
<java-symbol type="color" name="chooser_service_row_background_color" />
<java-symbol type="id" name="target_badge" />
<java-symbol type="bool" name="config_supportDoubleTapWake" />
+ <java-symbol type="drawable" name="ic_perm_device_info" />
</resources>
diff --git a/docs/html/design/index.jd b/docs/html/design/index.jd
index 638f35b..1ffb0a3 100644
--- a/docs/html/design/index.jd
+++ b/docs/html/design/index.jd
@@ -41,8 +41,12 @@
</div>
</div>
</section>
-
-<section class="dac-section dac-gray dac-small dac-invert"><div class="wrap">
+<div class="wrap dac-offset-parent">
+ <a class="dac-fab dac-scroll-button" data-scroll-button href="#latest">
+ <i class="dac-sprite dac-arrow-down-gray"></i>
+ </a>
+</div>
+<section class="dac-section dac-gray dac-small dac-invert" id="latest"><div class="wrap">
<h2 class="norule">Latest</h2>
<div class="resource-widget resource-flow-layout col-16"
data-query="collection:design/landing/latest"
diff --git a/docs/html/develop/index.jd b/docs/html/develop/index.jd
index 970aded..80e42f2 100644
--- a/docs/html/develop/index.jd
+++ b/docs/html/develop/index.jd
@@ -9,41 +9,52 @@
excludeFromSuggestions=true
@jd:body
-<section class="dac-expand dac-hero dac-light">
+ <section class="dac-expand dac-hero dac-blue">
<div class="wrap">
<div class="cols dac-hero-content">
<div class="col-1of2 col-push-1of2 dac-hero-figure">
<img class="dac-hero-image" src="/images/develop/hero-android-studio-on-device.png">
</div>
<div class="col-1of2 col-pull-1of2">
- <h1 class="dac-hero-title">Start!</h1>
+ <h1 class="dac-hero-title">Get Started with Android</h1>
<p class="dac-hero-description">
- Set up your environment and create an app. Build faster with sample projects and templates.
+ Everything you need to build incredible app experiences on phones and tablets, Wear, TV, and Auto. </p>
+
+<!--Set up your environment and create an app. Build faster with sample projects and templates.-->
</p>
- <a class="dac-hero-cta" href="/sdk/index.html">
+ <a class="dac-hero-cta" href="{@docRoot}sdk/index.html">
<span class="dac-sprite dac-auto-chevron"></span>
Set up Android Studio
</a><br>
- <a class="dac-hero-cta" href="/training/basics/firstapp/index.html">
+ <a class="dac-hero-cta" href="{@docRoot}training/basics/firstapp/index.html">
<span class="dac-sprite dac-auto-chevron"></span>
- Make your first app
+ Build your first app
</a><br>
- <a class="dac-hero-cta" href="/guide/index.html">
+ <a class="dac-hero-cta" href="{@docRoot}guide/index.html">
<span class="dac-sprite dac-auto-chevron"></span>
Learn about Android
</a><br>
+ <a class="dac-hero-cta" href="{@docRoot}guide/index.html">
+ <span class="dac-sprite dac-auto-chevron"></span>
+ Sample projects
+ </a><br>
</div>
</div>
- <div class="dac-section dac-small">
+ <!--<div class="dac-section dac-small">
<div class="resource-widget resource-flow-layout col-16"
data-query="collection:develop/landing/mainlinks"
data-cardSizes="6x2"
data-maxResults="6"></div>
- </div>
+ </div>-->
</div>
</section>
+<div class="wrap dac-offset-parent">
+ <a class="dac-fab dac-scroll-button" data-scroll-button href="#latest">
+ <i class="dac-sprite dac-arrow-down-gray"></i>
+ </a>
+</div>
-<section class="dac-section dac-gray dac-small dac-invert"><div class="wrap">
+<section class="dac-section dac-gray dac-small dac-invert" id="latest"><div class="wrap">
<h2 class="norule">Latest</h2>
<div class="resource-widget resource-flow-layout col-16"
data-query="collection:develop/landing/latest"
@@ -51,6 +62,19 @@
data-maxResults="3"></div>
</div></section>
+<section class="dac-section dac-section-light"><div class="wrap">
+ <h1 class="dac-section-title">Tools for building apps</h1>
+ <div class="dac-section-subtitle">
+ Insights into Android's tools and libraries to speed your development.
+ </div>
+ <div class="resource-widget resource-flow-layout col-16"
+ data-query="collection:develop/landing/tools"
+ data-cardSizes="6x6"
+ data-maxResults="3"
+ data-sortOrder="random"></div>
+ <ul class="dac-section-links">
+ </ul>
+</div></section>
<section class="dac-section dac-light"><div class="wrap">
<h1 class="dac-section-title">Android performance patterns</h1>
@@ -69,21 +93,8 @@
</ul>
</div></section>
-<section class="dac-section dac-section-light"><div class="wrap">
- <h1 class="dac-section-title">Tools for building apps</h1>
- <div class="dac-section-subtitle">
- Insights into Android's tools and libraries to speed your development.
- </div>
- <div class="resource-widget resource-flow-layout col-16"
- data-query="collection:develop/landing/tools"
- data-cardSizes="6x6"
- data-maxResults="3"></div>
- <ul class="dac-section-links">
- </ul>
-</div></section>
-
-<section class="dac-section dac-light"><div class="wrap">
- <h1 class="dac-section-title">Ubiquitous computing</h1>
+<section class="dac-section dac-gray"><div class="wrap">
+ <h1 class="dac-section-title">Ubiquitous computing on Android</h1>
<div class="dac-section-subtitle">
Opening up new stuff.
</div>
@@ -107,9 +118,10 @@
</ul>
</div></section>
-<section class="dac-section dac-gray"><div class="wrap">
- <h1 class="dac-section-title">Courses</h1>
- <div class="dac-section-subtitle">Free online courses from Android experts that bring you step-by-step to building your own apps.</div>
+<section class="dac-section dac-light"><div class="wrap">
+ <h1 class="dac-section-title">Online Courses</h1>
+ <div class="dac-section-subtitle">Free online courses from Android
+ experts that bring you step-by-step to building your own apps.</div>
<div class="resource-widget resource-flow-layout col-16"
data-query="collection:develop/landing/courses"
data-cardSizes="6x6"
diff --git a/docs/html/distribute/engage/ads.jd b/docs/html/distribute/engage/ads.jd
new file mode 100644
index 0000000..9ca72f3
--- /dev/null
+++ b/docs/html/distribute/engage/ads.jd
@@ -0,0 +1,58 @@
+page.title=Drive engagement with AdWords Ads
+page.metaDescription=Keep users coming back. AdWords offers re-engagement tools to help your app stay top of mind with users.
+page.tags="engagement, adwords"
+page.image=images/cards/adwords_2x.jpg
+@jd:body
+
+<p>Successful apps keep users coming back again and again. AdWords offers app
+re-engagement tools to help your app stay top of mind with users who’ve
+already installed it on their phone. AdWords can remind them of key features
+and encourage them to try your app again, or help them complete an activity
+they didn't know your app could handle.</p>
+
+<p>
+ <a href="https://support.google.com/adwords/answer/6032073">Get started with AdWords mobile
+ app engagement campaigns</a>.
+</p>
+
+<div>
+ <div class="figure-left" style="width:46%;">
+ <h3>From search</h3>
+ <img src="/images/distribute/promote_ads.png">
+ <p class="figure-caption">Add deep links to your app, then bring users straight
+ to relevant app content when they’re searching.</p>
+ </div>
+ <div class="figure-right" style="width:46%;">
+ <h3>From apps</h3>
+ <img src="/images/distribute/promote_ads_inapp.png">
+ <p class="figure-caption">Use remarketing and deep links to bring users to just the right
+ place in your app to re-engage and convert, from other apps and games they love.</p>
+ </div>
+</div>
+
+<h3 id="tips">Tips</h2>
+
+<ul>
+ <li> Track what users do in your app after they click an ad, by installing the
+ AdWords <a href="https://developers.google.com/app-conversion-tracking/">conversion tracking
+ SDK</a>.
+ <li> Advertise a compelling reason for users to re-engage with your app, such as a
+ reminder or a special offer.
+ <li> <a href="https://developers.google.com/app-indexing/webmasters/app">Add deep links</a> to
+ your app and bring users directly to the most relevant and interesting
+ parts of your app, where they can easily take action.
+ <li> Re-engage with your app users across the Display Network with remarketing lists
+and search with keywords.
+ <li> Use remarketing lists to target high value users so that you can drive more
+conversions in your app.
+</ul>
+
+<h2 id="related_resources">Related resources</h2>
+
+<div class="resource-widget resource-flow-layout col-13"
+ data-query="collection:distribute/engage/reengage"
+ data-sortorder="-timestamp"
+ data-cardsizes="9x3"
+ data-maxresults="6">
+</div>
+
diff --git a/docs/html/distribute/engage/appindexing.jd b/docs/html/distribute/engage/appindexing.jd
new file mode 100644
index 0000000..2b8f315
--- /dev/null
+++ b/docs/html/distribute/engage/appindexing.jd
@@ -0,0 +1,61 @@
+page.title=Bring Users from Google Search
+page.metaDescription=Use search to bring your existing users back into your app.
+page.image=images/cards/adwords_2x.jpg
+page.tags="engagement, search"
+@jd:body
+
+<p>Use the features of Google Search for Android to drive the use of your apps: </p>
+
+<ul>
+<li>Once users have installed your app, search can bring them back with <strong>deep-links</strong> direct to your app. </li>
+ <li>When users use <strong>voice commands</strong> to ask Google to perform a task, your app can be one of those
+completing the task.</li>
+
+<li>You can also take advantage of <strong>Google Now</strong> to
+display cards for event, flight, hotel, and restaurant reservations you notify
+to users’ gmail addresses, and bring users back from the email linked to the
+card.</li>
+</ul>
+
+<p>Start now by <a href="https://developers.google.com/app-indexing/">indexing your app</a>, then take advantage of <a href="https://developers.google.com/voice-actions/">Voice Actions</a>, the <a href="https://developers.google.com/app-indexing/webmasters/appindexingapi">App Indexing API</a>, and <a href="https://developers.google.com/schemas/now/cards">Google Now Cards</a>.</p>
+
+
+<h2 id="help_users_find_your_information">Help Users Find Your Information</h2>
+
+<p>Re-engage with your users with deep-links displayed in search results, links
+that take users directly to content within your app.</p>
+
+
+<div style="margin-top:1.5em;margin-left:24px">
+<img src="{@docRoot}images/distribute/more-app-engagement.png">
+</div>
+<h2 id="empower_users_in_your_app">Empower your users to get things done in your app</h2>
+
+<p>Brings your users into your app to take action with voice actions such as “Ok
+Google, play a song” with the music app of choice, or “Ok Google, search for
+hotels in Maui on TripAdvisor” in the TripAdvisor app.</p>
+
+<div style="margin-top:1em">
+<img src="{@docRoot}images/distribute/music-action.png">
+</div>
+
+
+<h2 id="assist_your_users">Assist your users where and when they need it</h2>
+
+<div class="figure">
+<img src="https://developers.google.com/schemas/images/now_eventconfirmation.png">
+</div>
+
+<p>Inform your users of their reservations with cards created from structured data
+markup delivered in Gmail notifications. Cards also lead users quickly back to
+your email message, for further engagement.</p>
+
+<h2 style="clear:both" id="related-resources">Related Resources</h2>
+
+<div class="resource-widget resource-flow-layout col-13"
+ data-query="collection:distribute/engage/appindexing"
+ data-sortOrder="-timestamp"
+ data-cardSizes="9x3"
+ data-maxResults="6"></div>
+
+
diff --git a/docs/html/distribute/engage/deep-linking.jd b/docs/html/distribute/engage/deep-linking.jd
index ea1f1de..b8d974c 100644
--- a/docs/html/distribute/engage/deep-linking.jd
+++ b/docs/html/distribute/engage/deep-linking.jd
@@ -26,27 +26,26 @@
before accessing the resource.
</p>
-<div style="padding:2em, auto;width:550px;">
- <div style="float:right; width:260px; padding-left:1em;">
- <img src="{@docRoot}images/gp-engage-5.jpg" class="border-img">
- <p class="img-caption">
+
+<div style="inline-block">
+
+<div class="col-5">
+ <img src="{@docRoot}images/gp-engage-5.jpg">
+ <p class="figure-caption">
G+ Post with Deep Link to Buy
</p>
- </div>
+</div>
- <div style="width:260px;float:left;">
- <img src="{@docRoot}images/gp-engage-6.jpg" class="border-img">
- <p class="img-caption">
+<div class="col-5">
+ <img src="{@docRoot}images/gp-engage-6.jpg">
+ <p class="figure-caption">
Purchase page within app
</p>
- </div>
</div>
-
-<div class="headerLine">
-<h2>Deep Linking from Google Search — App Indexing</h2>
</div>
+<h2 style="clear:both">Deep Linking from Google Search — App Indexing</h2>
<div style="float:right;">
<img src="/images/gp-listing-4.jpg" style="padding-top:1em;padding-left:2em;">
@@ -65,15 +64,15 @@
content</a>.
</p>
-<div class="clearfloat" style="margin-top:2em;"></div>
-<div style="float:right;width:340px;padding-left:2em;">
- <img src="/images/gp-ads-linking2.jpg" style="padding-top:1em;">
+
+<h2 style="clear:both" style="padding-top:2em">Deep Linking from Google Ads</h2>
+
+
+<div class="col-5" style="float:right">
+ <img src="{@docRoot}images/gp-ads-linking2.jpg" >
</div>
-<div class="headerLine ">
-<h2>Deep Linking from Google Ads</h2>
-</div>
<p>
Ads can remind users about the apps they already have.
</p>
diff --git a/docs/html/distribute/engage/engage_toc.cs b/docs/html/distribute/engage/engage_toc.cs
index eb176f9..4639d55 100644
--- a/docs/html/distribute/engage/engage_toc.cs
+++ b/docs/html/distribute/engage/engage_toc.cs
@@ -31,18 +31,37 @@
</li>
<li class="nav-section">
<div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
- var:toroot?>distribute/engage/game-services.html">
- <span class="en">Encourage Competition</span></a>
+ var:toroot?>distribute/engage/ads.html">
+ <span class="en">Drive engagement with Ads</span></a>
</div>
</li>
<li class="nav-section">
<div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
+ var:toroot?>distribute/engage/appindexing.html">
+ <span class="en">Bring Users from Search</span></a>
+ </div>
+ </li>
+ <li class="nav-section">
+ <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
+ var:toroot?>distribute/engage/intents.html">
+ <span class="en">Use the Power of Intents</span></a>
+ </div>
+ </li>
+
+ <li class="nav-section">
+ <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
var:toroot?>distribute/engage/analytics.html">
<span class="en">Understand User Behavior</span></a>
</div>
</li>
<li class="nav-section">
<div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
+ var:toroot?>distribute/engage/game-services.html">
+ <span class="en">Encourage Competition</span></a>
+ </div>
+ </li>
+ <li class="nav-section">
+ <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs
var:toroot?>distribute/engage/app-updates.html">
<span class="en">Update Regularly</span></a>
</div>
diff --git a/docs/html/distribute/engage/index.jd b/docs/html/distribute/engage/index.jd
index 2b103c3..a47e004 100644
--- a/docs/html/distribute/engage/index.jd
+++ b/docs/html/distribute/engage/index.jd
@@ -1,5 +1,5 @@
page.title=Engage & Retain Users
-page.metaDescription=Engaging and retaining active users is the key to success. Here are some resources to help you build an active user base.
+page.metaDescription=Engaging and retaining active users are the keys to success. Here are some resources to help you build an active user base.
section.landing=true
nonavpage=true
@@ -15,8 +15,13 @@
<div class="resource-widget resource-flow-layout landing col-16"
data-query="collection:distribute/engagelanding"
- data-cardSizes="9x6,9x6,6x6,6x6,6x6,9x6,9x6,6x6,6x6,6x6"
- data-maxResults="10">
+ data-cardSizes="6x6"
+ data-maxResults="6">
+ </div>
+ <div class="resource-widget resource-flow-layout landing col-16"
+ data-query="collection:distribute/engagelanding"
+ data-cardSizes="6x2"
+ data-maxResults="20">
</div>
<h3>Related Resources</h3>
diff --git a/docs/html/distribute/engage/intents.jd b/docs/html/distribute/engage/intents.jd
new file mode 100644
index 0000000..0371ac4
--- /dev/null
+++ b/docs/html/distribute/engage/intents.jd
@@ -0,0 +1,39 @@
+page.title=Drive On-Device Discovery through Android Intents
+page.metaDescription=Make your app available to users as they perform tasks in other apps through Intents.
+page.tags="engagement"
+@jd:body
+
+<p>Let the user choose <em>your app</em> to handle specific tasks from another app,
+such as sharing a picture, sending a message, or playing music. You can do this though
+Android's open Intents system. By adding Intent filters for the tasks your app can handle,
+you make it easy for the user to access your app’s features from other apps and from voice
+commands in Google Now.</p>
+
+<img src="{@docRoot}images/distribute/engage-intents.png">
+
+<p>By declaring Intent Filters in your app, it informs the Android OS about the
+actions it can perform for other apps. And in addition to making it easy for
+your users to make full use of your app’s features, it can help them discover
+features they didn’t know it supported.</p>
+
+<p>To learn about all the ways you can use Intents, check out <a
+href="{@docRoot}guide/components/intents-filters.html">Intents and Intent Filters</a>.</p>
+
+<h2 id=tips>Tips</h2>
+
+<ul>
+ <li> Identify and package any features your app can offer to other apps.
+ <li> Use the "view" intent to give users the option to open any links to your
+website within your app instead.
+ <li> Familiarize yourself with actions commonly accomplished with intents, such as
+sharing, so that you can focus on your app's core functionality and outsource
+common actions.
+</ul>
+
+<h2 style="clear:both" id="related-resources">Related Resources</h2>
+
+<div class="resource-widget resource-flow-layout col-13"
+ data-query="collection:distribute/engage/intents"
+ data-sortOrder="-timestamp"
+ data-cardSizes="9x3"
+ data-maxResults="6"></div>
diff --git a/docs/html/distribute/index.jd b/docs/html/distribute/index.jd
index c49fe3e..bff8df6 100644
--- a/docs/html/distribute/index.jd
+++ b/docs/html/distribute/index.jd
@@ -10,7 +10,13 @@
<div class="dac-hero-carousel" data-carousel-query="collection:distribute/landing/carousel">
</div>
-<section class="dac-section dac-gray dac-small dac-invert"><div class="wrap">
+<div class="wrap dac-offset-parent">
+ <a class="dac-fab dac-scroll-button" data-scroll-button href="#latest">
+ <i class="dac-sprite dac-arrow-down-gray"></i>
+ </a>
+</div>
+
+<section class="dac-section dac-gray dac-small dac-invert" id="latest"><div class="wrap">
<h2 class="norule">Latest</h2>
<div class="resource-widget resource-flow-layout col-16"
data-query="type:youtube+tag:googleplay+tag:developerstory+tag:featured, type:blog+tag:googleplay+tag:distribute+tag:featured"
diff --git a/docs/html/distribute/monetize/ads.jd b/docs/html/distribute/monetize/ads.jd
index b5c5f4a..8f6c8b0 100644
--- a/docs/html/distribute/monetize/ads.jd
+++ b/docs/html/distribute/monetize/ads.jd
@@ -1,138 +1,129 @@
-page.title=Monetize with Ads
-page.metaDescription=Ads are a quick and easy way to incorporate a monetization option into both your free and paid apps.
-page.tags="monetizing", "free", "freemium", "ads"
-page.image=/distribute/images/advertising.jpg
-
+page.title=Earn Revenue from AdMob Ads
+page.metaDescription=Gain insights about your users, drive more in-app purchases, and maximize your ad revenue.
+page.tags="monetizing", "ads", "admob", "ads"
+page.image=distribute/images/advertising.jpg
@jd:body
<div class="figure">
<img src="{@docRoot}distribute/images/advertising.jpg" style="width:460px;">
</div>
-<p>
- Ads can be a quick and easy way to earn more from your <a href=
- "{@docRoot}distribute/monetize/freemium.html">freemium</a>, <a href=
- "{@docRoot}distribute/monetize/premium.html">premium</a>, and <a href=
- "{@docRoot}distribute/monetize/subscriptions.html">subscription</a> apps.
- AdMob and the Google Mobile Ads SDK let you add advertising to your apps with
- just a few lines of code.
-</p>
+<p>Ads are an effective and easy way to earn revenue from your apps. AdMob brings
+together best-in-class technology in a single ad platform for your app, so you
+can gain insights about your users, drive more in-app purchases, and maximize
+your ad revenue. You won’t need to rely on a combination of tools or use
+precious development resources to build your own solution.</p>
-<p>
- The question is: which model gets the best results for your app? Google's ad
- tools are made to help you figure out what combination works best for both
- your audience and your bottom line. </p>
-
-<p>Start by linking your AdMob and Google
- Analytics accounts to get better insights and more earning power: for
- instance, AdMob can promote in-app purchases to the people who buy them most
- often, while showing income-generating ads to those less likely to buy right
- now.
-</p>
-
-<p>
- Using <a href=
- "http://www.google.com/ads/admob/monetize.html#subid=us-en-et-dac">AdMob</a>
- and the <a href="{@docRoot}google/play-services/ads.html">Google Mobile Ads
- SDK</a> included in Google Play Services, you’re able to add advertising into
- your apps, with just a few lines of code.
-</p>
-
-<p>
- When including ads in your apps you should consider:
-</p>
+<p>Why choose AdMob?</p>
<ul>
- <li>
- <p>
- <strong>Placement within your apps</strong> — Well-placed ads make
- it more likely that users will click through and convert. Poorly-placed
- ads lead to lower click-through rates, and even poor ratings and users
- abandoning your apps. Our <a href=
- "{@docRoot}training/monetization/ads-and-ux.html">developer training</a>
- on using ads shows some of the best ways to place ads.
- </p>
- </li>
-
- <li>
- <p>
- <strong>Ad formats</strong> — Every app offers a different type of
- experience for users, so it’s important that your ad formats match that
- experience. While banner ads may work well for a flashlight utility app,
- an immersive gaming app may benefit more from a video interstitial.
- Mismatched ad formats can make users unhappy and leave money on the
- table.
- </p>
- </li>
-
- <li>
- <p>
- <strong>Maximizing your performance</strong> — Make sure you’re
- optimizing your advertising revenue by maximizing your CPMs and fill
- rate. Ad providers often cite their very high CPMs but don't mention low
- fill rates that can severely decrease your effective CPM. Be sure to look
- at both of these figures. Consider using a <a href=
- "https://support.google.com/admob/v2/answer/3063564?hl=en&ref_topic=3063091#subid=us-en-et-dac">
- mediation</a> solution if you’d like to use multiple ad providers in your
- apps. Look for solutions that offer yield management or <a href=
- "https://support.google.com/admob/v2/answer/3379794?hl=en&ref_topic=3379793#subid=us-en-et-dac">
- network optimization</a> features to serve the highest paying ad for each
- impression.
- </p>
- </li>
-
- <li>
- <p>
- <strong>Exercising control options</strong> — A variety of ads may
- show up within your app. It may make sense to <a href=
- "https://support.google.com/admob/v2/answer/3150235?hl=enl#subid=us-en-et-dac">
- block</a> certain of those advertisements from appearing, depending on
- your goals and the type of experience you want to provide. Some
- developers, for instance, don’t want ads for apps in their same category
- showing to their users, while others don’t mind at all.
- </p>
- </li>
-
- <li>
- <p>
- <strong>Cross promoting your other apps</strong> — Ads can do more
- than earn revenue. Consider running <a href=
- "https://support.google.com/admob/v2/answer/3210452?hl=en#subid=us-en-et-dac">
- house ads</a> within your apps to promote other apps in your portfolio.
- When you launch a new app, this kind of promotion is a free and easy way
- to attract new users quickly.
- </p>
- </li>
+ <li> Over 650,000 apps use AdMob
+ <li> $1 billion+ paid to developers in the last 2 years
+ <li> Fast, reliable payment in local currencies
+ <li> High CPMs and the best fill rates
+ <li> Industry-leading mediation platform
</ul>
-<p>
- Don't forget that paid channels like AdWords and YouTube can help you cast a
- wider net by reaching targeted audiences outside the app ecosystem. They're a
- great way to find new users at a price that you control. <a href=
- "https://support.google.com/adwords/answer/2549053">Learn more</a>.
-</p>
+<p><a href="http://www.google.com/ads/admob/#subid=us-en-et-dac">Sign-up for AdMob</a>
+today and start showing ads by integrating the <a
+href="https://developers.google.com/mobile-ads-sdk/download">Google Mobile Ads SDK</a>
+in your app with a few lines of code.</p>
-<p>
- To start monetizing with ads, sign up for AdMob and integrate the Google
- Mobile Ads SDK into your apps. If you also need to manage direct deals with
- advertisers, consider using DoubleClick for Publishers Small Business.
-</p>
+<h2 id="key_features">Key features</h2>
+
+<div style="display:inline-block">
+<h3 id="maximize_your_ad_revenue">Maximize your ad revenue</h3>
+
+<div class="col-4">
+ <h4 id="maximize_earnings">Maximize earnings</h4>
+ <p>Earn more with our industry-leading ad service, which includes <a href=
+ "https://support.google.com/admob/answer/3063564">free mediation</a> to
+ automatically improve your earnings, and access to all of Google’s advertiser
+ demand from AdMob, AdWords, and the DoubleClick Ad Exchange.</p>
+</div>
+
+<div class="col-4">
+ <h4 id="get_paid_fast">Get paid fast</h4>
+ <p>Get paid in local currencies quickly and reliably, with no wire fees charged by
+ AdMob.</p>
+</div>
+
+<div class="col-4">
+ <h4 id="easy_and_free">Easy and free</h4>
+ <p>The SDK can be installed quickly, and there are no standard fees for using the
+ platform.</p>
+</div>
+</div>
+
+<div style="display:inline-block">
+<h3 id="grow_your_business_with_a_trusted_partner">Grow your business with a trusted partner</h3>
+
+<div class="col-6">
+ <h4 id="powered_by_googles_ad_technology">Powered by Google’s ad technology</h4>
+ <p>For over a decade, Google has helped millions of developers grow their digital
+ businesses.</p>
+</div>
+
+<div class="col-6">
+<h4 id="auto_updates_on_google_play">Auto updates on Google Play</h4>
+<p>AdMob’s integration with Google Play services pushes automatic performance
+ improvements to Android apps without additional SDK changes.</p>
+</div>
+</div>
+
+<div style="display:inline-block">
+<h3 id="drive_more_in-app_purchases_and_downloads">Drive more in-app purchases and downloads</h3>
+
+<div class="col-6">
+<h4 id="sell_more_in-app_purchases">Sell more in-app purchases</h4>
+<p>Earn more revenue by intelligently promoting your in-app purchases to the users
+most likely to buy them.</p>
+</div>
+
+<div class="col-6">
+<h4 id="promote_your_apps_for_free">Promote your apps for free</h4>
+<p>Cross-sell your other apps (or your friend’s apps) to your existing users,
+using free AdMob <a href="https://support.google.com/admob/answer/3210452">house ads</a>.</p>
+</div>
+</div>
+
+<div style="display:inline-block">
+<h3 id="drive_more_in-app_purchases_and_downloads">Drive more in-app purchases and downloads</h3>
+
+<div class="col-6">
+<h4 id="analytics_for_apps">Analytics for apps</h4>
+<p>Analyze your app’s performance from within AdMob with Google Analytics.
+Discover where people are downloading your app, and the features they use the
+most in real time.</p>
+</div>
+
+<div class="col-6">
+<h4 id="flow_visualization_reports">Flow visualization reports</h4>
+<p>In Analytics, see how people are navigating through your app with graphical
+<a href="https://support.google.com/analytics/answer/2519986">flow reports</a>.
+View the path they take to making a purchase, and the point where they exit
+the app, plus much more.</p>
+</div>
+</div>
-<p>
- To start monetizing with ads sign up for <a href=
- "http://www.google.com/ads/admob/#subid=us-en-et-dac">AdMob</a> and integrate
- the <a href="https://developers.google.com/mobile-ads-sdk/download">Google
- Mobile Ads SDK</a> into your apps. If you also need to manage direct deals
- with advertisers, consider using <a href=
- "http://www.google.com/doubleclick/publishers/small-business/index.html#subid=us-en-et-dac">
- DoubleClick for Publishers Small Business</a>.
-</p>
+<h2 id=tips>Tips</h2>
-<div class="headerLine"><h2 id="related-resources">Related resources</h2></div>
+<ul>
+ <li> Place ads wisely, they shouldn't be too intrusive but still need to be clearly
+visible to attract clickthroughs.
+ <li> Use banner, interstitial, and other ad formats appropriately.
+ <li> Make use of targeting features to match ads with your users and your app.
+ <li> Remember that ads form part of your app and must match its age rating.
+ <li> Exercise control options sensibly, don't get carried away excluding potentially
+competing ads at the expense of revenue.
+</ul>
+
+
+<h2 id=related_resources>Related resources</h2>
<div class="resource-widget resource-flow-layout col-13"
- data-query="collection:distribute/monetize/advertising"
+ data-query="collection:distribute/monetize/admob"
data-sortOrder="-timestamp"
data-cardSizes="9x3"
data-maxResults="6"></div>
diff --git a/docs/html/distribute/monetize/monetize_toc.cs b/docs/html/distribute/monetize/monetize_toc.cs
index 8211689..aa1bdd6 100644
--- a/docs/html/distribute/monetize/monetize_toc.cs
+++ b/docs/html/distribute/monetize/monetize_toc.cs
@@ -24,7 +24,7 @@
</li>
<li class="nav-section">
<div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/monetize/ads.html">
- <span class="en">Ads</span>
+ <span class="en">AdMob Ads</span>
</a>
</div>
</li>
diff --git a/docs/html/distribute/users/appindexing.jd b/docs/html/distribute/users/appindexing.jd
new file mode 100644
index 0000000..6a3fec6
--- /dev/null
+++ b/docs/html/distribute/users/appindexing.jd
@@ -0,0 +1,46 @@
+page.title=Drive installs from Google Search
+page.metaDescription=Surface the content of your apps in Google Search and link it to app installs.
+meta.tags="getusers", "search", "appindexing"
+page.image=images/cards/google-search_2x.png
+@jd:body
+
+<p>Google Search now helps users discover your app, with App Indexing. When users
+search with Google on their Android device the results will include details of
+relevant, indexed apps. The search results will include an install button that
+takes users to your app in the Google Play store. And when your app is
+installed, the user will be taken straight to the right content within it.</p>
+
+<div class="figure-left">
+<img src="{@docRoot}images/distribute/appindexing.gif">
+</div>
+
+<p>This free service expands your opportunities to turn the investment you’ve made
+in creating an outstanding app or game into installs. </p>
+
+<p>Start now by adding deep linking support to your app, verifying your app’s
+official website, and defining deep links. To learn how, check out these <a
+href="https://developers.google.com/app-indexing/webmasters/details">instructions</a>. </p>
+
+<p>Once your app is index, links to its content will join the 30 billion app index
+links already available to Google Search.</p>
+
+<h2 id=tips>Tips</h2>
+
+<ul>
+ <li> App Indexing will also be used as a ranking signal for all users on Android,
+regardless of whether they have your app installed or not.
+ <li> App Indexing also helps drive use of your app — when your app is installed on a
+user’s device, search results will include deep links to your app that bring
+the user straight to the relevant app content.
+ <li> Use the App Indexing API to help users discover relevant content in your app
+before they complete a query with auto-completions.
+</ul>
+
+<h2 id=related_resources>Related resources</h2>
+
+<div class="resource-widget resource-flow-layout col-13"
+ data-query="collection:distribute/users/appindexing"
+ data-sortOrder="-timestamp"
+ data-cardSizes="9x3"
+ data-maxResults="6"></div>
+
diff --git a/docs/html/distribute/users/promote-with-ads.jd b/docs/html/distribute/users/promote-with-ads.jd
index c1d79fc..d71b8c9 100644
--- a/docs/html/distribute/users/promote-with-ads.jd
+++ b/docs/html/distribute/users/promote-with-ads.jd
@@ -1,42 +1,125 @@
page.title=Promote Your App with Ads
-page.metaDescription=Promote your app through AdMob, AdWords, and YouTube to find new users at the right moment.
+page.metaDescription=Promote your app with AdWords to find new users at the right moment.
page.image=images/cards/adwords_2x.jpg
-page.tags="users, ads, analytics"
-
+page.tags="users, ads, adwords"
@jd:body
-<p>
- AdMob is Google's advertising platform for mobile apps. You can use it to
- monetize your app and promote your apps, and you can link your Google
- Analytics account to AdMob so you can analyze your apps — all in one
- place.
-</p>
+<p>Users have a huge amount of choice when it comes to which apps they install and
+use, so it’s important to actively find new ways to promote your app and drive
+ongoing engagement. AdWords is a powerful and effective way to do both.</p>
-<p>
- <a href="http://www.google.com/ads/admob/">AdMob</a> is the largest mobile ad
- app network. But you get more than just massive scale: AdMob will soon help
- you find the right users in related apps. If your app is for bicycling, AdMob
- can promote your app on other fitness and cycling-related apps worldwide.
- <a href=
- "https://apps.admob.com/admob/signup?subid=us-en-et-dac&_adc=ww-ww-et-admob2&hl=en">
- Sign up for AdMob</a>.
-</p>
-<p>
- AdMob also offers new solutions to help you achieve app-related goals such as
- downloads, re-engagement and in-app purchases using Google search and the
- Google Display Network. These solutions include streamlined campaign creation
- flows and tools to track performance across the entire app lifecycle.
- <a href="https://support.google.com/adwords/answer/2549053?hl=en">Learn
- More</a>.
-</p>
-<div style="margin-top:2em;">
- <img src="{@docRoot}images/gp-ads-console.jpg">
+<h2 id=drive_installs>Drive installs</h2>
+
+<p><a href="http://adwords.google.com">AdWords</a> promotes your app to interested users where they spend time on phones and
+tablets – with app install ads on Google Search, YouTube, Gmail, and within
+apps and across the web on the Google Display Network. AdWords is a powerful
+way to scale app promotion across Google networks and find customers that are
+most likely to install your app. </p>
+
+<p><a href="https://support.google.com/adwords/answer/6032059">Get started with AdWords app install ads</a>.</p>
+
+<div style="display:inline-block">
+ <div class="figure-left" style="width:40%;">
+ <h3>From Google Play</h3>
+ <img src="/images/distribute/promote_ads_play.png">
+ <p class="figure-caption">Search ads on Google Play are still undergoing testing and not yet available to
+buy. <a href="http://android-developers.blogspot.com/2015/02/a-new-way-to-promote-your-app-on-google.html">Find out more</a>.</p>
+ </div>
+ <div class="figure-right" style="width:40%;">
+ <h3>From apps</h3>
+ <img src="/images/distribute/promote_ads_search.png">
+ <p class="figure-caption">Connect with users as they search for content and services provided by your
+app.</p>
+ </div>
</div>
-<div class="headerLine">
+<div style="display:inline-block">
+ <div class="figure-left" style="width:40%;">
+ <h3>From YouTube</h3>
+ <img src="/images/distribute/promote_ads_youtube.png">
+ <p class="figure-caption">Promote your app when users are watching related videos.</p>
+ </div>
+ <div class="figure-right" style="width:40%;">
+ <h3>From apps</h3>
+ <img src="/images/distribute/promote_ads_apps.png">
+ <p class="figure-caption">Reach users while they’re engaged with apps and games across the AdMob network.</p>
+ </div>
+</div>
+
+<div style="display:inline-block">
+ <div class="figure-left" style="width:40%;">
+ <h3>From the web</h3>
+ <img src="/images/distribute/promote_ads_web.png">
+ <p class="figure-caption">Reach users while they’re engaged with websites across the Google Display Network.</p>
+ </div>
+ <div class="figure-right" style="width:40%;">
+ <h3>From Gmail</h3>
+ <img src="/images/distribute/promote_ads_gmail.png">
+ <p class="figure-caption">Promote your app while users communicate and get things done in Gmail.</p>
+ </div>
+</div>
+
+<h3>Tips</h3>
+
+<ul>
+ <li> Estimate how much an app user is worth to your business, so that you can work
+out an appropriate cost-per-install that you’re willing to pay.
+ <li> Ensure that your ads and Play Store listing are compelling and clearly describe
+your app’s value.
+ <li> Check that you’re accurately tracking and attributing installs by installing
+the AdWords <a href="https://developers.google.com/app-conversion-tracking/">conversion tracking SDK</a>.
+ <li> Promote your app broadly across display, search, and video to reach even more
+potential users and drive a higher volume of installs.
+ <li> Start with broader targeting and then fine tune your bidding once you’ve
+assessed your campaign results.
+ <li> Use Conversion Optimizer to automate your bidding so that your ads target users
+who are most likely to install your app.
+ <li> Use Conversion Optimizer for in-app buyers to automate your bidding so that
+your ads target high value users who are most likely to make purchases in your
+app.
+</ul>
+
+
+<h2 id=engage_with_users>Engage with users</h2>
+
+<p>Getting a user to install an app is one thing, but you'll also want them to
+open it regularly. AdWords offers app re-engagement tools to help your app stay
+in mind with users who’ve already installed it on their phone. AdWords can
+remind them of key features and encourage them to try your app again, or help
+them complete an activity they didn't know your app could handle.</p>
+
+<div>
+ <div class="figure-left" style="width:46%;">
+ <h3>From search</h3>
+ <img src="/images/distribute/promote_ads.png">
+ <p class="figure-caption">Add deep links to your app, then bring users straight
+ to relevant app content when they’re searching.</p>
+ </div>
+ <div class="figure-right" style="width:46%;">
+ <h3>From apps</h3>
+ <img src="/images/distribute/promote_ads_inapp.png">
+ <p class="figure-caption">Use remarketing and deep links to bring users to just the right
+ place in your app to re-engage and convert, from other apps and games they love.</p>
+ </div>
+</div>
+
+<h3>Tips</h3>
+
+<ul>
+ <li> Track what users do in your app after they’ve clicked an ad, by installing the
+AdWords <a href="https://developers.google.com/app-conversion-tracking/">conversion tracking SDK</a>.
+ <li> Advertise a compelling reason for users to re-engage with your app (such as a
+reminder or a special offer).
+ <li> <a href="https://developers.google.com/app-indexing/webmasters/app">Add deep links</a> to your app that’ll take users directly to the parts of your app that will be
+most relevant and interesting to them, where they can easily take action.
+ <li> Re-engage your app users across the display network with remarketing lists and
+search with keywords.
+ <li> Use remarketing lists to target high value users so that you can drive more
+conversions in your app.
+</ul>
+
<h2 id="related-resources">Related Resources</h2>
-</div>
<div class="resource-widget resource-flow-layout col-13"
data-query="collection:distribute/users/promotewithads"
diff --git a/docs/html/distribute/users/users_toc.cs b/docs/html/distribute/users/users_toc.cs
index edfa874..2e796c8 100644
--- a/docs/html/distribute/users/users_toc.cs
+++ b/docs/html/distribute/users/users_toc.cs
@@ -11,18 +11,6 @@
</div>
</li>
<li class="nav-section">
- <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/build-buzz.html">
- <span class="en">Build Buzz</span>
- </a>
- </div>
- </li>
- <li class="nav-section">
- <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/build-community.html">
- <span class="en">Build Community</span>
- </a>
- </div>
- </li>
- <li class="nav-section">
<div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/expand-to-new-markets.html">
<span class="en">Expand to New Markets</span>
</a>
@@ -34,6 +22,24 @@
</a>
</div>
</li>
+ <li class="nav-section">
+ <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/appindexing.html">
+ <span class="en">Drive Installs through Search</span>
+ </a>
+ </div>
+ </li>
+ <li class="nav-section">
+ <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/build-buzz.html">
+ <span class="en">Build Buzz</span>
+ </a>
+ </div>
+ </li>
+ <li class="nav-section">
+ <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/build-community.html">
+ <span class="en">Build Community</span>
+ </a>
+ </div>
+ </li>
</ul>
diff --git a/docs/html/images/distribute/appindexing.gif b/docs/html/images/distribute/appindexing.gif
new file mode 100644
index 0000000..6015d14
--- /dev/null
+++ b/docs/html/images/distribute/appindexing.gif
Binary files differ
diff --git a/docs/html/images/distribute/engage-intents.png b/docs/html/images/distribute/engage-intents.png
new file mode 100644
index 0000000..2889c08
--- /dev/null
+++ b/docs/html/images/distribute/engage-intents.png
Binary files differ
diff --git a/docs/html/images/distribute/more-app-engagement.png b/docs/html/images/distribute/more-app-engagement.png
new file mode 100644
index 0000000..31cbede
--- /dev/null
+++ b/docs/html/images/distribute/more-app-engagement.png
Binary files differ
diff --git a/docs/html/images/distribute/music-action.png b/docs/html/images/distribute/music-action.png
new file mode 100644
index 0000000..24d6dc8
--- /dev/null
+++ b/docs/html/images/distribute/music-action.png
Binary files differ
diff --git a/docs/html/images/distribute/promote-ads-apps.png b/docs/html/images/distribute/promote-ads-apps.png
new file mode 100644
index 0000000..9009a37
--- /dev/null
+++ b/docs/html/images/distribute/promote-ads-apps.png
Binary files differ
diff --git a/docs/html/images/distribute/promote-ads-web.png b/docs/html/images/distribute/promote-ads-web.png
new file mode 100644
index 0000000..2f9630e
--- /dev/null
+++ b/docs/html/images/distribute/promote-ads-web.png
Binary files differ
diff --git a/docs/html/images/distribute/promote_ads.png b/docs/html/images/distribute/promote_ads.png
new file mode 100644
index 0000000..38517aa
--- /dev/null
+++ b/docs/html/images/distribute/promote_ads.png
Binary files differ
diff --git a/docs/html/images/distribute/promote_ads_apps.png b/docs/html/images/distribute/promote_ads_apps.png
new file mode 100644
index 0000000..2f57865
--- /dev/null
+++ b/docs/html/images/distribute/promote_ads_apps.png
Binary files differ
diff --git a/docs/html/images/distribute/promote_ads_gmail.png b/docs/html/images/distribute/promote_ads_gmail.png
new file mode 100644
index 0000000..1d21b4a
--- /dev/null
+++ b/docs/html/images/distribute/promote_ads_gmail.png
Binary files differ
diff --git a/docs/html/images/distribute/promote_ads_inapp.png b/docs/html/images/distribute/promote_ads_inapp.png
new file mode 100644
index 0000000..8aeee57
--- /dev/null
+++ b/docs/html/images/distribute/promote_ads_inapp.png
Binary files differ
diff --git a/docs/html/images/distribute/promote_ads_play.png b/docs/html/images/distribute/promote_ads_play.png
new file mode 100644
index 0000000..1cf51b2
--- /dev/null
+++ b/docs/html/images/distribute/promote_ads_play.png
Binary files differ
diff --git a/docs/html/images/distribute/promote_ads_search.png b/docs/html/images/distribute/promote_ads_search.png
new file mode 100644
index 0000000..27c0b38
--- /dev/null
+++ b/docs/html/images/distribute/promote_ads_search.png
Binary files differ
diff --git a/docs/html/images/distribute/promote_ads_web.png b/docs/html/images/distribute/promote_ads_web.png
new file mode 100644
index 0000000..588a3d4
--- /dev/null
+++ b/docs/html/images/distribute/promote_ads_web.png
Binary files differ
diff --git a/docs/html/images/distribute/promote_ads_youtube.png b/docs/html/images/distribute/promote_ads_youtube.png
new file mode 100644
index 0000000..e88a796
--- /dev/null
+++ b/docs/html/images/distribute/promote_ads_youtube.png
Binary files differ
diff --git a/docs/html/index.jd b/docs/html/index.jd
index cfbe7b6..ffc6769 100644
--- a/docs/html/index.jd
+++ b/docs/html/index.jd
@@ -10,7 +10,10 @@
</div>
<div class="actions-bar dac-expand dac-invert">
- <div class="wrap">
+ <div class="wrap dac-offset-parent">
+ <a class="dac-fab dac-scroll-button" data-scroll-button href="#build-apps">
+ <i class="dac-sprite dac-arrow-down-gray"></i>
+ </a>
<div class="actions">
<div><a href="{@docRoot}sdk/index.html">
<span class="dac-sprite dac-auto-chevron-large"></span>
@@ -32,7 +35,7 @@
</div><!-- end .wrap -->
</div><!-- end .actions-bar -->
-<section class="dac-section dac-section-light"><div class="wrap">
+<section class="dac-section dac-section-light" id="build-apps"><div class="wrap">
<h1 class="dac-section-title">Build Beautiful Apps</h1>
<div class="dac-section-subtitle">
See what’s new or find the resources to get you started with designing and developing for Android.
diff --git a/docs/html/jd_collections.js b/docs/html/jd_collections.js
index 834eac1..c89b310 100644
--- a/docs/html/jd_collections.js
+++ b/docs/html/jd_collections.js
@@ -104,15 +104,18 @@
"resources": [
"https://www.youtube.com/watch?v=AK38PJZmIW8&list=PLWz5rJ2EKKc-kIrPiq098QH9dOle-fLef",
"https://www.youtube.com/watch?v=6K_jxccHv5M&index=1&list=PLOU2XLYxmsILFBfx66ens76VMLMEPJAB0",
- "https://www.youtube.com/watch?v=KNKGM4ss5Sc&index=4&list=PLWz5rJ2EKKc9BdE_PSLNIGjXXr3h_orXM"
+ "https://www.youtube.com/watch?v=ctiaVxgclsg&list=PLWz5rJ2EKKc9BdE_PSLNIGjXXr3h_orXM"
]
},
"develop/landing/tools": {
"title": "",
"resources": [
- "https://www.youtube.com/watch?v=K2dodTXARqc&list=PLWz5rJ2EKKc8I9gHTMh5yKkwRRGE8BjbQ&index=1",
- "https://www.youtube.com/watch?v=3PIc-DuEU2s&index=1&list=PLWz5rJ2EKKc9e0d55YHgJFHXNZbGHEXJX",
- "https://www.youtube.com/watch?v=FOn64iqlphk&index=1&list=PLWz5rJ2EKKc9Qk1_iCZNbBp6adYnJf9Vf"
+ "https://www.youtube.com/watch?v=K2dodTXARqc&list=PLWz5rJ2EKKc8I9gHTMh5yKkwRRGE8BjbQ",
+ "https://www.youtube.com/watch?v=3PIc-DuEU2s&list=PLWz5rJ2EKKc9e0d55YHgJFHXNZbGHEXJX",
+ "https://www.youtube.com/watch?v=cD7NPxuuXYY&list=PLWz5rJ2EKKc8I9gHTMh5yKkwRRGE8BjbQ",
+ "https://www.youtube.com/watch?v=JLLnhwtDoHw&list=PLWz5rJ2EKKc8I9gHTMh5yKkwRRGE8BjbQ",
+ "https://www.youtube.com/watch?v=2I6fuD20qlY&list=PLWz5rJ2EKKc8I9gHTMh5yKkwRRGE8BjbQ",
+ "https://www.youtube.com/watch?v=5Be2mJzP-Uw&list=PLWz5rJ2EKKc9e0d55YHgJFHXNZbGHEXJX"
]
},
"develop/landing/courses": {
@@ -123,6 +126,14 @@
"https://www.udacity.com/course/android-performance--ud825"
]
},
+ "preview/landing/herolinks": {
+ "title": "",
+ "resources": [
+ "https://www.udacity.com/course/ux-design-for-mobile-developers--ud849",
+ "https://www.udacity.com/course/developing-android-apps--ud853",
+ "https://www.udacity.com/course/android-performance--ud825"
+ ]
+ },
"distribute/landing/carousel": {
"title": "",
"resources": [
@@ -143,12 +154,12 @@
"distribute/landing/more": {
"title": "",
"resources": [
- "distribute/users/promote-with-ads.html",
- "distribute/monetize/ads.html",
- "distribute/analyze/index.html",
- "distribute/engage/deep-linking.html",
- "distribute/engage/easy-signin.html",
- "https://cloud.google.com/docs/"
+ "distribute/users/promote-with-ads.html",
+ "distribute/monetize/ads.html",
+ "distribute/analyze/index.html",
+ "distribute/engage/deep-linking.html",
+ "distribute/engage/easy-signin.html",
+ "https://cloud.google.com/docs/"
]
},
"distribute/edu/videos/stories": {
@@ -271,10 +282,11 @@
"resources": [
"distribute/users/know-your-user.html",
"distribute/users/your-listing.html",
- "distribute/users/build-buzz.html",
- "distribute/users/build-community.html",
"distribute/users/expand-to-new-markets.html",
- "distribute/users/promote-with-ads.html"
+ "distribute/users/promote-with-ads.html",
+ "distribute/users/appindexing.html",
+ "distribute/users/build-buzz.html",
+ "distribute/users/build-community.html"
]
},
"distribute/engagelanding": {
@@ -284,8 +296,11 @@
"distribute/engage/gcm.html",
"distribute/engage/easy-signin.html",
"distribute/engage/deep-linking.html",
- "distribute/engage/game-services.html",
+ "distribute/engage/ads.html",
+ "distribute/engage/appindexing.html",
+ "distribute/engage/intents.html",
"distribute/engage/analytics.html",
+ "distribute/engage/game-services.html",
"distribute/engage/app-updates.html",
"distribute/engage/community.html",
"distribute/engage/video.html"
@@ -541,8 +556,10 @@
"distribute/users/promotewithads": {
"title": "",
"resources": [
- "http://www.google.com/ads/admob/#subid=us-en-et-dac",
- "distribute/essentials/optimizing-your-app.html"
+ "https://support.google.com/adwords/answer/6032059",
+ "https://support.google.com/adwords/answer/6032073",
+ "https://support.google.com/adwords/answer/6167164",
+ "https://support.google.com/adwords/answer/6167162"
]
},
"distribute/users/buildbuzz": {
@@ -574,6 +591,14 @@
"http://www.youtube.com/yt/dev/"
]
},
+ "distribute/users/appindexing": {
+ "title": "",
+ "resources": [
+ "https://developers.google.com/app-indexing/",
+ "https://developers.google.com/app-indexing/webmasters/details",
+ "distribute/engage/search.html"
+ ]
+ },
"distribute/toolsreference/bestpractices/apps": {
"title": "",
"resources": [
@@ -797,6 +822,31 @@
"guide/topics/appwidgets/index.html"
]
},
+ "distribute/engage/reengage": {
+ "title": "",
+ "resources": [
+ "https://support.google.com/adwords/answer/6032073",
+ "distribute/engage/deep-linking.html",
+ "https://support.google.com/adwords/answer/6167162",
+ "distribute/users/promote-with-ads.html"
+ ]
+ },
+ "distribute/engage/appindexing": {
+ "title": "",
+ "resources": [
+ "distribute/engage/intents.html",
+ "distribute/engage/appindexing.html",
+ "distribute/users/appindexing.html"
+ ]
+ },
+ "distribute/engage/intents": {
+ "title": "",
+ "resources": [
+ "guide/components/intents-filters.html",
+ "distribute/engage/appindexing.html",
+ "distribute/engage/ads.html"
+ ]
+ },
"distribute/getusers/expandnewmarkets": {
"title": "",
"resources": [
@@ -1223,6 +1273,17 @@
"training/monetization/ads-and-ux.html"
]
},
+ "distribute/monetize/admob": {
+ "title": "",
+ "resources": [
+ "https://support.google.com/admob/topic/2784623",
+ "https://developers.google.com/mobile-ads-sdk/download",
+ "http://analyticsacademy.withgoogle.com/mobile-app",
+ "http://support.google.com/googleplay/android-developer/topic/2985714",
+ "https://support.google.com/admob/answer/2753860",
+ "https://support.google.com/admob/"
+ ]
+ },
"distribute/monetize/paymentmethods": {
"title": "",
"resources": [
@@ -1233,9 +1294,12 @@
"preview/landing/resources": {
"title": "",
"resources": [
+ "preview/overview.html",
"preview/api-overview.html",
"preview/setup-sdk.html",
- "preview/samples.html"
+ "preview/samples.html",
+ "preview/reference.html",
+ "preview/support.html"
]
},
"autolanding": {
diff --git a/docs/html/jd_extras.js b/docs/html/jd_extras.js
index cc11da5..150a9d4 100644
--- a/docs/html/jd_extras.js
+++ b/docs/html/jd_extras.js
@@ -14,6 +14,8 @@
ALL_RESOURCES_BY_URL. */
DISTRIBUTE_RESOURCES = DISTRIBUTE_RESOURCES.concat([
+ /* TODO Remove standard resources from here, such as below
+ */
{
"title":"Quizlet Developer Story",
"titleFriendly":"",
@@ -174,7 +176,7 @@
"title":"Introduction to Android Studio",
"titleFriendly":"",
"summary":"Learn why you should migrate your projects to Android Studio now and how it can help you be more productive as a developer. Rich layout editor, handy suggestions and fixes, new Android project view - these are just some of the things you can expect from the IDE, which is built on the successful IntelliJ IDEA.",
- "url":"https://www.youtube.com/watch?v=K2dodTXARqc&list=PLWz5rJ2EKKc8I9gHTMh5yKkwRRGE8BjbQ&index=1",
+ "url":"https://www.youtube.com/watch?v=K2dodTXARqc&list=PLWz5rJ2EKKc8I9gHTMh5yKkwRRGE8BjbQ",
"group":"",
"keywords": ["studio", "tools"],
"tags": [
@@ -186,7 +188,7 @@
"title":"Google Play Services 7.3",
"titleFriendly":"",
"summary":"Google Play Services 7.3 brings a ton of great new features to help you BUILD BETTER APPS! This update brings the ability to connect multiple wearables simultaneously to a single phone.",
- "url":"https://www.youtube.com/watch?v=FOn64iqlphk&index=1&list=PLWz5rJ2EKKc9Qk1_iCZNbBp6adYnJf9Vf",
+ "url":"https://www.youtube.com/watch?v=FOn64iqlphk&list=PLWz5rJ2EKKc9Qk1_iCZNbBp6adYnJf9Vf",
"group":"",
"keywords": ["google play services"],
"tags": [
@@ -219,10 +221,10 @@
"type":"video"
},
{
- "title":"Under the Hood of Android Auto",
+ "title":"Introduction to Android Auto",
"titleFriendly":"",
- "summary":"Your car contains some serious technology. Learn about the Android Auto architecture, which enables you to control Android apps and services running on your phone through your car. ",
- "url":"https://www.youtube.com/watch?v=KNKGM4ss5Sc&index=4&list=PLWz5rJ2EKKc9BdE_PSLNIGjXXr3h_orXM",
+ "summary":"Android Auto brings the Android platform to the car in a way that's optimized for the driving experience. It's the same platform you already use for phones, tablets, televisions, wearables, and more. ",
+ "url":"https://www.youtube.com/watch?v=ctiaVxgclsg&list=PLWz5rJ2EKKc9BdE_PSLNIGjXXr3h_orXM",
"group":"",
"keywords": ["auto"],
"tags": [
@@ -1122,7 +1124,7 @@
],
"url": "http://www.google.com/analytics/mobile/",
"timestamp": 1383243492000,
- "image": "http://www.google.com//analytics/images/heros/mobile-index.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Google Mobile App Analytics",
"summary": "Mobile App Analytics measures what matters most at all key stages: from first discovery and download to in-app purchases. ",
"keywords": ["analytics,user behavior"],
@@ -1137,9 +1139,9 @@
],
"url": "https://developers.google.com/app-indexing/",
"timestamp": 1383243492000,
- "image": "https://developers.google.com/app-indexing/images/allthecooks_srp.png",
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/search_64dp.png",
"title": "Sign Up for App Indexing",
- "summary": "Google is working with app developers and webmasters to index the content of apps and relate them to websites. When relevant, Google Search results on Android will include deep links to apps.",
+ "summary": "Surface your app content in Google seaerch. Deep link direct to your apps.",
"keywords": [],
"type": "guide",
"titleFriendly": ""
@@ -1169,7 +1171,7 @@
"url": "https://developers.google.com/+/mobile/android/people",
"timestamp": 1383243492000,
"image": "images/google/gps-googleplus.png",
- "title": "Sign Up for App Indexing",
+ "title": "Google Sign In",
"summary": "After you let users sign in with Google, you can access their age range, language, public profile information, and people that they have circled.",
"keywords": ["googleplus"],
"type": "guide",
@@ -1448,20 +1450,6 @@
"lang": "en",
"group": "",
"tags": ["monetize", "ads"],
- "url": "http://www.google.com/ads/admob/#subid=us-en-et-dac",
- "timestamp": null,
- "image": "distribute/images/advertising.png",
- "title": "AdMob",
- "summary": "Make money by connecting with over a million Google advertisers all over the world, so your revenue scales with your app.",
- "keywords": ["ads"],
- "type": "distribute",
- "titleFriendly": ""
- },
-
- {
- "lang": "en",
- "group": "",
- "tags": ["monetize", "ads"],
"url": "http://www.google.com/doubleclick/publishers/small-business/index.html",
"timestamp": null,
"image": "http://www.google.com/doubleclick/publishers/small-business/images/define_ad.png",
@@ -1478,6 +1466,7 @@
"url": "http://support.google.com/googleplay/android-developer/topic/2985714",
"timestamp": null,
"image": "http://storage.googleapis.com/support-kms-prod/SNP_712EA2784949DDF085C46E3BE7B1DC618A09_4389397_en_v0",
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/play_64dp.png",
"title": "Policy Center: Ads",
"summary": "Introduction to ads and system interference policies in Google Play",
"keywords": ["ads"],
@@ -1815,7 +1804,7 @@
"tags": [],
"url": "https://developers.google.com/analytics/solutions/mobile-implementation-guide",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Mobile Analytics Implementation Guide",
"summary": "Learn how you can implement additional Google Analytics features to better understand your users and their behavior.",
"keywords": ["analytics", "Play", "users"],
@@ -1841,7 +1830,7 @@
"tags": [],
"url": "https://analyticsacademy.withgoogle.com/course04",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Mobile App Analytics Fundamentals",
"summary": "This self-paced online course on mobile app measurement shows you how Google Analytics data can help you make your app more discoverable and profitable.",
"keywords": ["analytics"],
@@ -1854,7 +1843,7 @@
"tags": [],
"url": "https://github.com/googleanalytics/google-analytics-plugin-for-unity",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Analytics Plugin for Unity",
"summary": "If you're building games with Unity, you can now implement Analytics once and ship it on multiple platforms automatically.",
"keywords": ["analytics", "unity"],
@@ -1867,7 +1856,7 @@
"tags": [],
"url": "https://developers.google.com/analytics/devguides/collection/android/v4/enhanced-ecommerce",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "In-App Purchases & Ecommerce",
"summary": "If your app sells virtual or real goods, ecommerce tracking can help you understand what behaviors lead to purchases.",
"keywords": ["analytics, ecommerce"],
@@ -1880,7 +1869,7 @@
"tags": [],
"url": "https://support.google.com/analytics/answer/1032415",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Goals",
"summary": "Track important actions in your app as goals and measure performance against your objectives.",
"keywords": ["analytics"],
@@ -1893,7 +1882,7 @@
"tags": [],
"url": "https://support.google.com/analytics/answer/2568874?ref_topic=6012392",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Active Users",
"summary": "The active user report displays your 1-day, 7-day, 14-day and 30-day trailing active users next to each other, to help you analyze performance over time.",
"keywords": ["analytics"],
@@ -1906,7 +1895,7 @@
"tags": [],
"url": "https://developers.google.com/analytics/devguides/collection/android/v4/events",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Events",
"summary": "Events let you measure granular in-app activities and understand user journeys.",
"keywords": ["analytics"],
@@ -1919,7 +1908,7 @@
"tags": [],
"url": "https://developers.google.com/analytics/devguides/collection/android/v4/customdimsmets",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Custom Dimensions",
"summary": "Custom dimensions enable the association of metadata with hits, users, and sessions in Google Analytics.",
"keywords": ["analytics"],
@@ -1932,7 +1921,7 @@
"tags": [],
"url": "https://developers.google.com/analytics/devguides/collection/android/v4/user-id",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "User ID",
"summary": "The User ID feature enables Google Analytics to measure user activities that span across devices.",
"keywords": ["analytics"],
@@ -1945,7 +1934,7 @@
"tags": [],
"url": "https://developers.google.com/analytics/devguides/collection/android/v4/display-features",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Demographic Reporting",
"summary": "By enabling display features, you can see just how different user segments engage and monetize.",
"keywords": ["analytics"],
@@ -1958,7 +1947,7 @@
"tags": [],
"url": "https://support.google.com/analytics/answer/3123906",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "User Segmentation",
"summary": "Segments let you compare metrics for different subsets of users to identify trends and opportunities for your apps.",
"keywords": ["analytics"],
@@ -1971,7 +1960,7 @@
"tags": [],
"url": "https://developers.google.com/analytics/devguides/collection/android/v4/campaigns",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Campaign Tracking",
"summary": "Measuring campaigns in Google Analytics enables the attribution of campaigns and traffic sources to user activity within your app.",
"keywords": ["analytics"],
@@ -1997,7 +1986,7 @@
"tags": [],
"url": "https://support.google.com/analytics/answer/1033961",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "AdWords Integration",
"summary": "Link Analytics and AdWords to see the entire picture of customer behavior, from ad click or impression through your site to conversion. ",
"keywords": ["adwords, analytics"],
@@ -2010,7 +1999,7 @@
"tags": [],
"url": "https://developers.google.com/analytics/devguides/collection/android/v4/campaigns#google-play-url-builder",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Campaign URL builder for Google Play",
"summary": "Easily create your URLs to track install campaigns.",
"keywords": ["play, analytics"],
@@ -2036,7 +2025,7 @@
"tags": [],
"url": "https://support.google.com/analytics/answer/2785577",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Behavior Flow",
"summary": "The Behavior Flow report visualizes the path users traveled from one Screen or Event to the next. This report can help you discover what content keeps users engaged with your app.",
"keywords": ["analytics"],
@@ -2049,7 +2038,7 @@
"tags": [],
"url": "https://support.google.com/analytics/answer/1151300",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Custom Reports",
"summary": "Custom Reports let you create your own reports in your Google Analytics account.",
"keywords": ["analytics"],
@@ -2062,7 +2051,7 @@
"tags": [],
"url": "https://support.google.com/analytics/answer/2611268",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Audience Lists & Remarketing",
"summary": "Remarketing with Google Analytics lets you deliver targeted ads to users who've already been to your site or app. You can even base those ads on the behavior those users displayed during their sessions.",
"keywords": ["analytics"],
@@ -2075,7 +2064,7 @@
"tags": [],
"url": "https://support.google.com/admob/answer/3508177",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "AdMob Integration",
"summary": "With Google Analytics in AdMob, you can view Google Analytics data for your linked apps from within your AdMob account.",
"keywords": ["analytics"],
@@ -2088,7 +2077,7 @@
"tags": [],
"url": "https://developers.google.com/analytics/solutions/mobile-campaign-deep-link",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Deep-Linking",
"summary": "Google Analytics gives you a full view of how returning users are interacting with your app, for a holistic view beyond the install.",
"keywords": ["analytics"],
@@ -2101,7 +2090,7 @@
"tags": [],
"url": "https://support.google.com/admob/answer/3508177",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "AdMob Integration",
"summary": "With Google Analytics in AdMob, you can view Google Analytics data for your linked apps from within your AdMob account.",
"keywords": ["analytics"],
@@ -2114,7 +2103,7 @@
"tags": [],
"url": "https://support.google.com/analytics/answer/2568874",
"timestamp": null,
- "image": "distribute/images/gp-analytics-logo.jpg",
+ "image": "images/cards/analytics-mobile_2x.jpg",
"title": "Active User Report",
"summary": "Active user report displays your 1-day, 7-day, 14-day and 30-day trailing active users next to each other, to help you run benchmark analyses of their performance over time.",
"keywords": ["analytics"],
@@ -2251,7 +2240,7 @@
"type": "materialdesign",
"titleFriendly": ""
},
- {
+ {
"lang": "en",
"group": "",
"tags": [
@@ -2268,6 +2257,187 @@
"type": "material design",
"titleFriendly": ""
},
+
+ {
+ "lang": "en",
+ "group": "",
+ "tags": [],
+ "url": "https://support.google.com/adwords/answer/6032059",
+ "timestamp": null,
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/admob_64dp.png",
+ "title": "Setting up Mobile App Install Ads",
+ "summary": "With Mobile app installs campaigns on the Search and Display Networks, and TrueView for mobile app promotion on YouTube, you can create custom app install ads that run exclusively on phones and tablets.",
+ "keywords": ["marketing", "admob"],
+ "type": "distribute",
+ "titleFriendly": ""
+ },
+ {
+ "lang": "en",
+ "group": "",
+ "tags": [],
+ "url": "https://support.google.com/adwords/answer/6167164",
+ "timestamp": null,
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/admob_64dp.png",
+ "title": "Best practices for Mobile App Engagement",
+ "summary": "Learn how to market to your user base to drive re-engagement with your app. ",
+ "keywords": ["marketing", "admob"],
+ "type": "distribute",
+ "titleFriendly": ""
+ },
+ {
+ "lang": "en",
+ "group": "",
+ "tags": [
+ "marketing",
+ "engagement",
+ "adwords1"
+ ],
+ "url": "https://support.google.com/adwords/answer/6032073",
+ "timestamp": null,
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/adwords_64dp.png",
+ "title": "Setting up Mobile App Engagement Ads",
+ "summary": "Mobile app engagement campaigns are a great choice for advertisers focused on connecting with people who already have their app.",
+ "keywords": [
+ "marketing",
+ "engagement",
+ "adwords"
+ ],
+ "type": "distribute",
+ "titleFriendly": ""
+ },
+ {
+ "lang": "en",
+ "group": "",
+ "tags": [
+ "marketing",
+ "engagement"
+ ],
+ "url": "https://support.google.com/adwords/answer/6167162",
+ "timestamp": null,
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/adwords_64dp.png",
+ "title": "Best Practices for Mobile App Installs",
+ "summary": "Getting your mobile app discovered can be challenging. Learn how to drive downloads of your app and grow a valuable user base.",
+ "keywords": ["marketing", "adwords"],
+ "type": "distribute",
+ "titleFriendly": ""
+ },
+
+
+
+
+
+
+
+
+ {
+ "lang": "en",
+ "group": "",
+ "tags": [],
+ "url": "https://support.google.com/admob/topic/2784623",
+ "timestamp": null,
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/admob_64dp.png",
+ "title": "Set up your AdMob account",
+ "summary": "Guide to setting up your account so that you get the most value.",
+ "keywords": ["marketing", "admob"],
+ "type": "distribute",
+ "titleFriendly": ""
+ },
+ {
+ "lang": "en",
+ "group": "",
+ "tags": [],
+ "url": "http://analyticsacademy.withgoogle.com/mobile-app",
+ "timestamp": null,
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/admob_64dp.png",
+ "title": "Analytics Academy for Mobile Apps",
+ "summary": "Learn how to use Google Analytics to make your app more discoverable and profitable.",
+ "keywords": ["marketing", "analytics"],
+ "type": "distribute",
+ "titleFriendly": ""
+ },
+ {
+ "lang": "en",
+ "group": "",
+ "tags": [],
+ "url": "https://developers.google.com/mobile-ads-sdk/download",
+ "timestamp": null,
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/admob_64dp.png",
+ "title": "Google Mobile Ads SDK",
+ "summary": "Use the Mobile Ads SDK to start showing AdMob ads in your apps.",
+ "keywords": ["marketing", "adwords"],
+ "type": "distribute",
+ "titleFriendly": ""
+ },
+ {
+ "lang": "en",
+ "group": "",
+ "tags": [],
+ "url": "https://support.google.com/admob/",
+ "timestamp": null,
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/admob_64dp.png",
+ "title": "AdMob Help Center",
+ "summary": "For setup assistance, general info, and fixes for specific problems check out the AdMob Help Center.",
+ "keywords": ["admob"],
+ "type": "distribute",
+ "titleFriendly": ""
+ },
+ {
+ "lang": "en",
+ "group": "",
+ "tags": [],
+ "url": "https://support.google.com/admob/answer/2753860",
+ "timestamp": null,
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/admob_64dp.png",
+ "title": "AdMob Policy Guidelines",
+ "summary": "Learn about best practices for displaying AdMob ads in your apps to maximize revenue.",
+ "keywords": ["admob"],
+ "type": "distribute",
+ "titleFriendly": ""
+ },
+ {
+ "lang": "en",
+ "group": "",
+ "tags": ["appindexing", "search", "getusers"],
+ "url": "https://developers.google.com/app-indexing/",
+ "timestamp": 1383243492000,
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/search_64dp.png",
+ "title": "Set Up App Indexing",
+ "summary": "Learn more about how Google Search can help users discover your app, along with other ways you can integrate with Google Search.",
+ "keywords": ["search"],
+ "type": "guide",
+ "titleFriendly": ""
+ },
+ {
+ "lang": "en",
+ "group": "",
+ "tags": ["appindexing", "search", "getusers"],
+ "url": "https://developers.google.com/app-indexing/webmasters/details",
+ "timestamp": null,
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/search_64dp.png",
+ "title": "Verify and Create Deep Links",
+ "summary": "Index your app today by adding deep links and verifying its official web site to ensure it starts appearing in Google Search results.",
+ "keywords": ["search"],
+ "type": "distribute",
+ "titleFriendly": ""
+ },
+ {
+ "lang": "en",
+ "group": "",
+ "tags": [
+ "appindexing",
+ "search",
+ "getusers",
+ ],
+ "url": "https://support.google.com/admob/answer/2753860",
+ "timestamp": null,
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/search_64dp.png",
+ "title": "Drive use with Google Search",
+ "summary": "More about how app indexing and deep links can drive users directly to the content in your app. ",
+ "keywords": [],
+ "type": "distribute",
+ "titleFriendly": ""
+ },
+ // TODO remove this?
{
"title":"Android Wear Materials",
"titleFriendly":"",
@@ -2328,12 +2498,11 @@
"lang":"en",
"type":"video"
},
-
{
"title":"Android Support Library",
"titleFriendly":"",
"summary":"These essential components help you build a great app that works on the huge variety of Android devices, faster.",
- "url":"https://www.youtube.com/watch?v=3PIc-DuEU2s&index=1&list=PLWz5rJ2EKKc9e0d55YHgJFHXNZbGHEXJX",
+ "url":"https://www.youtube.com/watch?v=3PIc-DuEU2s&list=PLWz5rJ2EKKc9e0d55YHgJFHXNZbGHEXJX",
"group":"",
"keywords": ["support", "compatibility"],
"tags": [],
@@ -2342,13 +2511,61 @@
"type":"Video"
},
{
+ "title":"Consistent Design with the AppCompat Support Library",
+ "titleFriendly":"",
+ "summary":"Getting a great looking app doesn't have to be hard: AppCompat, part of the Android Support Library, gives you a consistent design baseline that works on all Android 2.1 or higher devices.",
+ "url":"https://www.youtube.com/watch?v=5Be2mJzP-Uw&list=PLWz5rJ2EKKc9e0d55YHgJFHXNZbGHEXJX",
+ "group":"",
+ "keywords": ["support", "compatibility","design-code"],
+ "tags": [],
+ "image":"http://i1.ytimg.com/vi/5Be2mJzP-Uw/maxresdefault.jpg",
+ "lang":"en",
+ "type":"Video"
+ },
+ {
+ "title":"Introducing Gradle",
+ "titleFriendly":"",
+ "summary":"Android Studio uses an entirely new and flexible Gradle-based build system. You will be able to create multiple build variants for a single project, manage library dependencies and always be sure that your application builds correctly across different environments.",
+ "url":"https://www.youtube.com/watch?v=cD7NPxuuXYY&list=PLWz5rJ2EKKc8I9gHTMh5yKkwRRGE8BjbQ",
+ "group":"",
+ "keywords": ["tools", "studio","gradle"],
+ "tags": [],
+ "image":"http://i1.ytimg.com/vi/cD7NPxuuXYY/maxresdefault.jpg",
+ "lang":"en",
+ "type":"Video"
+ },
+ {
+ "title":"Android Studio Layout Editor",
+ "titleFriendly":"",
+ "summary":"Android Studio includes a rich, visual layout editor that helps developers create better user interfaces. It eliminates the need to deploy the APK on a real device with each change, making iterations faster and helping eliminate common errors earlier in the development process.",
+ "url":"https://www.youtube.com/watch?v=JLLnhwtDoHw&list=PLWz5rJ2EKKc8I9gHTMh5yKkwRRGE8BjbQ",
+ "group":"",
+ "keywords": ["tools", "studio","layout"],
+ "tags": [],
+ "image":"http://i1.ytimg.com/vi/JLLnhwtDoHw/maxresdefault.jpg",
+ "lang":"en",
+ "type":"Video"
+ },
+ {
+ "title":"Debugging and testing in Android Studio",
+ "titleFriendly":"",
+ "summary":"Learn about new debugger features in Android Studio 1.2: value inlining, quick access to referring objects and a Java .class decompiler, just to name a few. See some new tools and views that let you monitor the CPU and memory performance of your app from within the IDE. ",
+ "url":"https://www.youtube.com/watch?v=2I6fuD20qlY&list=PLWz5rJ2EKKc8I9gHTMh5yKkwRRGE8BjbQ",
+ "group":"",
+ "keywords": ["tools", "studio","debugging","profiling","performance"],
+ "tags": [],
+ "image":"http://i1.ytimg.com/vi/2I6fuD20qlY/maxresdefault.jpg",
+ "lang":"en",
+ "type":"Video"
+ },
+ {
"tags": [
"android",
"developerstory",
"googleplay",
"featured"
],
- "title": "Android Developer Storys: Jelly Button Games — Growing globally through data driven development",
+ "title": "Android Developer Story: Jelly Button Games — Growing globally through data driven development",
"type": "youtube",
"url": "http://www.youtube.com/watch?v=Pd49vTkvu0U"
},
diff --git a/docs/html/preview/data-binding/guide.jd b/docs/html/preview/data-binding/guide.jd
new file mode 100644
index 0000000..49b690f
--- /dev/null
+++ b/docs/html/preview/data-binding/guide.jd
@@ -0,0 +1,908 @@
+page.title=Data Binding Guide
+
+@jd:body
+<p>Data Binding allows you write declarative layouts and minimize the glue code
+that is necessary to bind your application logic and layouts.</p>
+
+
+<h2 id=build_environment>Build Environment</h2>
+
+
+<p><strong>Setting Up Work Environment:</strong></p>
+
+<p>Data Binding EAP only supports gradle.</p>
+
+<p>To set up your application, unzip the provided bundle to a location. It has 3
+sections</p>
+
+<ul>
+ <li> <em>maven-repo:</em> which keeps the data-binding libraries
+ <li> <em>samples:</em> Sample applications
+ <li> <em>databinding.properties:</em> Properties file that can be used to integrate with your app
+</ul>
+
+<p>Add the following section to the project’s build.gradle file (not the module's
+build.gradle) and replace <code><BUNDLE_FOLDER> </code>with the absolute path of the bundle that you’ve unzipped in the previous step.</p>
+
+<pre class=prettyprint>
+buildscript {
+ <strong>def </strong>eapFolder = '<BUNDLE_FOLDER>'
+<strong> def </strong>Properties props = <strong>new </strong>Properties()
+ props.load(<strong>new </strong>FileInputStream(<strong>"</strong>${eapFolder}<strong>/databinding.properties"</strong>))
+ props.mavenRepoDir = <strong>"</strong>${eapFolder}<strong>/</strong>${props.mavenRepoName}<strong>"
+ </strong>ext.config = props
+ repositories {
+ jcenter()
+ maven {
+ url config.mavenRepoDir
+ }
+ }
+ dependencies {
+ classpath <strong>"com.android.tools.build:gradle:1.1.3"
+ </strong>classpath <strong>"com.android.databinding:dataBinder:</strong>${config.snapshotVersion}<strong>"
+<em></strong> </em>}
+}
+allprojects {
+ repositories {
+ jcenter()
+ maven {
+ url config.mavenRepoDir
+ }
+ }
+}
+</pre>
+
+<p>Next, add the following lines to the <em>build.gradle</em>
+file of each module that will use data-binding. The application module must
+have this, even if only its libraries use data binding.</p>
+
+<pre class=prettyprint>
+apply plugin: <strong>'com.android.databinding'
+</strong>dependencies {
+ compile <strong>"com.android.databinding:library:</strong>${config.snapshotVersion}<strong>"
+</strong> compile <strong>"com.android.databinding:baseLibrary:</strong>${config.snapshotVersion}<strong>"
+</strong> compile <strong>"com.android.databinding:adapters:</strong>${config.snapshotVersion}<strong>"
+</strong> provided <strong>"com.android.databinding:annotationprocessor:</strong>${config.snapshotVersion}<strong>"
+</strong>}
+</pre>
+
+
+<h2 id="data_binding_layout_files">Data Binding Layout Files</h2>
+
+
+<h3 id="writing_expressions">Writing your first data binding expressions:</h3>
+
+<p>Data-binding layout files are slightly different and start with a root tag of
+<strong>layout</strong> followed by a <strong>data</strong> element and a
+<strong>view</strong> root element. This view element is what your root would
+be in a non-binding layout file.A sample file looks like this:</p>
+
+<pre class=prettyprint>
+<em><?<strong></em>xml version="1.0" encoding="utf-8"<em></strong>?>
+</em><<strong>layout xmlns:android="http://schemas.android.com/apk/res/android"</strong>>
+ <<strong>data</strong>>
+ <<strong>variable name="user" type="com.example.User"</strong>/>
+ </<strong>data</strong>>
+ <<strong>LinearLayout
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"</strong>>
+ <<strong>TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{user.firstName}"</strong>/>
+ <<strong>TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{user.lastName}"</strong>/>
+ </<strong>LinearLayout</strong>>
+</<strong>layout</strong>>
+</pre>
+
+<p>The user <strong>variable</strong> within <strong>data</strong> describes a property that may be used within this layout.</p>
+
+<pre class=prettyprint>
+<<strong>variable name="user" type="com.example.User"</strong>/>
+</pre>
+
+<p>Expressions within the layout are written in the attribute properties using the
+“<code>@{}</code>” syntax. Here, the TextView’s text is set to the firstName property of user:</p>
+<pre class=prettyprint>
+<<strong>TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{user.firstName}"</strong>/>
+</pre>
+
+
+<h3 id="data_object">Data Object</h3>
+
+<p>Let’s assume for now that you have a plain-old Java object (POJO) for User:</p>
+<pre class=prettyprint>
+<strong>public class </strong>User {
+ <strong>public final </strong>String <strong>firstName</strong>;
+ <strong>public final </strong>String <strong>lastName</strong>;
+ <strong>public </strong>User(String firstName, String lastName) {
+ <strong>this</strong>.<strong>firstName </strong>= firstName;
+ <strong>this</strong>.<strong>lastName </strong>= lastName;
+ }
+}
+</pre>
+
+<p>This type of object has data that never changes. It is common in applications
+to have data that is read once and never changes thereafter. It is also
+possible to use a JavaBeans objects:</p>
+<pre class=prettyprint>
+<strong>public class </strong>User {
+ <strong>private final </strong>String <strong>firstName</strong>;
+ <strong>private final </strong>String <strong>lastName</strong>;
+ <strong>public </strong>User(String firstName, String lastName) {
+ <strong>this</strong>.<strong>firstName </strong>= firstName;
+ <strong>this</strong>.<strong>lastName </strong>= lastName;
+ }
+ <strong>public </strong>String getFirstName() {
+ <strong>return this</strong>.<strong>firstName</strong>;
+ }
+ <strong>public </strong>String getLastName() {
+ <strong>return this</strong>.<strong>lastName</strong>;
+ }
+}
+</pre>
+
+<p>From the perspective of data binding, these two classes are equivalent. The
+expression <strong><code>@{user.lastName}</code></strong> used for the TextView’s <strong><code>android:text</code></strong> attribute will access the <strong><code>firstName</code></strong> field in the former class and the <code>getFirstName()</code> method in the latter class.
+</p><h3 id=binding_data>Binding Data</h3>
+
+<p>By default, a Binding class will be generated based on the name of the layout
+file, converting it to Pascal case and suffixing “Binding” to it. The above
+layout file was <code>activity_main.xml</code> so the generate class was <code>ActivityMainBinding</code>. This class holds all the bindings from the layout properties (e.g. the <code>user</code> variable) to the layout’s Views and knows how to assign values for the binding
+expressions.The easiest means for creating the bindings is to do it while inflating:
+</p>
+
+<pre class=prettyprint>
+@Override
+<strong>protected void </strong>onCreate(Bundle savedInstanceState) {
+ <strong>super</strong>.onCreate(savedInstanceState);
+ ActivityMainBinding binding = DataBindingUtil.<em>setContentView</em>(<strong>this</strong>, R.layout.<em><strong>main_activity</strong></em>);
+ User user = <strong>new </strong>User(<strong>"Test"</strong>, <strong>"User"</strong>);
+ binding.setUser(user);
+}
+</pre>
+
+<p>You’re done! Run the application and you’ll see Test User in the UI.Alternatively, you can get the view via:
+</p><pre class=prettyprint>
+MainActivityBinding binding = MainActivityBinding.<em>inflate</em>(getLayoutInflater());
+</pre>
+
+<p>If you are using data binding items inside a ListView or RecyclerView adapter,
+you may prefer to use:
+</p><pre class=prettyprint>
+ListItemBinding binding = ListItemBinding.inflate(layoutInflater, viewGroup,
+false);
+//or
+ListItemBinding binding = DataBindingUtil.<em>inflate</em>(layoutInflater, R.layout.<em><strong>list_item</strong></em>, viewGroup, <strong>false</strong>);
+</pre>
+
+
+<h2 id=layout_details>Layout Details</h2>
+
+
+<h3 id=imports>Imports</h3>
+
+<p>Zero or more <strong><code>import</code></strong> elements may be used inside the <strong><code>data</code></strong> element. These allow easy reference to classes inside your layout file, just
+like in Java.
+</p><pre class=prettyprint>
+<<strong>data</strong>>
+ <<strong>import type="android.view.View"</strong>/>
+</<strong>data</strong>>
+</pre>
+
+<p>Now, View may be used within your binding expression:
+</p><pre class=prettyprint>
+<<strong>TextView
+ android:text="@{user.lastName}"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="@{user.isAdult ? View.VISIBLE : View.GONE}"</strong>/>
+</pre>
+
+<p>When there are class name conflicts, one of the classes may be renamed to an
+“alias:”</p>
+<pre class=prettyprint>
+<<strong>import type="android.view.View"</strong>/>
+<<strong>import type="com.example.real.estate.View"
+ alias="Vista"</strong>/>
+</pre>
+
+<p>Now, <strong><code>Vista</code></strong> may be used to reference the <code>com.example.real.estate.View</code> and <strong><code>View</code></strong> may be used to reference <code>android.view.View </code>within the layout file.Imported types may be used as type references in variables and expressions:</p>
+<pre class=prettyprint>
+<<strong>data</strong>>
+ <<strong>import type="com.example.User"</strong>/>
+ <<strong>import type="java.util.List"</strong>/>
+ <<strong>variable name="user" type="User"</strong>/>
+ <<strong>variable name="userList" type="List<User>"</strong>/>
+</<strong>data</strong>>
+…
+<<strong>TextView
+ android:text="@{((User)(user.connection)).lastName}"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"</strong>/>
+</pre>
+
+<p>Imported types may also be used when referencing static fields and methods in
+expressions:</p>
+<pre class=prettyprint>
+<<strong>data</strong>>
+ <<strong>import type="com.example.MyStringUtils"</strong>/>
+ <<strong>variable name="user" type="com.example.User"</strong>/>
+</<strong>data</strong>>
+…
+<<strong>TextView
+ android:text="@{MyStringUtils.capitalize(user.lastName)}"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"</strong>/>
+</pre>
+
+<p>Just as in Java, <code>java.lang.*</code> is imported automatically.</p>
+<h3 id=variables>Variables</h3>
+
+<p>Any number of <strong><code>variable</code></strong> elements may be used inside the <strong><code>data</code></strong> element. Each <strong><code>variable</code></strong> element describes a property that may be set on the layout to be used in
+binding expressions within the layout file.</p>
+<pre class=prettyprint>
+<<strong>data</strong>>
+ <<strong>import type="android.graphics.drawable.Drawable"</strong>/>
+ <<strong>variable name="user" type="com.example.User"</strong>/>
+ <<strong>variable name="image" type="Drawable"</strong>/>
+ <<strong>variable name="note" type="String"</strong>/>
+</<strong>data</strong>>
+</pre>
+
+<p>The variable types are inspected at compile time, so if a variable implements <a href="#observable_objects">Observable</a>, <a href="#observable_collections">observable collection</a>, that should be reflected in the type. If the variable is a base class or
+ interface that does not implement the Observable* interface, the variables will <strong>not be</strong> observed!</p>
+
+<p>When there are different layout files for various configurations (e.g.
+landscape or portrait), the variables will be combined. There must not be
+conflicting variable definitions between these layout files.</p>
+
+<p>The generated binding class will have a setter and getter for each of the
+described variables. The variables will take the default Java values until the
+setter is called — <code>null</code> for reference types, <code>0</code> for <code>int</code>, <code>false</code> for <code>boolean</code>, etc.</p>
+
+<h3 id=custom_binding_class_names>Custom Binding Class Names</h3>
+
+<p>By default, a Binding class is generated based on the name of the layout file,
+starting it with upper-case, removing underscores ( _ ) and capitalizing the
+following letter and then suffixing “Binding”. This class will be placed in a
+databinding package under the module package. For example, the layout file <code>contact_item.xml</code> will generate <code>ContactItemBinding</code>. If the module package is <code>com.example.my.app</code>, then it will be placed in <code>com.example.my.app.databinding</code>.</p>
+
+<p>Binding classes may be renamed or placed in different packages by adjusting the <strong><code>class</code></strong> attribute of the <strong><code>data</code></strong> element. For example:</p>
+<pre class=prettyprint>
+<<strong>data class="ContactItem"</strong>>
+ ...
+</<strong>data</strong>>
+</pre>
+
+<p>This generates the binding class as <code>ContactItem</code> in the databinding package in the module package. If the class should be
+generated in a different package within the module package, it may be prefixed
+with “.”:</p>
+<pre class=prettyprint>
+<<strong>data class=".ContactItem"</strong>>
+ ...
+</<strong>data</strong>>
+</pre>
+
+In this case, <code>ContactItem</code> is generated in the module package directly.Any package may be used if the full package is provided:
+<pre class=prettyprint>
+<<strong>data class="com.example.ContactItem"</strong>>
+ ...
+</<strong>data</strong>>
+</pre>
+
+
+<h3 id=includes>Includes</h3>
+
+<p>Variables may be passed into an included layout's binding from the containing
+layout by using the application namespace and the variable name in an
+attribute:</p>
+<pre class=prettyprint>
+<em><?<strong></em>xml version="1.0" encoding="utf-8"<em></strong>?>
+</em><<strong>layout xmlns:android="http://schemas.android.com/apk/res/android"
+</strong> <strong> xmlns:bind="http://schemas.android.com/apk/res-auto"</strong>>
+ <<strong>data</strong>>
+ <<strong>variable name="user" type="com.example.User"</strong>/>
+ </<strong>data</strong>>
+ <<strong>LinearLayout
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"</strong>>
+ <<strong>include layout="@layout/name"
+ bind:user="@{user}"</strong>/>
+ <<strong>include layout="@layout/contact"
+ bind:user="@{user}"</strong>/>
+ </<strong>LinearLayout</strong>>
+</<strong>layout</strong>>
+</pre>
+
+<p>Here, there must be a <code>user</code> variable in both the <code>name.xml </code>and <code>contact.xml </code>layout files.</p>
+<h3 id=expression_language>Expression Language</h3>
+
+
+<h4 id=common_features>Common Features</h4>
+
+<p>The expression language looks a lot like a Java expression. These are the same:</p>
+<ul>
+ <li> Mathematical <strong><code>+ - / * %</code></strong>
+ <li> String concatenation <strong><code>+</code></strong>
+ <li> <code>L</code>ogical <strong><code>&& ||</code></strong>
+ <li> Binary <strong><code>&</code> <code>|</code> <code>^</code></strong>
+ <li> Unary <strong><code>+ - ! ~</code></strong>
+ <li> Shift <strong><code>>> >>> <<</code></strong>
+ <li> Comparison <strong><code>== > < >= <=</code></strong>
+ <li> <strong><code>instanceof</code></strong>
+ <li> Grouping <strong><code>()</code></strong>
+ <li> Literals - character, String, numeric, <strong><code>null</code></strong>
+ <li> Cast
+ <li> Method calls
+ <li> Field access
+ <li> Array access <strong><code>[]</code></strong>
+ <li> Ternary operator <strong><code>?:</code></strong>
+</ul>
+<p>Examples:</p>
+<pre class=prettyprint>
+<strong>android:text="@{String.valueOf(index + 1)}"
+android:visibility="@{age < 13 ? View.GONE : View.VISIBLE}"
+android:transitionName='@{"image_" + id}'</strong>
+</pre>
+
+
+<h4 id=missing_operations>Missing Operations</h4>
+
+<p>A few operations are missing from the expression syntax that you can use in
+Java.</p>
+<ul>
+ <li> <strong><code>this</code></strong>
+ <li> <strong><code>super</code></strong>
+ <li> <strong><code>new</code></strong>
+ <li> Explicit generic invocation
+</ul>
+
+<h4 id=null_coalescing_operator>Null Coalescing Operator</h4>
+
+<p>The null coalescing operator (<strong><code>??</code></strong>) chooses the left operand if it is not null or the right if it is null.</p>
+<pre class=prettyprint>
+<strong>android:text="@{user.displayName ?? user.lastName}"</strong>
+</pre>
+
+<p>This is functionally equivalent to:</p>
+<pre class=prettyprint>
+<strong>android:text="@{user.displayName != null ? user.displayName : user.lastName}"</strong>
+</pre>
+
+
+<h4 id=property_reference>Property Reference</h4>
+
+<p>The first was already discussed in the <a href="#writing_your_first_data_binding_expressions">Writing your first data binding expressions</a> above: short form JavaBean references. When an expression references a
+property on a class, it uses the same format for fields, getters, and
+ObservableFields.</p>
+<pre class=prettyprint>
+<strong>android:text="@{user.lastName}"</strong>
+</pre>
+
+
+<h4 id=collections>Collections</h4>
+
+<p>Common collections: arrays, lists, sparse lists, and maps, may be accessed
+using the <code>[]</code> operator for convenience.</p>
+<pre class=prettyprint>
+<<strong>data</strong>>
+ <<strong>import type="android.util.SparseArray"</strong>/>
+ <<strong>import type="java.util.Map"</strong>/>
+ <<strong>import type="java.util.List"</strong>/>
+ <<strong>variable name="list" type="List<String>"</strong>/>
+ <<strong>variable name="sparse" type="SparseArray<String>"</strong>/>
+ <<strong>variable name="map" type="Map<String, String>"</strong>/>
+ <<strong>variable name="index" type="int"</strong>/>
+ <<strong>variable name="key" type="String"</strong>/>
+</<strong>data</strong>>
+…
+<strong>android:text="@{list[index]}"
+</strong>…
+<strong>android:text="@{sparse[index]}"
+</strong>…
+<strong>android:text="@{map[key]}"
+</strong>
+</pre>
+
+
+<h4 id=string_literals>String Literals</h4>
+
+<p>When using single quotes around the attribute value, it is easy to use double
+quotes in the expression:</p>
+<pre class=prettyprint>
+<strong>android:text='@{map["firstName"]}'</strong>
+</pre>
+
+<p>It is also possible to use double quotes to surround the attribute value. When
+doing so, String literals should either use the " or back quote (`).</p>
+<pre class=prettyprint>
+<strong>android:text="@{map[`firstName`}"
+android:text="@{map["firstName"]}"</strong>
+</pre>
+
+
+<h4 id=resources>Resources</h4>
+
+<p>It is possible to access resources as part of expressions using the normal
+syntax:</p>
+<pre class=prettyprint>
+<strong>android:padding="@{large? @dimen/largePadding : @dimen/smallPadding}"</strong>
+</pre>
+
+<p>Format strings and plurals may be evaluated by providing parameters:</p>
+<pre class=prettyprint>
+<strong>android:text="@{@string/nameFormat(firstName, lastName)}"
+android:text="@{@plurals/banana(bananaCount)}"</strong>
+</pre>
+
+<p>Some resources require explicit type evaluation.</p>
+
+<table>
+ <tr>
+ <th>Type</th>
+ <th>Normal Reference</th>
+ <th>Expression Reference</th>
+ </tr>
+ <tr>
+ <td>
+<pre class=prettyprint>
+String[]</td>
+ <td>
+@array</td>
+ <td>
+@stringArray</td>
+ </tr>
+ <tr>
+ <td>
+int[]</td>
+ <td>
+@array</td>
+ <td>
+@intArray</td>
+ </tr>
+ <tr>
+ <td>
+TypedArray</td>
+ <td>
+@array</td>
+ <td>
+@typedArray</td>
+ </tr>
+ <tr>
+ <td>
+Animator</td>
+ <td>
+@animator</td>
+ <td>
+@animator</td>
+ </tr>
+ <tr>
+ <td>
+StateListAnimator</td>
+ <td>
+@animator</td>
+ <td>
+@stateListAnimator</td>
+ </tr>
+ <tr>
+ <td>
+</pre>
+
+color <code>int</code></td>
+ <td>
+<pre class=prettyprint>
+@color</td>
+ <td>
+@color</td>
+ </tr>
+ <tr>
+ <td>
+ColorStateList</td>
+ <td>
+@color</td>
+ <td>
+@colorStateList</td>
+ </tr>
+</table>
+
+</pre>
+
+
+<h2 id="data_objects">Data Objects</h2>
+
+
+<p>Any plain old Java object (POJO) may be used for data binding, but modifying a
+POJO will not cause the UI to update. The real power of data binding can be
+used by giving your data objects the ability to notify when data changes. There
+are three different data change notification mechanisms, <code>Observable </code>objects, <code>ObservableField</code>s, and <code>observable collections</code>.</p>
+
+<p>When one of these observable data object is bound to the UI and a property of
+the data object changes, the UI will be updated automatically.</p>
+
+<h3 id=observable_objects>Observable Objects</h3>
+
+
+<p>A class implementing <code>android.databinding.Observable</code> interface will allow the binding to attach a single listener to a bound object
+to listen for changes of all properties on that object.</p>
+
+<p>The <code>Observable</code> interface has a mechanism to add and remove listeners, but notifying is up to
+the developer. To make development easier, a base class, <code>BaseObservable,</code> was created to implement the listener registration mechanism. The data class
+implementer is still responsible for notifying when the properties change. This
+is done by assigning an <code>Bindable </code>annotation to the getter and notifying in the setter.</p>
+
+<pre class=prettyprint>
+<strong>private static class </strong>User <strong>extends </strong>BaseObservable {
+ <strong>private </strong>String <strong>firstName</strong>;
+ <strong>private </strong>String <strong>lastName</strong>;
+ @Bindable
+ <strong>public </strong>String getFirstName() {
+ <strong>return this</strong>.<strong>firstName</strong>;
+ }
+ @Bindable
+ <strong>public </strong>String getFirstName() {
+ <strong>return this</strong>.<strong>lastName</strong>;
+ }
+ <strong>public void </strong>setFirstName(String firstName) {
+ <strong>this</strong>.<strong>firstName </strong>= firstName;
+ notifyPropertyChanged(BR.firstName);
+ }
+ <strong>public void </strong>setLastName(String lastName) {
+ <strong>this</strong>.<strong>lastName </strong>= lastName;
+ notifyPropertyChanged(BR.lastName);
+ }
+}
+</pre>
+
+<p>The <code>Bindable </code>annotation generates an entry in the BR class file during compilation. The BR
+class file will be generated in the module package.If the base class for data classes cannot be changed, the <code>Observable</code> interface may be implemented using the convenient <code>PropertyChangeRegistry</code> to store and notify listeners efficiently.</p>
+
+<h3 id=observablefields>ObservableFields</h3>
+
+<p>A little work is involved in creating Observable classes, so developers who
+want to save time or have few properties may use ObservableFields.
+ObservableFields are self-contained observable objects that have a single
+field. There are versions for all primitive types and one for reference types.
+To use, create a public final field in the data class:</p>
+<pre class=prettyprint>
+<strong>private static class </strong>User <strong>extends </strong>BaseObservable {
+ <strong>public final </strong>ObservableField<String> <strong>firstName </strong>=
+ <strong>new </strong>ObservableField<>();
+ <strong>public final </strong>ObservableField<String> <strong>lastName </strong>=
+ <strong>new </strong>ObservableField<>();
+ <strong>public final </strong>ObservableInt <strong>age </strong>= <strong>new </strong>ObservableInt();
+}
+</pre>
+
+<p>That's it! To access the value, use the set and get accessor methods:</p>
+<pre class=prettyprint>
+user.<strong>firstName</strong>.set(<strong>"Google"</strong>);
+<strong>int </strong>age = user.<strong>age</strong>.get();
+</pre>
+
+
+<h3 id=observable_collections>Observable Collections</h3>
+
+<p>Some applications use more dynamic structures to hold data. Observable
+ collections allow keyed access to these data objects.ObservableArrayMap is useful when the key is a reference type, such as String.</p>
+
+<pre class=prettyprint>
+ObservableArrayMap<String, Object> user = <strong>new </strong>ObservableArrayMap<>();
+user.put(<strong>"firstName"</strong>, <strong>"Google"</strong>);
+user.put(<strong>"lastName"</strong>, <strong>"Inc."</strong>);
+user.put(<strong>"age"</strong>, 17);
+</pre>
+
+In the layout, the map may be accessed through the String keys:
+<pre class=prettyprint>
+<<strong>data</strong>>
+ <<strong>import type="android.databinding.ObservableMap"</strong>/>
+ <<strong>variable name="user" type="ObservableMap<String, Object>"</strong>/>
+</<strong>data</strong>>
+…
+<<strong>TextView
+ android:text='@{user["lastName"]}'
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"</strong>/>
+<<strong>TextView
+ android:text='@{String.valueOf(1 + (Integer)user["age"])}'
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"</strong>/>
+</pre>
+
+<p>ObservableArrayList is useful when the key is an integer:</p>
+<pre class=prettyprint>
+ObservableArrayList<Object> user = <strong>new </strong>ObservableArrayList<>();
+user.add(<strong>"Google"</strong>);
+user.add(<strong>"Inc."</strong>);
+user.add(17);
+</pre>
+
+<p>In the layout, the list may be accessed through the indices:</p>
+<pre class=prettyprint>
+<<strong>data</strong>>
+ <<strong>import type="android.databinding.ObservableList"</strong>/>
+ <<strong>import type="com.example.my.app.Fields"</strong>/>
+ <<strong>variable name="user" type="ObservableList<Object>"</strong>/>
+</<strong>data</strong>>
+…
+<<strong>TextView
+ android:text='@{user[Fields.LAST_NAME]}'
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"</strong>/>
+<<strong>TextView
+ android:text='@{String.valueOf(1 + (Integer)user[Fields.AGE])}'
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"</strong>/>
+</pre>
+
+
+<h2 id=generated_binding>Generated Binding</h2>
+
+<p>The generated binding class links the layout variables with the Views within
+the layout. As discussed earlier, the name and package of the Binding may be <a href="#custom_binding_class_names">customized</a>. The Generated binding classes all extend <code>android.databinding.ViewDataBinding</code>.</p>
+<h3 id=creating>Creating</h3>
+
+<p>The binding should be created soon after inflation to ensure that the View
+hierarchy is not disturbed prior to binding to the Views with expressions
+within the layout. There are a few ways to bind to a layout. The most common is
+to use the static methods on the Binding class.The inflate method inflates the View hierarchy and binds to it all it one step.
+There are versions that attach the View to its parent and that inflate without
+attaching.</p>
+<pre class=prettyprint>
+MyLayoutBinding binding = MyLayoutBinding.<em>inflate</em>(<strong>this</strong>);
+MyLayoutBinding binding = MyLayoutBinding.<em>inflate</em>(viewGroup);
+</pre>
+
+<p>If the layout was inflated using a different mechanism, it may be bound
+separately:</p>
+<pre class=prettyprint>
+MyLayoutBinding binding = MyLayoutBinding.<em>bind</em>(viewRoot);
+</pre>
+
+<p>Sometimes the binding cannot be known in advance. In such cases, the binding
+can be created using the DataBindingUtil class:</p>
+<pre class=prettyprint>
+ViewDataBinding binding = DataBindingUtil.<em>inflate</em>(context, layoutId,
+ parent, attachToParent);
+ViewDataBinding binding = DataBindingUtil.<em>bindTo</em>(viewRoot, layoutId);
+</pre>
+
+
+<h3 id=views_with_ids>Views With IDs</h3>
+
+<p>A public final field will be generated for each View with an ID in the layout.
+The binding does a single pass on the View hierarchy, extracting the Views with
+IDs. This mechanism can be faster than calling findViewById for several Views. For example:</p>
+<pre class=prettyprint>
+<<strong>layout xmlns:android="http://schemas.android.com/apk/res/android"</strong>>
+ <<strong>data</strong>>
+ <<strong>variable name="user" type="com.example.User"</strong>/>
+ </<strong>data</strong>>
+ <<strong>LinearLayout
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"</strong>>
+ <<strong>TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{user.firstName}"
+</strong> <strong>android:id="@+id/firstName"</strong>/>
+ <<strong>TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@{user.lastName}"</strong> <strong>android:id="@+id/lastName"</strong>/>
+ </<strong>LinearLayout</strong>>
+</<strong>layout</strong>>
+</pre>
+
+Will generate a binding class with:
+<pre class=prettyprint>
+<strong>public final </strong>TextView <strong>firstName</strong>;
+<strong>public final </strong>TextView <strong>lastName</strong>;
+</pre>
+
+<p>IDs are not nearly as necessary as without data binding, but there are still
+some instances where access to Views are still necessary from code.</p>
+<h3 id=variables>Variables</h3>
+
+<p>Each variable will be given a accessor methods.</p>
+<pre class=prettyprint>
+<<strong>data</strong>>
+ <<strong>import type="android.graphics.drawable.Drawable"</strong>/>
+ <<strong>variable name="user" type="com.example.User"</strong>/>
+ <<strong>variable name="image" type="Drawable"</strong>/>
+ <<strong>variable name="note" type="String"</strong>/>
+</<strong>data</strong>>
+</pre>
+
+<p>will generate setters and getters in the binding:</p>
+<pre class=prettyprint>
+<strong>public abstract </strong>com.example.User getUser();
+<strong>public abstract void </strong>setUser(com.example.User user);
+<strong>public abstract </strong>Drawable getImage();
+<strong>public abstract void </strong>setImage(Drawable image);
+<strong>public abstract </strong>String getNote();
+<strong>public abstract void </strong>setNote(String note);
+</pre>
+
+
+<h3 id=viewstubs>ViewStubs</h3>
+
+<p>ViewStubs are a little different from normal Views. They start off invisible
+and when they either are made visible or are explicitly told to inflate, they
+replace themselves in the layout by inflating another layout.</p>
+
+<p>Because the ViewStub essentially disappears from the View hierarchy, the View
+in the binding object must also disappear to allow collection. Because the
+Views are final, a ViewStubProxy object takes the place of the ViewStub, giving
+the developer access to the ViewStub when it exists and also access to the
+inflated View hierarchy when the ViewStub has been inflated.</p>
+
+<p>When inflating another layout, a binding must be established for the new
+layout. Therefore, the ViewStubProxy must listen to the ViewStub's
+OnInflateListener and establish the binding at that time. Since only one can
+exist, the ViewStubProxy allows the developer to set an OnInflateListener on it
+that it will call after establishing the binding.</p>
+
+<h3 id=advanced_binding>Advanced Binding</h3>
+
+
+<h4 id=dynamic_variables>Dynamic Variables</h4>
+
+<p>At times, the specific binding class won't be known. For example, a
+RecyclerView Adapter operating against arbitrary layouts won't know the
+specific binding class. It still must assign the binding value during the
+onBindViewHolder.</p>
+
+<p>In this example, all layouts that the RecyclerView binds to have an "item"
+variable. The BindingHolder has a getBinding method returning the <code>ViewDataBinding</code> base.</p>
+<pre class=prettyprint>
+<strong>public void </strong>onBindViewHolder(BindingHolder holder, <strong>int </strong>position) {
+ <strong>final </strong>T item = <strong>mItems</strong>.get(position);
+ holder.getBinding().setVariable(BR.item, item);
+ holder.getBinding().executePendingBindings();
+}
+</pre>
+
+
+<h4 id=immediate_binding>Immediate Binding</h4>
+
+<p>When a variable or observable changes, the binding will be scheduled to change
+before the next frame. There are times, however, when binding must be executed
+immediately. To force execution, use the executePendingBindings() method.</p>
+<h2 id=attribute_setters>Attribute Setters</h2>
+
+<p>Whenever a bound value changes, the generated binding class must call a setter
+method on the View with the binding expression. The data binding framework has
+ways to customize which method to call to set the value.</p>
+<h3 id=automatic_setters>Automatic Setters</h3>
+
+For an attribute, data binding tries to find the method setAttribute. The
+namespace for the attribute does not matter, only the attribute name itself.
+
+<p>For example, an expression associated with TextView's attribute <strong><code>android:text</code></strong> will look for a setText(String). If the expression returns an int, data
+binding will search for a setText(int) method. Be careful to have the
+expression return the correct type, casting if necessary.Note that data binding will work even if no attribute exists with the given
+name. You can then easily "create" attributes for any setter by using data
+binding. For example, support DrawerLayout doesn't have any attributes, but
+plenty of setters. You can use the automatic setters to use one of these.</p>
+<pre class=prettyprint>
+<android.support.v4.widget.<strong>DrawerLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:scrimColor="@{@color/scrim}"
+ app:drawerListener="@{fragment.drawerListener}"/></strong>
+</pre>
+
+
+<h3 id=renamed_setters>Renamed Setters</h3>
+
+<p>Some attributes have setters that don't match by name. For these methods, an
+attribute may be associated with the setter through BindingMethods annotation.
+This must be associated with a class and contains BindingMethod annotations,
+one for each renamed method. For example, the <strong><code>android:tint</code></strong> attribute is really associated with setImageTintList, not setTint.</p>
+<pre class=prettyprint>
+@BindingMethods({
+ @BindingMethod(type = <strong>"android.widget.ImageView"</strong>,
+ attribute = <strong>"android:tint"</strong>,
+ method = <strong>"setImageTintList"</strong>),
+})
+</pre>
+
+<p>It is unlikely that developers will need to rename setters; the android
+framework attributes have already been implemented.</p>
+<h3 id=custom_setters>Custom Setters</h3>
+
+<p>Some attributes need custom binding logic. For example, there is no associated
+setter for the <strong><code>android:paddingLeft</code></strong> attribute. Instead, setPadding(left, top, right, bottom) exists. A static
+binding adapter method with the BindingAdapter annotation allows the developer
+to customize how a setter for an attribute is called.</p>
+
+<p>The android attributes have already had BindingAdapters created. For example,
+here is the one for paddingLeft:</p>
+<pre class=prettyprint></p>
+@BindingAdapter(<strong>"android:paddingLeft"</strong>)
+<strong>public static void </strong>setPaddingLeft(View view, <strong>int </strong>padding) {
+ view.setPadding(padding,
+ view.getPaddingTop(),
+ view.getPaddingRight(),
+ view.getPaddingBottom());
+}
+</pre>
+
+<p>Binding adapters are useful for other types of customization. For example, a
+ custom loader can be called off-thread to load an image.</p>
+
+<p>Developer-created binding adapters will override the data binding default
+adapters when there is a conflict.</p>
+
+<p>You can also have adapters that receive multiple parameters. </p>
+<pre class=prettyprint>
+@BindingAdapter(attributes = {<strong>"bind:imageUrl"</strong>, <strong>"bind:error"</strong>})
+<strong>public static void </strong>loadImage(ImageView view, String url, Drawable error) {
+ Picasso.<em>with</em>(view.getContext()).load(url).error(error).into(view);
+}
+</pre>
+
+<p>This adapter will be called if both <strong>imageUrl </strong>and <strong>error </strong>are used for an ImageView and <em>imageUrl </em>is a string and <em>error</em> is a drawable.</p>
+<ul>
+ <li> Custom namespaces are ignore during matching.
+ <li> You can also write adapters for android namespace.
+</ul>
+
+<pre class=prettyprint>
+<ImageView app:imageUrl=“@{venue.imageUrl}”
+app:error=“@{@drawable/venueError}”/>
+</pre>
+
+
+<h2 id=converters>Converters</h2>
+
+
+<h3 id=object_conversions>Object Conversions</h3>
+
+<p>When an Object is returned from a binding expression, a setter will be chosen
+from the automatic, renamed, and custom setters. The Object will be cast to a
+parameter type of the chosen setter.</p><p>This is a convenience for those using ObservableMaps to hold data. for example:</p>
+<pre class=prettyprint>
+<<strong>TextView
+ android:text='@{userMap["lastName"]}'
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"</strong>/>
+</pre>
+
+<p>The userMap returns an Object and that Object will be automatically cast to
+parameter type found in the setter <code>setText(CharSequence)</code>. When there may be confusion about the parameter type, the developer will need
+to cast in the expression.</p>
+<h3 id=custom_conversions>Custom Conversions</h3>
+
+<p>Sometimes conversions should be automatic between specific types. For example,
+when setting the background:</p>
+<pre class=prettyprint>
+<<strong>View
+ android:background="@{isError ? @color/red : @color/white}"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"</strong>/>
+</pre>
+
+<p>Here, the background takes a <code>Drawable</code>, but the color is an integer. Whenever a <code>Drawable</code> is expected and an integer is returned, the <code>int</code> should be converted to a <code>ColorDrawable</code>. This conversion is done using a static method with a BindingConversion
+annotation:</p>
+<pre class=prettyprint>
+@BindingConversion
+<strong>public static </strong>ColorDrawable convertColorToDrawable(<strong>int </strong>color) {
+ <strong>return new </strong>ColorDrawable(color);
+}
+</pre>
+
+<p>Note that conversions only happen at the setter level, so it is <strong>not allowed </strong>to mix types like this:</p>
+<pre class=prettyprint>
+<<strong>View
+ android:background="@{isError ? @drawable/error : @color/white}"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"</strong>/>
+</pre>
+
diff --git a/docs/html/preview/images/m-preview-timeline.png b/docs/html/preview/images/m-preview-timeline.png
new file mode 100644
index 0000000..a065c21
--- /dev/null
+++ b/docs/html/preview/images/m-preview-timeline.png
Binary files differ
diff --git a/docs/html/preview/index.html b/docs/html/preview/index.html
deleted file mode 100644
index af99e2d..0000000
--- a/docs/html/preview/index.html
+++ /dev/null
@@ -1,372 +0,0 @@
-<!DOCTYPE html>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<html>
-<head>
-
-
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="viewport" content="width=970" />
-
-<meta name="Description" content="Test and build your apps against the next version of Android to ensure they're ready when the platform officially launches.">
-<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
-<title>Android M Developer Preview | Android Developers</title>
-
-<!-- STYLESHEETS -->
-<link rel="stylesheet"
-href="//fonts.googleapis.com/css?family=Roboto+Condensed">
-<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold"
- title="roboto">
-<link href="/assets/css/default.css" rel="stylesheet" type="text/css">
-
-
-
-<!-- JAVASCRIPT -->
-<script src="//www.google.com/jsapi" type="text/javascript"></script>
-<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
-<script type="text/javascript">
- var toRoot = "/";
- var metaTags = [];
- var devsite = false;
-</script>
-<script src="/assets/js/docs.js" type="text/javascript"></script>
-
-<script>
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
-
- ga('create', 'UA-5831155-1', 'android.com');
- ga('create', 'UA-49880327-2', 'android.com', {'name': 'universal'}); // New tracker);
- ga('send', 'pageview');
- ga('universal.send', 'pageview'); // Send page view for new tracker.
-</script>
-
-</head>
-
-<body class="gc-documentation
-
-" itemscope itemtype="http://schema.org/Article">
-
-
-<a name="top"></a>
-<div id="body-content">
-<div class="fullpage" >
-<div id="jd-content">
- <div class="jd-descr" itemprop="articleBody">
- <style>
-.fullpage>#footer,
-#jd-content>.content-footer.wrap {
- display:none;
-}
-</style>
-
-<style>
-#footer {
- display: none;
-}
-.content-footer {
- display: none;
-}
-</style>
-
-<!--
-<div style="height:20px"></div>
-<div id="butterbar-wrapper">
- <div id="butterbar">
- <a href="#" id="butterbar-message">
- butterbar message
- </a>
- </div>
-</div>
--->
-
- <div class="landing-rest-of-page">
- <div class="landing-section" style="padding-top:60px">
- <div class="wrap">
- <div class="landing-section-header">
- <div class="landing-h1">Android M Developer Preview</div>
- <div class="landing-subhead">
- Get an early look at the next release and prepare your apps for the
- official platform launch.
- </div>
-
- <img src="/preview/images/dev-prev.png" style=" margin:0px 0 0 40px" width="860px"/>
- <div class="col-6" style="margin-left:660px; margin-top:-105px">
- <a href="/preview/setup-sdk.html" class="landing-button landing-primary"
- style="position:absolute;z-index:100;float:right;margin-top: 0px;">
- Get Started</a>
- </div>
- </div>
- </div> <!-- end .wrap -->
- </div> <!-- end .landing-section -->
-
-
-
- <div class="landing-section landing-gray-background"
- style="margin-top:-105px; padding-bottom:20px">
- <div class="wrap">
- <div class="cols">
- <div class="landing-body" style="margin-top:-80px" >
-
- <div class="landing-breakout cols">
- <div class="col-4">
- <p>This Feature</p>
- <p class="landing-small">
- Kevin ham hock pig cupim brisket picanha, doner pork tri-tip frankfurter
- leberkas turkey.
- </p>
- <p class="landing-small">
- <a href="/preview/api-overview.html">Learn about this feature</a>
- </p>
- </div>
- <div class="col-4">
- <p>That Feature</p>
- <p class="landing-small">
- Bacon ipsum dolor amet meatball tongue pork loin fatback, andouille shoulder
- chicken picanha pig landjaeger kielbasa shankle pastrami flank meatloaf.
- </p>
- <p class="landing-small">
- <a href="/preview/api-overview.html">Learn about that feature</a>
- </p>
- </div>
- <div class="col-4">
- <p style="width:230px">Another Feature</p>
- <p class="landing-small">
- Landjaeger tri-tip tenderloin pork loin jowl, meatloaf t-bone kielbasa sausage
- swine spare ribs drumstick corned beef ham.
- </p>
- <p class="landing-small">
- <a href="/preview/api-overview.html">Learn about notifications</a>
- </p>
- </div>
- <div class="col-4">
- <p>Moar Features</p>
- <p class="landing-small">
- <b>Feature Name</b> is our effort to meatloaf boudin meatball sausage strip
- steak hamburger, chuck ham pork chop.
- </p>
- <p class="landing-small">
- <a href="/preview/api-overview.html">Learn about moar feature</a>
- </p>
- </div>
- </div>
- <p style="margin-left:20px">See the <a href="/preview/api-overview.html">API
- overview</a> for more information on the rest of the new and updated features.</p>
- </div>
- </div></div></div>
- <div class="landing-section">
- <div class="wrap">
- <div class="cols">
- <div class="landing-body">
- <div class="col-3-wide">
- <a target="_blank" href="https://code.google.com/p/android-developer-preview/">
- <img class="landing-social-image" src="/preview/images/bugs.png" alt="">
- </a>
- <div class="landing-social-copy">
- <p>Issue Tracker</p>
- <p class="landing-small">
- Let us know when you encounter problems, so we can fix them and make
- the platform better for you and your users.
- </p><p class="landing-small">
- <a href="https://code.google.com/p/android-developer-preview/">
- Report Issues</a>
- </p>
- <p></p>
- </div>
- </div>
- <div class="col-3-wide">
- <a target="_blank" href="http://g.co/androidldevpreview">
- <img class="landing-social-image" src="//www.google.com/images/icons/product/gplus-128.png" alt="">
- </a>
- <div class="landing-social-copy">
- <p>Google+ </p>
- <p class="landing-small">
- Join the community of Android developers testing out the M Developer Preview and
- share your thoughts and experiences.
- </p><p class="landing-small">
- <a href="http://g.co/androidldevpreview">
- Discuss on Google+</a>
- </p>
- </div>
- </div>
- <div class="col-3-wide">
- <a target="_blank" href="/preview/support.html">
- <img class="landing-social-image" src="/preview/images/updates.png" alt="">
- </a>
- <div class="landing-social-copy">
- <p>Support and Updates</p>
- <p class="landing-small">
- Updates to the preview are delivered
- in the Android SDK Manager. Check back periodically
- for news about the changes.
- </p>
- <p class="landing-small">
- <a href="/preview/support.html">Get Support</a>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <div class="content-footer wrap" itemscope="" itemtype="http://schema.org/SiteNavigationElement">
- <div class="layout-content-col col-16" style="padding-top:4px">
- <style>#___plusone_0 {float:right !important;}</style>
- <div class="g-plusone" data-size="medium"></div>
- </div>
- </div>
- <div id="footer" class="wrap" style="width:940px;position:relative;top:-35px;z-index:-1">
- <div id="copyright">
- Except as noted, this content is
- licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
- Creative Commons Attribution 2.5</a>. For details and
- restrictions, see the <a href="/license.html">Content
- License</a>.
- </div>
- </div>
- </div> <!-- end landing-body-content -->
-
- <script>
- $("a.landing-down-arrow").on("click", function(e) {
- $("body").animate({
- scrollTop: $(".preview-hero").height() + 76
- }, 1000, "easeOutQuint");
- e.preventDefault();
- });
- </script>
- </div>
-
- <div class="content-footer wrap"
- itemscope itemtype="http://schema.org/SiteNavigationElement">
-
- <div class="paging-links layout-content-col col-10">
-
- </div>
- <div class="layout-content-col plus-container col-2" >
- <style>#___plusone_0 {float:right !important;}</style>
- <div class="g-plusone" data-size="medium"></div>
-
- </div>
-
- </div>
-
-
-
-
- </div> <!-- end jd-content -->
-
-<div id="footer" class="wrap" style="width:940px">
-
-
- <div id="copyright">
-
- Except as noted, this content is
- licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
- Creative Commons Attribution 2.5</a>. For details and
- restrictions, see the <a href="/license.html">Content
- License</a>.
- </div>
-
-
-</div> <!-- end footer -->
-</div><!-- end doc-content -->
-
-</div> <!-- end body-content -->
-
-
-
-
-
- <script src="https://developer.android.com/ytblogger_lists_unified.js" type="text/javascript"></script>
- <script src="/jd_lists_unified.js" type="text/javascript"></script>
- <script src="/jd_extras.js" type="text/javascript"></script>
- <script src="/jd_collections.js" type="text/javascript"></script>
- <script src="/jd_tag_helpers.js" type="text/javascript"></script>
-
-</body>
-</html>
diff --git a/docs/html/preview/index.jd b/docs/html/preview/index.jd
index a2d0b18..c6c2068 100644
--- a/docs/html/preview/index.jd
+++ b/docs/html/preview/index.jd
@@ -17,44 +17,36 @@
<div class="col-1of2 col-pull-1of2">
<h1 class="dac-hero-title">M Developer Preview</h1>
<p class="dac-hero-description">
- Get ready for the next official release of the platform. Test your apps
- and give us feedback!
+ Get ready for the next official release of the platform. The preview program gives
+ you an advance look at new APIs, features, and behaviors coming to Android.
+ Test your apps and give us feedback!
</p>
- <a class="dac-hero-cta" href="{@docRoot}preview/setup-sdk.html">
+
+ <a class="dac-hero-cta" href="{@docRoot}preview/overview.html">
<span class="dac-sprite dac-auto-chevron"></span>
- Set up the Preview SDK
+ Preview Program Overview
</a><br>
<a class="dac-hero-cta" href="{@docRoot}preview/api-overview.html">
<span class="dac-sprite dac-auto-chevron"></span>
Review the API changes
</a><br>
+ <a class="dac-hero-cta" href="{@docRoot}preview/setup-sdk.html">
+ <span class="dac-sprite dac-auto-chevron"></span>
+ Set up the Preview SDK
+ </a><br>
<a class="dac-hero-cta" href="https://code.google.com/p/android-developer-preview/">
<span class="dac-sprite dac-auto-chevron"></span>
Report issues
</a><br>
+
</div>
</div>
+
+ <div class="dac-section dac-small">
+ <div class="resource-widget resource-flow-layout col-16"
+ data-query="collection:preview/landing/resources"
+ data-cardSizes="6x2"
+ data-maxResults="6"></div>
+ </div>
</div>
-</section>
-
-<section class="dac-section dac-gray dac-small dac-invert"><div class="wrap">
- <h2 class="norule">Latest</h2>
- <div class="resource-widget resource-flow-layout col-16"
- data-query="collection:develop/landing/latest"
- data-cardSizes="6x6"
- data-maxResults="3"></div>
-</div></section>
-
-
-<section class="dac-section"><div class="wrap">
- <h1 class="dac-section-title">Resources</h1>
- <div class="dac-section-subtitle">
- Check out these resources to help you get started with the M Developer Preview.
- </div>
- <div class="resource-widget resource-flow-layout col-16"
- data-query="collection:preview/landing/resources"
- data-cardSizes="6x6"
- data-maxResults="6"></div>
-</div></section>
-
-
+</section>
\ No newline at end of file
diff --git a/docs/html/preview/license.html b/docs/html/preview/license.html
deleted file mode 100644
index deb16aa..0000000
--- a/docs/html/preview/license.html
+++ /dev/null
@@ -1,274 +0,0 @@
-<!DOCTYPE html>
-
-<html>
-<head>
-
-
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="viewport" content="width=970" />
-
-<meta name="Description" content="To get started with the Android SDK Preview, you must agree to the following terms and conditions. As described below, please note that this is a preview version of the Android SDK, subject to change, that you use at your own risk.">
-<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
-<title>License Agreement | Android Developers</title>
-
-<!-- STYLESHEETS -->
-<link rel="stylesheet"
-href="//fonts.googleapis.com/css?family=Roboto+Condensed">
-<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold"
- title="roboto">
-<link href="/assets/css/default.css" rel="stylesheet" type="text/css">
-
-
-
-<!-- JAVASCRIPT -->
-<script src="//www.google.com/jsapi" type="text/javascript"></script>
-<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
-<script type="text/javascript">
- var toRoot = "/";
- var metaTags = [];
- var devsite = false;
-</script>
-<script src="/assets/js/docs.js" type="text/javascript"></script>
-
-<script>
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
-
- ga('create', 'UA-5831155-1', 'android.com');
- ga('create', 'UA-49880327-2', 'android.com', {'name': 'universal'}); // New tracker);
- ga('send', 'pageview');
- ga('universal.send', 'pageview'); // Send page view for new tracker.
-</script>
-
-</head>
-
-
-<body class="gc-documentation" itemscope="" itemtype="http://schema.org/Article">
-
-
-<a name="top"></a>
-<div id="body-content">
-<div class="fullpage">
-<div id="jd-content">
- <div class="jd-descr" itemprop="articleBody">
-<style>
-body,html, #qv {background-color:#e9e9e9}
-
-#qv * { font-weight:bold;}
-
-.fullpage>#footer,
-#jd-content>.content-footer.wrap {
- display:none;
-}
-
-.content-footer {
- display: none;
-}
-</style>
-
- <div style="border-bottom: 1px solid #a5c43a; position: absolute; left: 0; right: 0; top: 0;">
- <div class="wrap" style="position: relative; height: 45px; padding: 0 20px;">
- <a href="/index.html" style="position:absolute;top:8px">
- <img src="/assets/images/dac_logo.png" srcset="/assets/images/dac_logo@2x.png 2x" width="123" height="25" alt="Android Developers home page">
- </a>
- </div>
- </div>
-
- <div class="landing-rest-of-page">
- <div class="landing-section" style="padding:55px 10px 0">
-
-<div class="wrap">
-
-<div class="col-16" id="doc-col" >
-
- <h1 itemprop="name" >L Developer Preview License Agreement</h1>
-
-<div class="jd-descr" itemprop="articleBody">
- <p>
-If you are using the Android SDK
-Preview, you must agree to the following terms
-and conditions. As described below, please note that the preview version of the
-Android SDK is subject to change, and that you use it at your own risk. The
-Android SDK Preview is not a stable release, and may contain errors and defects
-that can result in serious damage to your computer systems, devices and data.
-</p>
-
-<p>
-This is the Android SDK Preview License Agreement (the “License Agreement”).
-</p>
-
-<div class="sdk-terms" style="height:auto;border:0;padding:0;width:940px">
-1. Introduction
-
-1.1 The Android SDK Preview (referred to in the License Agreement as the “Preview” and specifically including the Android system files, packaged APIs, and Preview library files, if and when they are made available) is licensed to you subject to the terms of the License Agreement. The License Agreement forms a legally binding contract between you and Google in relation to your use of the Preview.
-
-1.2 "Android" means the Android software stack for devices, as made available under the Android Open Source Project, which is located at the following URL: http://source.android.com/, as updated from time to time.
-
-1.3 "Google" means Google Inc., a Delaware corporation with principal place of business at 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States.
-
-2. Accepting the License Agreement
-
-2.1 In order to use the Preview, you must first agree to the License Agreement. You may not use the Preview if you do not accept the License Agreement.
-
-2.2 By clicking to accept and/or using the Preview, you hereby agree to the terms of the License Agreement.
-
-2.3 You may not use the Preview and may not accept the License Agreement if you are a person barred from receiving the Preview under the laws of the United States or other countries including the country in which you are resident or from which you use the Preview.
-
-2.4 If you will use the Preview internally within your company or organization you agree to be bound by the License Agreement on behalf of your employer or other entity, and you represent and warrant that you have full legal authority to bind your employer or such entity to the License Agreement. If you do not have the requisite authority, you may not accept the License Agreement or use the Preview on behalf of your employer or other entity.
-
-3. Preview License from Google
-
-3.1 Subject to the terms of the License Agreement, Google grants you a royalty-free, non-assignable, non-exclusive, non-sublicensable, limited, revocable license to use the Preview, personally or internally within your company or organization, solely to develop applications to run on the Android platform.
-
-3.2 You agree that Google or third parties owns all legal right, title and interest in and to the Preview, including any Intellectual Property Rights that subsist in the Preview. "Intellectual Property Rights" means any and all rights under patent law, copyright law, trade secret law, trademark law, and any and all other proprietary rights. Google reserves all rights not expressly granted to you.
-
-3.3 You may not use the Preview for any purpose not expressly permitted by the License Agreement. Except to the extent required by applicable third party licenses, you may not: (a) copy (except for backup purposes), modify, adapt, redistribute, decompile, reverse engineer, disassemble, or create derivative works of the Preview or any part of the Preview; or (b) load any part of the Preview onto a mobile handset or any other hardware device except a personal computer, combine any part of the Preview with other software, or distribute any software or device incorporating a part of the Preview.
-
-3.4 You agree that you will not take any actions that may cause or result in the fragmentation of Android, including but not limited to distributing, participating in the creation of, or promoting in any way a software development kit derived from the Preview.
-
-3.5 Use, reproduction and distribution of components of the Preview licensed under an open source software license are governed solely by the terms of that open source software license and not the License Agreement. You agree to remain a licensee in good standing in regard to such open source software licenses under all the rights granted and to refrain from any actions that may terminate, suspend, or breach such rights.
-
-3.6 You agree that the form and nature of the Preview that Google provides may change without prior notice to you and that future versions of the Preview may be incompatible with applications developed on previous versions of the Preview. You agree that Google may stop (permanently or temporarily) providing the Preview (or any features within the Preview) to you or to users generally at Google's sole discretion, without prior notice to you.
-
-3.7 Nothing in the License Agreement gives you a right to use any of Google's trade names, trademarks, service marks, logos, domain names, or other distinctive brand features.
-
-3.8 You agree that you will not remove, obscure, or alter any proprietary rights notices (including copyright and trademark notices) that may be affixed to or contained within the Preview.
-
-4. Use of the Preview by You
-
-4.1 Google agrees that nothing in the License Agreement gives Google any right, title or interest from you (or your licensors) under the License Agreement in or to any software applications that you develop using the Preview, including any intellectual property rights that subsist in those applications.
-
-4.2 You agree to use the Preview and write applications only for purposes that are permitted by (a) the License Agreement, and (b) any applicable law, regulation or generally accepted practices or guidelines in the relevant jurisdictions (including any laws regarding the export of data or software to and from the United States or other relevant countries).
-
-4.3 You agree that if you use the Preview to develop applications, you will protect the privacy and legal rights of users. If users provide you with user names, passwords, or other login information or personal information, you must make the users aware that the information will be available to your application, and you must provide legally adequate privacy notice and protection for those users. If your application stores personal or sensitive information provided by users, it must do so securely. If users provide you with Google Account information, your application may only use that information to access the user's Google Account when, and for the limited purposes for which, each user has given you permission to do so.
-
-4.4 You agree that you will not engage in any activity with the Preview, including the development or distribution of an application, that interferes with, disrupts, damages, or accesses in an unauthorized manner the servers, networks, or other properties or services of Google or any third party.
-
-4.5 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any data, content, or resources that you create, transmit or display through Android and/or applications for Android, and for the consequences of your actions (including any loss or damage which Google may suffer) by doing so.
-
-4.6 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any breach of your obligations under the License Agreement, any applicable third party contract or Terms of Service, or any applicable law or regulation, and for the consequences (including any loss or damage which Google or any third party may suffer) of any such breach.
-
-4.7 The Preview is in development, and your testing and feedback are an important part of the development process. By using the Preview, you acknowledge that implementation of some features are still under development and that you should not rely on the Preview having the full functionality of a stable release. You agree not to publicly distribute or ship any application using this Preview as this Preview will no longer be supported after the official Android SDK is released.
-
-5. Your Developer Credentials
-
-5.1 You agree that you are responsible for maintaining the confidentiality of any developer credentials that may be issued to you by Google or which you may choose yourself and that you will be solely responsible for all applications that are developed under your developer credentials.
-
-6. Privacy and Information
-
-6.1 In order to continually innovate and improve the Preview, Google may collect certain usage statistics from the software including but not limited to a unique identifier, associated IP address, version number of the software, and information on which tools and/or services in the Preview are being used and how they are being used. Before any of this information is collected, the Preview will notify you and seek your consent. If you withhold consent, the information will not be collected.
-
-6.2 The data collected is examined in the aggregate to improve the Preview and is maintained in accordance with Google's Privacy Policy located at http://www.google.com/policies/privacy/.
-
-7. Third Party Applications
-
-7.1 If you use the Preview to run applications developed by a third party or that access data, content or resources provided by a third party, you agree that Google is not responsible for those applications, data, content, or resources. You understand that all data, content or resources which you may access through such third party applications are the sole responsibility of the person from which they originated and that Google is not liable for any loss or damage that you may experience as a result of the use or access of any of those third party applications, data, content, or resources.
-
-7.2 You should be aware the data, content, and resources presented to you through such a third party application may be protected by intellectual property rights which are owned by the providers (or by other persons or companies on their behalf). You may not modify, rent, lease, loan, sell, distribute or create derivative works based on these data, content, or resources (either in whole or in part) unless you have been specifically given permission to do so by the relevant owners.
-
-7.3 You acknowledge that your use of such third party applications, data, content, or resources may be subject to separate terms between you and the relevant third party.
-
-8. Using Google APIs
-
-8.1 Google APIs
-
-8.1.1 If you use any API to retrieve data from Google, you acknowledge that the data may be protected by intellectual property rights which are owned by Google or those parties that provide the data (or by other persons or companies on their behalf). Your use of any such API may be subject to additional Terms of Service. You may not modify, rent, lease, loan, sell, distribute or create derivative works based on this data (either in whole or in part) unless allowed by the relevant Terms of Service.
-
-8.1.2 If you use any API to retrieve a user's data from Google, you acknowledge and agree that you shall retrieve data only with the user's explicit consent and only when, and for the limited purposes for which, the user has given you permission to do so.
-
-9. Terminating the License Agreement
-
-9.1 the License Agreement will continue to apply until terminated by either you or Google as set out below.
-
-9.2 If you want to terminate the License Agreement, you may do so by ceasing your use of the Preview and any relevant developer credentials.
-
-9.3 Google may at any time, terminate the License Agreement, with or without cause, upon notice to you.
-
-9.4 The License Agreement will automatically terminate without notice or other action upon the earlier of:
-(A) when Google ceases to provide the Preview or certain parts of the Preview to users in the country in which you are resident or from which you use the service; and
-(B) Google issues a final release version of the Android SDK.
-
-9.5 When the License Agreement is terminated, the license granted to you in the License Agreement will terminate, you will immediately cease all use of the Preview, and the provisions of paragraphs 10, 11, 12 and 14 shall survive indefinitely.
-
-10. DISCLAIMERS
-
-10.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE PREVIEW IS AT YOUR SOLE RISK AND THAT THE PREVIEW IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF ANY KIND FROM GOOGLE.
-
-10.2 YOUR USE OF THE PREVIEW AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED THROUGH THE USE OF THE PREVIEW IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF DATA THAT RESULTS FROM SUCH USE. WITHOUT LIMITING THE FOREGOING, YOU UNDERSTAND THAT THE PREVIEW IS NOT A STABLE RELEASE AND MAY CONTAIN ERRORS, DEFECTS AND SECURITY VULNERABILITIES THAT CAN RESULT IN SIGNIFICANT DAMAGE, INCLUDING THE COMPLETE, IRRECOVERABLE LOSS OF USE OF YOUR COMPUTER SYSTEM OR OTHER DEVICE.
-
-10.3 GOOGLE FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-
-11. LIMITATION OF LIABILITY
-
-11.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY LOSS OF DATA, WHETHER OR NOT GOOGLE OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING.
-
-12. Indemnification
-
-12.1 To the maximum extent permitted by law, you agree to defend, indemnify and hold harmless Google, its affiliates and their respective directors, officers, employees and agents from and against any and all claims, actions, suits or proceedings, as well as any and all losses, liabilities, damages, costs and expenses (including reasonable attorneys’ fees) arising out of or accruing from (a) your use of the Preview, (b) any application you develop on the Preview that infringes any Intellectual Property Rights of any person or defames any person or violates their rights of publicity or privacy, and (c) any non-compliance by you of the License Agreement.
-
-13. Changes to the License Agreement
-
-13.1 Google may make changes to the License Agreement as it distributes new versions of the Preview. When these changes are made, Google will make a new version of the License Agreement available on the website where the Preview is made available.
-
-14. General Legal Terms
-
-14.1 the License Agreement constitutes the whole legal agreement between you and Google and governs your use of the Preview (excluding any services which Google may provide to you under a separate written agreement), and completely replaces any prior agreements between you and Google in relation to the Preview.
-
-14.2 You agree that if Google does not exercise or enforce any legal right or remedy which is contained in the License Agreement (or which Google has the benefit of under any applicable law), this will not be taken to be a formal waiver of Google's rights and that those rights or remedies will still be available to Google.
-
-14.3 If any court of law, having the jurisdiction to decide on this matter, rules that any provision of the License Agreement is invalid, then that provision will be removed from the License Agreement without affecting the rest of the License Agreement. The remaining provisions of the License Agreement will continue to be valid and enforceable.
-
-14.4 You acknowledge and agree that each member of the group of companies of which Google is the parent shall be third party beneficiaries to the License Agreement and that such other companies shall be entitled to directly enforce, and rely upon, any provision of the License Agreement that confers a benefit on (or rights in favor of) them. Other than this, no other person or company shall be third party beneficiaries to the License Agreement.
-
-14.5 EXPORT RESTRICTIONS. THE PREVIEW IS SUBJECT TO UNITED STATES EXPORT LAWS AND REGULATIONS. YOU MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND REGULATIONS THAT APPLY TO THE PREVIEW. THESE LAWS INCLUDE RESTRICTIONS ON DESTINATIONS, END USERS AND END USE.
-
-14.6 The License Agreement may not be assigned or transferred by you without the prior written approval of Google, and any attempted assignment without such approval will be void. You shall not delegate your responsibilities or obligations under the License Agreement without the prior written approval of Google.
-
-14.7 The License Agreement, and your relationship with Google under the License Agreement, shall be governed by the laws of the State of California without regard to its conflict of laws provisions. You and Google agree to submit to the exclusive jurisdiction of the courts located within the county of Santa Clara, California to resolve any legal matter arising from the License Agreement. Notwithstanding this, you agree that Google shall still be allowed to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction.
-
-
-</div>
- </div>
- </div>
-
-</div>
- </div> <!-- end landing-body-content -->
-
- </div>
-
- <div class="content-footer wrap" itemscope=""
- itemtype="http://schema.org/SiteNavigationElement">
-
- <div class="paging-links layout-content-col col-10">
-
- </div>
-
- </div>
-
-
-
-
- </div> <!-- end jd-content -->
-
-<div id="footer" class="wrap" style="width:940px">
-
-
- <div id="copyright">
-
- Except as noted, this content is
- licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
- Creative Commons Attribution 2.5</a>. For details and
- restrictions, see the <a href="https://developer.android.com/license.html">Content
- License</a>.
- </div>
-
-
-</div> <!-- end footer -->
-</div><!-- end doc-content -->
-
-</div> <!-- end body-content -->
-
-</body>
-</html>
diff --git a/docs/html/preview/overview.jd b/docs/html/preview/overview.jd
index 00f1cfe..0c8931d 100644
--- a/docs/html/preview/overview.jd
+++ b/docs/html/preview/overview.jd
@@ -3,5 +3,54 @@
@jd:body
<p>
- This is an overview of the program. Bacon.
-</p>
\ No newline at end of file
+ The M Developer Preview program is an opportunity for you to test the compatibility of your apps
+ with the next platform release, try out early versions of new API features, and provide feedback
+ to the Android team. The program includes update releases during course of the program to allow
+ you to follow the progress of feature development and fixes, leading up to the official release
+ of the platform, as shown in Figure 1.
+</p>
+
+<img src="{@docRoot}preview/images/m-preview-timeline.png"
+ alt="Preview program timeline" id="figure1" style="margin-top: 15px;">
+<p class="img-caption">
+ <b>Figure 1.</b> Timeline for the M Developer Preview program.
+</p>
+
+<p>
+ We strongly encourage you to provide feedback for the M Preview releases through our <a href=
+ "https://code.google.com/p/android-developer-preview/">issue tracker</a>. Issues reported early
+ in the program have a better chance of being addressed before the official release, so reports
+ provided by June 30, 2015 receive priority processing by the Android team.
+</p>
+
+<p>
+ To get started testing your app:
+</p>
+
+<ul>
+ <li>Review the <a href="{@docRoot}preview/api-overview.html">
+ API Overview</a> and <a href=
+ "{@docRoot}preview/api-changes.html">Behavior Changes</a> to
+ get an idea of what's new and how it affects your app.
+ </li>
+
+ <li>Setup for testing and development by following the instructions for <a href=
+ "{@docRoot}preview/setup-sdk.html">Setting up the Preview
+ SDK</a> and configuring test devices.
+ </li>
+
+ <li>Review the <a href="{@docRoot}preview/reference.html">M
+ Preview API Reference</a> and <a href=
+ "{@docRoot}preview/samples.html">M Preview samples</a> to
+ gain more insight into new API features and how to use them in your app.
+ </li>
+
+ <li>Join the <a href="https://plus.google.com/communities/101985907812750684586">M Preview
+ Google+ developer community</a> to get the latest developer updates and connect with other
+ developers working with the preview.
+ </li>
+</ul>
+
+<p>
+ Thanks in advance for your participation in the developer preview program!
+</p>
diff --git a/docs/html/sdk/index.jd b/docs/html/sdk/index.jd
index a352f65..8da052e 100644
--- a/docs/html/sdk/index.jd
+++ b/docs/html/sdk/index.jd
@@ -55,7 +55,6 @@
<style type="text/css">
.offline {display:none;}
- a.download-bundle-button {display:block;}
h2.feature {
padding-top:30px;
margin-top:0;
@@ -66,19 +65,6 @@
padding-top:40px;
}
- .landing-button.green {
- font-size:16px;
- background-color:#90c653;
- padding:8px 10px 10px;
- margin:0;
- width:206px;
- text-align:center;
- }
-
- .landing-button.green:hover {
- background-color:#85b84f;
- }
-
.landing-button .small {
font-size: 12px;
font-weight: normal;
@@ -284,7 +270,7 @@
<img src="{@docRoot}images/tools/studio-hero.png"
srcset="{@docRoot}images/tools/studio-hero_2x.png 2x, {@docRoot}images/tools/studio-hero.png 1x"
-width="760" height="400" alt="" style="margin-bottom:100px" />
+width="760" height="400" alt="" />
<div style="color: #fff; width:226px; height:0; overflow:visible; position:absolute; top:40px; left:25px">
@@ -300,7 +286,7 @@
<li>Android 5.0 emulator system image with Google APIs</li>
</ul>
-<a class="online landing-button green download-bundle-button" style="margin-top:30px;"
+<a class="online landing-button green download-bundle-button"
href="#Other" >Download Android Studio</a>
<!-- this appears when viewing the offline docs -->
@@ -308,8 +294,9 @@
To get Android Studio or stand-alone SDK tools, visit <a
href="http://developer.android.com/sdk/index.html">developer.android.com/sdk/</a>
</p>
+</div>
-<ul style="margin-top:50px;color:#444">
+<ul>
<li><a href="#Requirements">System Requirements</a></li>
<li><a href="#Other">Other Download Options</a></li>
<li><a href="{@docRoot}sdk/installing/migrate.html">Migrating to Android Studio</a></li>
@@ -317,7 +304,6 @@
target="_blank">Take a Survey</a></li>
</ul>
-</div>
@@ -403,8 +389,7 @@
<p>Build APKs from Android Studio or the command line.</p>
</div>
-
-
+</div>
<h2 class="feature norule">More about Android Studio</h2>
<div style="background:#424242;padding:30px; color:#fff;margin:0 0 15px;">
diff --git a/docs/html/training/articles/keystore.jd b/docs/html/training/articles/keystore.jd
index fea3b2c..4005a05 100644
--- a/docs/html/training/articles/keystore.jd
+++ b/docs/html/training/articles/keystore.jd
@@ -88,7 +88,7 @@
<h3 id="GeneratingANewSecretKey">Generating a New Secret Key</h3>
<p>To generate the key, use a {@link javax.crypto.KeyGenerator} with
- {@link android.security.KeyGeneratorSpec}.
+ {@link android.security.keystore.KeyGenParameterSpec}.
<h3 id="WorkingWithKeyStoreEntries">Working with Keystore Entries</h3>
diff --git a/docs/image_sources/preview/m-preview-timeline.svg b/docs/image_sources/preview/m-preview-timeline.svg
new file mode 100644
index 0000000..b05dc98
--- /dev/null
+++ b/docs/image_sources/preview/m-preview-timeline.svg
@@ -0,0 +1,282 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="m-preview-timeline.svg"
+ inkscape:export-filename="/usr/local/google/home/joefernandez/projects/2015-05-006-m-preview-landing-page/m-preview-timeline.png"
+ inkscape:export-xdpi="119.84538"
+ inkscape:export-ydpi="119.84538">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.1315767"
+ inkscape:cx="526.18109"
+ inkscape:cy="372.04724"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1491"
+ inkscape:window-height="1008"
+ inkscape:window-x="313"
+ inkscape:window-y="118"
+ inkscape:window-maximized="0"
+ showguides="true"
+ inkscape:guide-bbox="true">
+ <sodipodi:guide
+ orientation="0,1"
+ position="196.21345,346.92813"
+ id="guide3936" />
+ <sodipodi:guide
+ orientation="0,1"
+ position="201.9008,562.0994"
+ id="guide4068" />
+ <sodipodi:guide
+ orientation="0,1"
+ position="418.01996,410.43683"
+ id="guide4088" />
+ <sodipodi:guide
+ orientation="0,1"
+ position="194.31767,462.57084"
+ id="guide4108" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-308.2677)">
+ <rect
+ style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect4170"
+ width="880.83386"
+ height="5"
+ x="25.750326"
+ y="649.00873" />
+ <rect
+ style="color:#000000;fill:#99cc00;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2987"
+ width="673.49542"
+ height="8.5310192"
+ x="117.70681"
+ y="647.24158" />
+ <path
+ sodipodi:type="arc"
+ style="color:#000000;fill:#99cc00;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3757"
+ sodipodi:cx="104.26801"
+ sodipodi:cy="404.74948"
+ sodipodi:rx="14.218366"
+ sodipodi:ry="14.218366"
+ d="m 118.48638,404.74948 c 0,7.85259 -6.36578,14.21837 -14.21837,14.21837 -7.852584,0 -14.218363,-6.36578 -14.218363,-14.21837 0,-7.85259 6.365779,-14.21836 14.218363,-14.21836 7.85259,0 14.21837,6.36577 14.21837,14.21836 z"
+ transform="translate(53.377673,246.4966)" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3759"
+ style="font-size:36px;font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;color:#000000;fill:#666666;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Roboto;-inkscape-font-specification:Roboto Light"
+ transform="translate(-9.180856,193.63686)"><flowRegion
+ id="flowRegion3761"><rect
+ id="rect3763"
+ width="155.34293"
+ height="135.3176"
+ x="50.939774"
+ y="260.83688"
+ style="text-align:center;text-anchor:middle;fill:#666666" /></flowRegion><flowPara
+ style="text-align:center;text-anchor:middle;fill:#666666"
+ id="flowPara3766">Preview </flowPara><flowPara
+ style="text-align:center;text-anchor:middle;fill:#666666"
+ id="flowPara3046">Release</flowPara><flowPara
+ style="font-size:24px;text-align:center;text-anchor:middle;fill:#666666"
+ id="flowPara3967">(Google I/O)</flowPara></flowRoot> <path
+ sodipodi:type="arc"
+ style="color:#000000;fill:#99cc00;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3757-1"
+ sodipodi:cx="104.26801"
+ sodipodi:cy="404.74948"
+ sodipodi:rx="14.218366"
+ sodipodi:ry="14.218366"
+ d="m 118.48638,404.74948 c 0,7.85259 -6.36578,14.21837 -14.21837,14.21837 -7.852584,0 -14.218363,-6.36578 -14.218363,-14.21837 0,-7.85259 6.365779,-14.21836 14.218363,-14.21836 7.85259,0 14.21837,6.36577 14.21837,14.21836 z"
+ transform="translate(279.50908,246.65479)" />
+ <path
+ sodipodi:type="arc"
+ style="color:#000000;fill:#99cc00;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3757-1-8"
+ sodipodi:cx="104.26801"
+ sodipodi:cy="404.74948"
+ sodipodi:rx="14.218366"
+ sodipodi:ry="14.218366"
+ d="m 118.48638,404.74948 c 0,7.85259 -6.36578,14.21837 -14.21837,14.21837 -7.852584,0 -14.218363,-6.36578 -14.218363,-14.21837 0,-7.85259 6.365779,-14.21836 14.218363,-14.21836 7.85259,0 14.21837,6.36577 14.21837,14.21836 z"
+ transform="translate(505.64051,247.60268)" />
+ <path
+ sodipodi:type="arc"
+ style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3757-1-84"
+ sodipodi:cx="104.26801"
+ sodipodi:cy="404.74948"
+ sodipodi:rx="14.218366"
+ sodipodi:ry="14.218366"
+ d="m 118.48638,404.74948 c 0,7.85259 -6.36578,14.21837 -14.21837,14.21837 -7.852584,0 -14.218363,-6.36578 -14.218363,-14.21837 0,-7.85259 6.365779,-14.21836 14.218363,-14.21836 7.85259,0 14.21837,6.36577 14.21837,14.21836 z"
+ transform="translate(731.7719,245.70689)" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3759-2"
+ style="font-size:36px;font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;color:#000000;fill:#666666;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Roboto;-inkscape-font-specification:Roboto Light"
+ transform="translate(-1.0121143,408.40861)"><flowRegion
+ id="flowRegion3761-9"><rect
+ id="rect3763-3"
+ width="80.11277"
+ height="51.644661"
+ x="50.939774"
+ y="260.83688"
+ style="text-align:center;text-anchor:middle;fill:#666666" /></flowRegion><flowPara
+ style="text-align:center;text-anchor:middle;fill:#666666"
+ id="flowPara3766-9">May</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3759-2-1"
+ style="font-size:36px;font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;color:#000000;fill:#666666;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Roboto;-inkscape-font-specification:Roboto Light"
+ transform="translate(177.38621,408.98166)"><flowRegion
+ id="flowRegion3761-9-4"><rect
+ id="rect3763-3-3"
+ width="80.11277"
+ height="51.644661"
+ x="50.939774"
+ y="260.83688"
+ style="text-align:center;text-anchor:middle;fill:#666666" /></flowRegion><flowPara
+ style="text-align:center;text-anchor:middle;fill:#666666"
+ id="flowPara3766-9-1">June</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3759-2-1-2"
+ style="font-size:36px;font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;color:#000000;fill:#666666;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Roboto;-inkscape-font-specification:Roboto Light"
+ transform="translate(406.04158,409.3565)"><flowRegion
+ id="flowRegion3761-9-4-5"><rect
+ id="rect3763-3-3-1"
+ width="80.11277"
+ height="51.644661"
+ x="50.939774"
+ y="260.83688"
+ style="text-align:center;text-anchor:middle;fill:#666666" /></flowRegion><flowPara
+ style="text-align:center;text-anchor:middle;fill:#666666"
+ id="flowPara3766-9-1-3">July</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3759-2-1-2-6"
+ style="font-size:36px;font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;color:#000000;fill:#666666;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Roboto;-inkscape-font-specification:Roboto Light"
+ transform="translate(608.0263,409.3565)"><flowRegion
+ id="flowRegion3761-9-4-5-0"><rect
+ id="rect3763-3-3-1-1"
+ width="127.50733"
+ height="51.644653"
+ x="50.939774"
+ y="260.83688"
+ style="text-align:center;text-anchor:middle;fill:#666666" /></flowRegion><flowPara
+ style="text-align:center;text-anchor:middle;fill:#666666"
+ id="flowPara3766-9-1-3-0">August</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3759-8"
+ style="font-size:36px;font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;color:#000000;fill:#666666;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Roboto;-inkscape-font-specification:Roboto Light"
+ transform="translate(149.48728,293.44548)"><flowRegion
+ id="flowRegion3761-2"><rect
+ id="rect3763-4"
+ width="194.80757"
+ height="45.009438"
+ x="50.939774"
+ y="260.83688"
+ style="text-align:center;text-anchor:middle;fill:#666666" /></flowRegion><flowPara
+ style="font-size:36px;text-align:center;text-anchor:middle;fill:#666666"
+ id="flowPara3967-7">Update 1</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3759-8-3"
+ style="font-size:36px;font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;color:#000000;fill:#666666;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Roboto;-inkscape-font-specification:Roboto Light"
+ transform="translate(295.61638,193.80278)"><flowRegion
+ id="flowRegion3761-2-2"><rect
+ id="rect3763-4-5"
+ width="162.57927"
+ height="43.113655"
+ x="50.939774"
+ y="260.83688"
+ style="text-align:center;text-anchor:middle;fill:#666666" /></flowRegion><flowPara
+ style="text-align:center;text-anchor:middle;fill:#666666"
+ id="flowPara3766-1-4">Update 2</flowPara><flowPara
+ style="font-size:24px;text-align:center;text-anchor:middle;fill:#666666"
+ id="flowPara3967-7-8" /></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3759-8-9"
+ style="font-size:36px;font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;color:#000000;fill:#666666;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Roboto;-inkscape-font-specification:Roboto Light"
+ transform="translate(434.6735,292.06086)"><flowRegion
+ id="flowRegion3761-2-3"><rect
+ id="rect3763-4-1"
+ width="169.21451"
+ height="45.957329"
+ x="50.939774"
+ y="260.83688"
+ style="text-align:center;text-anchor:middle;fill:#666666" /></flowRegion><flowPara
+ style="font-size:36px;text-align:center;text-anchor:middle;fill:#666666"
+ id="flowPara3967-7-4">Update 3</flowPara></flowRoot> <path
+ style="fill:none;stroke:#000000;stroke-width:1.49251163px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 119.43972,584.77048 c 0,55.54049 0,55.54049 0,55.54049"
+ id="path4048"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.76536787px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 424.475,506.61135 c 0,134.1317 0,134.1317 0,134.1317"
+ id="path4048-8"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.43408465px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 288.17078,601.45265 c 0,40.18609 0,40.18609 0,40.18609"
+ id="path4048-8-9"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.52709746px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 570.63062,598.15011 c 0,42.05171 0,42.05171 0,42.05171"
+ id="path4048-8-9-7"
+ inkscape:connector-curvature="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3759-8-3-0"
+ style="font-size:36px;font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;color:#000000;fill:#666666;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Roboto;-inkscape-font-specification:Roboto Light"
+ transform="translate(635.68275,194.45687)"><flowRegion
+ id="flowRegion3761-2-2-4"><rect
+ id="rect3763-4-5-9"
+ width="203.33855"
+ height="86.562088"
+ x="50.939774"
+ y="260.83688"
+ style="text-align:center;text-anchor:middle;fill:#666666" /></flowRegion><flowPara
+ style="text-align:center;text-anchor:middle;fill:#666666"
+ id="flowPara3766-1-4-3">Official SDK Release </flowPara><flowPara
+ style="font-size:24px;text-align:center;text-anchor:middle;fill:#666666"
+ id="flowPara3967-7-8-2" /></flowRoot> <path
+ style="fill:none;stroke:#000000;stroke-width:1.62254512px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 790.21294,546.10533 c 0,95.71447 0,95.71447 0,95.71447"
+ id="path4048-8-1"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index 20cd9b1..c5d68bd 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -184,12 +184,8 @@
/** @hide bit mask for the flag enabling vertical rendering for text */
public static final int VERTICAL_TEXT_FLAG = 0x1000;
-
- /** @hide default flags, even if unspecified */
- public static final int HIDDEN_DEFAULT_PAINT_FLAGS =
- DEV_KERN_TEXT_FLAG | EMBEDDED_BITMAP_TEXT_FLAG;
- /** @hide default flags for no-param constructor */
- public static final int DEFAULT_PAINT_FLAGS = ANTI_ALIAS_FLAG;
+ // These flags are always set on a new/reset paint, even if flags 0 is passed.
+ static final int HIDDEN_DEFAULT_PAINT_FLAGS = DEV_KERN_TEXT_FLAG | EMBEDDED_BITMAP_TEXT_FLAG;
/**
* Font hinter option that disables font hinting.
@@ -419,11 +415,9 @@
/**
* Create a new paint with default settings.
- *
- * As of {@link android.os.Build.VERSION_CODES#MNC}, sets {@link #ANTI_ALIAS_FLAG}.
*/
public Paint() {
- this(DEFAULT_PAINT_FLAGS);
+ this(0);
}
/**
@@ -458,7 +452,7 @@
/** Restores the paint to its default settings. */
public void reset() {
native_reset(mNativePaint);
- setFlags(DEFAULT_PAINT_FLAGS | HIDDEN_DEFAULT_PAINT_FLAGS);
+ setFlags(HIDDEN_DEFAULT_PAINT_FLAGS);
// TODO: Turning off hinting has undesirable side effects, we need to
// revisit hinting once we add support for subpixel positioning
diff --git a/graphics/java/android/graphics/drawable/ColorDrawable.java b/graphics/java/android/graphics/drawable/ColorDrawable.java
index 8e91621..5ad31f7 100644
--- a/graphics/java/android/graphics/drawable/ColorDrawable.java
+++ b/graphics/java/android/graphics/drawable/ColorDrawable.java
@@ -43,7 +43,7 @@
* @attr ref android.R.styleable#ColorDrawable_color
*/
public class ColorDrawable extends Drawable {
- private final Paint mPaint = new Paint();
+ private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
@ViewDebug.ExportedProperty(deepExport = true, prefix = "state_")
private ColorState mColorState;
diff --git a/keystore/java/android/security/AndroidKeyPairGenerator.java b/keystore/java/android/security/AndroidKeyPairGenerator.java
index ea90ca3..e9f8320 100644
--- a/keystore/java/android/security/AndroidKeyPairGenerator.java
+++ b/keystore/java/android/security/AndroidKeyPairGenerator.java
@@ -16,6 +16,10 @@
package android.security;
+import android.annotation.NonNull;
+import android.security.keystore.KeyGenParameterSpec;
+import android.security.keystore.KeyProperties;
+
import com.android.org.bouncycastle.x509.X509V3CertificateGenerator;
import com.android.org.conscrypt.NativeConstants;
import com.android.org.conscrypt.OpenSSLEngine;
@@ -36,6 +40,7 @@
import java.security.spec.InvalidKeySpecException;
import java.security.spec.RSAKeyGenParameterSpec;
import java.security.spec.X509EncodedKeySpec;
+import java.util.Locale;
/**
* Provides a way to create instances of a KeyPair which will be placed in the
@@ -54,13 +59,13 @@
public static class RSA extends AndroidKeyPairGenerator {
public RSA() {
- super(KeyStoreKeyProperties.KEY_ALGORITHM_RSA);
+ super(KeyProperties.KEY_ALGORITHM_RSA);
}
}
public static class EC extends AndroidKeyPairGenerator {
public EC() {
- super(KeyStoreKeyProperties.KEY_ALGORITHM_EC);
+ super(KeyProperties.KEY_ALGORITHM_EC);
}
}
@@ -80,18 +85,18 @@
private final String mAlgorithm;
- private android.security.KeyStore mKeyStore;
+ private KeyStore mKeyStore;
- private KeyPairGeneratorSpec mSpec;
- private @KeyStoreKeyProperties.KeyAlgorithmEnum String mKeyAlgorithm;
+ private KeyGenParameterSpec mSpec;
+ private @KeyProperties.KeyAlgorithmEnum String mKeyAlgorithm;
private int mKeyType;
private int mKeySize;
- protected AndroidKeyPairGenerator(@KeyStoreKeyProperties.KeyAlgorithmEnum String algorithm) {
+ protected AndroidKeyPairGenerator(@KeyProperties.KeyAlgorithmEnum String algorithm) {
mAlgorithm = algorithm;
}
- @KeyStoreKeyProperties.KeyAlgorithmEnum String getAlgorithm() {
+ @KeyProperties.KeyAlgorithmEnum String getAlgorithm() {
return mAlgorithm;
}
@@ -113,15 +118,16 @@
@Override
public KeyPair generateKeyPair() {
if (mKeyStore == null || mSpec == null) {
- throw new IllegalStateException(
- "Must call initialize with an android.security.KeyPairGeneratorSpec first");
+ throw new IllegalStateException("Not initialized");
+
}
- if (((mSpec.getFlags() & KeyStore.FLAG_ENCRYPTED) != 0)
+ final int flags = mSpec.getFlags();
+ if (((flags & KeyStore.FLAG_ENCRYPTED) != 0)
&& (mKeyStore.state() != KeyStore.State.UNLOCKED)) {
throw new IllegalStateException(
- "Android keystore must be in initialized and unlocked state "
- + "if encryption is required");
+ "Encryption at rest using secure lock screen credential requested for key pair"
+ + ", but the user has not yet entered the credential");
}
final String alias = mSpec.getKeystoreAlias();
@@ -131,8 +137,9 @@
byte[][] args = getArgsForKeyType(mKeyType, mSpec.getAlgorithmParameterSpec());
final String privateKeyAlias = Credentials.USER_PRIVATE_KEY + alias;
+
if (!mKeyStore.generate(privateKeyAlias, KeyStore.UID_SELF, mKeyType, mKeySize,
- mSpec.getFlags(), args)) {
+ flags, args)) {
throw new IllegalStateException("could not generate key in keystore");
}
@@ -175,7 +182,7 @@
}
if (!mKeyStore.put(Credentials.USER_CERTIFICATE + alias, certBytes, KeyStore.UID_SELF,
- mSpec.getFlags())) {
+ flags)) {
Credentials.deleteAllTypesForAlias(mKeyStore, alias);
throw new IllegalStateException("Can't store certificate in AndroidKeyStore");
}
@@ -188,17 +195,17 @@
throws Exception {
final X509V3CertificateGenerator certGen = new X509V3CertificateGenerator();
certGen.setPublicKey(publicKey);
- certGen.setSerialNumber(mSpec.getSerialNumber());
- certGen.setSubjectDN(mSpec.getSubjectDN());
- certGen.setIssuerDN(mSpec.getSubjectDN());
- certGen.setNotBefore(mSpec.getStartDate());
- certGen.setNotAfter(mSpec.getEndDate());
+ certGen.setSerialNumber(mSpec.getCertificateSerialNumber());
+ certGen.setSubjectDN(mSpec.getCertificateSubject());
+ certGen.setIssuerDN(mSpec.getCertificateSubject());
+ certGen.setNotBefore(mSpec.getCertificateNotBefore());
+ certGen.setNotAfter(mSpec.getCertificateNotAfter());
certGen.setSignatureAlgorithm(getDefaultSignatureAlgorithmForKeyAlgorithm(mKeyAlgorithm));
return certGen.generate(privateKey);
}
- private @KeyStoreKeyProperties.KeyAlgorithmEnum String getKeyAlgorithm(
- KeyPairGeneratorSpec spec) {
+ @NonNull
+ private @KeyProperties.KeyAlgorithmEnum String getKeyAlgorithm(KeyPairGeneratorSpec spec) {
String result = spec.getKeyType();
if (result != null) {
return result;
@@ -250,10 +257,10 @@
}
private static String getDefaultSignatureAlgorithmForKeyAlgorithm(
- @KeyStoreKeyProperties.KeyAlgorithmEnum String algorithm) {
- if (KeyStoreKeyProperties.KEY_ALGORITHM_RSA.equalsIgnoreCase(algorithm)) {
+ @KeyProperties.KeyAlgorithmEnum String algorithm) {
+ if (KeyProperties.KEY_ALGORITHM_RSA.equalsIgnoreCase(algorithm)) {
return "sha256WithRSA";
- } else if (KeyStoreKeyProperties.KEY_ALGORITHM_EC.equalsIgnoreCase(algorithm)) {
+ } else if (KeyProperties.KEY_ALGORITHM_EC.equalsIgnoreCase(algorithm)) {
return "sha256WithECDSA";
} else {
throw new IllegalArgumentException("Unsupported key type " + algorithm);
@@ -282,14 +289,86 @@
throws InvalidAlgorithmParameterException {
if (params == null) {
throw new InvalidAlgorithmParameterException(
- "must supply params of type android.security.KeyPairGeneratorSpec");
- } else if (!(params instanceof KeyPairGeneratorSpec)) {
- throw new InvalidAlgorithmParameterException(
- "params must be of type android.security.KeyPairGeneratorSpec");
+ "Must supply params of type " + KeyGenParameterSpec.class.getName()
+ + " or " + KeyPairGeneratorSpec.class.getName());
}
- KeyPairGeneratorSpec spec = (KeyPairGeneratorSpec) params;
- @KeyStoreKeyProperties.KeyAlgorithmEnum String keyAlgorithm = getKeyAlgorithm(spec);
+ String keyAlgorithm;
+ KeyGenParameterSpec spec;
+ if (params instanceof KeyPairGeneratorSpec) {
+ KeyPairGeneratorSpec legacySpec = (KeyPairGeneratorSpec) params;
+ try {
+ KeyGenParameterSpec.Builder specBuilder;
+ keyAlgorithm = getKeyAlgorithm(legacySpec).toUpperCase(Locale.US);
+ if (KeyProperties.KEY_ALGORITHM_EC.equalsIgnoreCase(keyAlgorithm)) {
+ specBuilder = new KeyGenParameterSpec.Builder(
+ legacySpec.getKeystoreAlias(),
+ KeyProperties.PURPOSE_SIGN
+ | KeyProperties.PURPOSE_VERIFY);
+ specBuilder.setDigests(
+ KeyProperties.DIGEST_NONE,
+ KeyProperties.DIGEST_MD5,
+ KeyProperties.DIGEST_SHA1,
+ KeyProperties.DIGEST_SHA224,
+ KeyProperties.DIGEST_SHA256,
+ KeyProperties.DIGEST_SHA384,
+ KeyProperties.DIGEST_SHA512);
+ } else if (KeyProperties.KEY_ALGORITHM_RSA.equalsIgnoreCase(keyAlgorithm)) {
+ specBuilder = new KeyGenParameterSpec.Builder(
+ legacySpec.getKeystoreAlias(),
+ KeyProperties.PURPOSE_ENCRYPT
+ | KeyProperties.PURPOSE_DECRYPT
+ | KeyProperties.PURPOSE_SIGN
+ | KeyProperties.PURPOSE_VERIFY);
+ specBuilder.setDigests(
+ KeyProperties.DIGEST_NONE,
+ KeyProperties.DIGEST_MD5,
+ KeyProperties.DIGEST_SHA1,
+ KeyProperties.DIGEST_SHA224,
+ KeyProperties.DIGEST_SHA256,
+ KeyProperties.DIGEST_SHA384,
+ KeyProperties.DIGEST_SHA512);
+ specBuilder.setSignaturePaddings(
+ KeyProperties.SIGNATURE_PADDING_RSA_PKCS1);
+ specBuilder.setBlockModes(KeyProperties.BLOCK_MODE_ECB);
+ specBuilder.setEncryptionPaddings(
+ KeyProperties.ENCRYPTION_PADDING_NONE,
+ KeyProperties.ENCRYPTION_PADDING_RSA_PKCS1);
+ // Disable randomized encryption requirement to support encryption padding NONE
+ // above.
+ specBuilder.setRandomizedEncryptionRequired(false);
+ } else {
+ throw new InvalidAlgorithmParameterException(
+ "Unsupported key algorithm: " + keyAlgorithm);
+ }
+
+ if (legacySpec.getKeySize() != -1) {
+ specBuilder.setKeySize(legacySpec.getKeySize());
+ }
+ if (legacySpec.getAlgorithmParameterSpec() != null) {
+ specBuilder.setAlgorithmParameterSpec(legacySpec.getAlgorithmParameterSpec());
+ }
+ specBuilder.setCertificateSubject(legacySpec.getSubjectDN());
+ specBuilder.setCertificateSerialNumber(legacySpec.getSerialNumber());
+ specBuilder.setCertificateNotBefore(legacySpec.getStartDate());
+ specBuilder.setCertificateNotAfter(legacySpec.getEndDate());
+ specBuilder.setEncryptionAtRestRequired(legacySpec.isEncryptionRequired());
+ specBuilder.setUserAuthenticationRequired(false);
+
+ spec = specBuilder.build();
+ } catch (NullPointerException | IllegalArgumentException e) {
+ throw new InvalidAlgorithmParameterException(e);
+ }
+ } else if (params instanceof KeyGenParameterSpec) {
+ spec = (KeyGenParameterSpec) params;
+ keyAlgorithm = getAlgorithm();
+ } else {
+ throw new InvalidAlgorithmParameterException(
+ "Unsupported params class: " + params.getClass().getName()
+ + ". Supported: " + KeyGenParameterSpec.class.getName()
+ + ", " + KeyPairGeneratorSpec.class);
+ }
+
int keyType = KeyStore.getKeyTypeForAlgorithm(keyAlgorithm);
if (keyType == -1) {
throw new InvalidAlgorithmParameterException(
@@ -300,7 +379,7 @@
keySize = getDefaultKeySize(keyType);
if (keySize == -1) {
throw new InvalidAlgorithmParameterException(
- "Unsupported key algorithm: " + keyAlgorithm);
+ "Unsupported key algorithm: " + keyAlgorithm);
}
}
checkCorrectParametersSpec(keyType, keySize, spec.getAlgorithmParameterSpec());
@@ -310,6 +389,6 @@
mKeyType = keyType;
mKeySize = keySize;
mSpec = spec;
- mKeyStore = android.security.KeyStore.getInstance();
+ mKeyStore = KeyStore.getInstance();
}
}
diff --git a/keystore/java/android/security/AndroidKeyStore.java b/keystore/java/android/security/AndroidKeyStore.java
index 7ac236a..69bf877 100644
--- a/keystore/java/android/security/AndroidKeyStore.java
+++ b/keystore/java/android/security/AndroidKeyStore.java
@@ -24,6 +24,8 @@
import android.security.keymaster.KeyCharacteristics;
import android.security.keymaster.KeymasterArguments;
import android.security.keymaster.KeymasterDefs;
+import android.security.keystore.KeyProperties;
+import android.security.keystore.KeyProtection;
import android.util.Log;
import java.io.ByteArrayInputStream;
@@ -129,11 +131,10 @@
keymasterDigest = keymasterDigests.get(0);
}
- @KeyStoreKeyProperties.KeyAlgorithmEnum String keyAlgorithmString;
+ @KeyProperties.KeyAlgorithmEnum String keyAlgorithmString;
try {
- keyAlgorithmString =
- KeyStoreKeyProperties.KeyAlgorithm.fromKeymasterSecretKeyAlgorithm(
- keymasterAlgorithm, keymasterDigest);
+ keyAlgorithmString = KeyProperties.KeyAlgorithm.fromKeymasterSecretKeyAlgorithm(
+ keymasterAlgorithm, keymasterDigest);
} catch (IllegalArgumentException e) {
throw (UnrecoverableKeyException)
new UnrecoverableKeyException("Unsupported secret key type").initCause(e);
@@ -270,7 +271,70 @@
}
private void setPrivateKeyEntry(String alias, PrivateKey key, Certificate[] chain,
- KeyStoreParameter params) throws KeyStoreException {
+ java.security.KeyStore.ProtectionParameter param) throws KeyStoreException {
+ KeyProtection spec;
+ if (param instanceof KeyStoreParameter) {
+ KeyStoreParameter legacySpec = (KeyStoreParameter) param;
+ try {
+ String keyAlgorithm = key.getAlgorithm();
+ KeyProtection.Builder specBuilder;
+ if (KeyProperties.KEY_ALGORITHM_EC.equalsIgnoreCase(keyAlgorithm)) {
+ specBuilder =
+ new KeyProtection.Builder(
+ KeyProperties.PURPOSE_SIGN | KeyProperties.PURPOSE_VERIFY);
+ specBuilder.setDigests(
+ KeyProperties.DIGEST_NONE,
+ KeyProperties.DIGEST_MD5,
+ KeyProperties.DIGEST_SHA1,
+ KeyProperties.DIGEST_SHA224,
+ KeyProperties.DIGEST_SHA256,
+ KeyProperties.DIGEST_SHA384,
+ KeyProperties.DIGEST_SHA512);
+ } else if (KeyProperties.KEY_ALGORITHM_RSA.equalsIgnoreCase(keyAlgorithm)) {
+ specBuilder =
+ new KeyProtection.Builder(
+ KeyProperties.PURPOSE_ENCRYPT
+ | KeyProperties.PURPOSE_DECRYPT
+ | KeyProperties.PURPOSE_SIGN
+ | KeyProperties.PURPOSE_VERIFY);
+ specBuilder.setDigests(
+ KeyProperties.DIGEST_NONE,
+ KeyProperties.DIGEST_MD5,
+ KeyProperties.DIGEST_SHA1,
+ KeyProperties.DIGEST_SHA224,
+ KeyProperties.DIGEST_SHA256,
+ KeyProperties.DIGEST_SHA384,
+ KeyProperties.DIGEST_SHA512);
+ specBuilder.setSignaturePaddings(
+ KeyProperties.SIGNATURE_PADDING_RSA_PKCS1);
+ specBuilder.setBlockModes(KeyProperties.BLOCK_MODE_ECB);
+ specBuilder.setEncryptionPaddings(
+ KeyProperties.ENCRYPTION_PADDING_NONE,
+ KeyProperties.ENCRYPTION_PADDING_RSA_PKCS1);
+ // Disable randomized encryption requirement to support encryption padding NONE
+ // above.
+ specBuilder.setRandomizedEncryptionRequired(false);
+ } else {
+ throw new KeyStoreException("Unsupported key algorithm: " + keyAlgorithm);
+ }
+ specBuilder.setEncryptionAtRestRequired(legacySpec.isEncryptionRequired());
+ specBuilder.setUserAuthenticationRequired(false);
+
+ spec = specBuilder.build();
+ } catch (NullPointerException | IllegalArgumentException e) {
+ throw new KeyStoreException("Unsupported protection parameter", e);
+ }
+ } else if (param instanceof KeyProtection) {
+ spec = (KeyProtection) param;
+ } else if (param != null) {
+ throw new KeyStoreException(
+ "Unsupported protection parameter class:" + param.getClass().getName()
+ + ". Supported: " + KeyStoreParameter.class.getName() + ", "
+ + KeyProtection.class.getName());
+ } else {
+ spec = null;
+ }
+
byte[] keyBytes = null;
final String pkeyAlias;
@@ -383,7 +447,7 @@
Credentials.deleteSecretKeyTypeForAlias(mKeyStore, alias);
}
- final int flags = (params == null) ? 0 : params.getFlags();
+ final int flags = (spec == null) ? 0 : spec.getFlags();
if (shouldReplacePrivateKey
&& !mKeyStore.importKey(Credentials.USER_PRIVATE_KEY + alias, keyBytes,
@@ -402,8 +466,16 @@
}
}
- private void setSecretKeyEntry(String entryAlias, SecretKey key, KeyStoreParameter params)
+ private void setSecretKeyEntry(String entryAlias, SecretKey key,
+ java.security.KeyStore.ProtectionParameter param)
throws KeyStoreException {
+ if ((param != null) && (!(param instanceof KeyProtection))) {
+ throw new KeyStoreException(
+ "Unsupported protection parameter class: " + param.getClass().getName()
+ + ". Supported: " + KeyProtection.class.getName());
+ }
+ KeyProtection params = (KeyProtection) param;
+
if (key instanceof KeyStoreSecretKey) {
// KeyStore-backed secret key. It cannot be duplicated into another entry and cannot
// overwrite its own entry.
@@ -453,10 +525,9 @@
int keymasterAlgorithm;
int keymasterDigest;
try {
- keymasterAlgorithm = KeyStoreKeyProperties.KeyAlgorithm.toKeymasterSecretKeyAlgorithm(
- keyAlgorithmString);
- keymasterDigest =
- KeyStoreKeyProperties.KeyAlgorithm.toKeymasterDigest(keyAlgorithmString);
+ keymasterAlgorithm =
+ KeyProperties.KeyAlgorithm.toKeymasterSecretKeyAlgorithm(keyAlgorithmString);
+ keymasterDigest = KeyProperties.KeyAlgorithm.toKeymasterDigest(keyAlgorithmString);
} catch (IllegalArgumentException e) {
throw new KeyStoreException("Unsupported secret key algorithm: " + keyAlgorithmString);
}
@@ -467,7 +538,7 @@
int[] keymasterDigests;
if (params.isDigestsSpecified()) {
// Digest(s) specified in parameters
- keymasterDigests = KeyStoreKeyProperties.Digest.allToKeymaster(params.getDigests());
+ keymasterDigests = KeyProperties.Digest.allToKeymaster(params.getDigests());
if (keymasterDigest != -1) {
// Digest also specified in the JCA key algorithm name.
if (!com.android.internal.util.ArrayUtils.contains(
@@ -476,6 +547,21 @@
+ ". Key: " + keyAlgorithmString
+ ", parameter spec: " + Arrays.asList(params.getDigests()));
}
+ // When the key is read back from keystore we reconstruct the JCA key algorithm
+ // name from the KM_TAG_ALGORITHM and the first KM_TAG_DIGEST. Thus we need to
+ // ensure that the digest reflected in the JCA key algorithm name is the first
+ // KM_TAG_DIGEST tag.
+ if (keymasterDigests[0] != keymasterDigest) {
+ // The first digest is not the one implied by the JCA key algorithm name.
+ // Swap the implied digest with the first one.
+ for (int i = 0; i < keymasterDigests.length; i++) {
+ if (keymasterDigests[i] == keymasterDigest) {
+ keymasterDigests[i] = keymasterDigests[0];
+ keymasterDigests[0] = keymasterDigest;
+ break;
+ }
+ }
+ }
}
} else {
// No digest specified in parameters
@@ -494,33 +580,32 @@
}
}
- @KeyStoreKeyProperties.PurposeEnum int purposes = params.getPurposes();
+ @KeyProperties.PurposeEnum int purposes = params.getPurposes();
int[] keymasterBlockModes =
- KeyStoreKeyProperties.BlockMode.allToKeymaster(params.getBlockModes());
- if (((purposes & KeyStoreKeyProperties.PURPOSE_ENCRYPT) != 0)
+ KeyProperties.BlockMode.allToKeymaster(params.getBlockModes());
+ if (((purposes & KeyProperties.PURPOSE_ENCRYPT) != 0)
&& (params.isRandomizedEncryptionRequired())) {
for (int keymasterBlockMode : keymasterBlockModes) {
if (!KeymasterUtils.isKeymasterBlockModeIndCpaCompatible(keymasterBlockMode)) {
throw new KeyStoreException(
"Randomized encryption (IND-CPA) required but may be violated by block"
+ " mode: "
- + KeyStoreKeyProperties.BlockMode.fromKeymaster(keymasterBlockMode)
- + ". See KeyStoreParameter documentation.");
+ + KeyProperties.BlockMode.fromKeymaster(keymasterBlockMode)
+ + ". See KeyProtection documentation.");
}
}
}
- for (int keymasterPurpose : KeyStoreKeyProperties.Purpose.allToKeymaster(purposes)) {
+ for (int keymasterPurpose : KeyProperties.Purpose.allToKeymaster(purposes)) {
args.addInt(KeymasterDefs.KM_TAG_PURPOSE, keymasterPurpose);
}
args.addInts(KeymasterDefs.KM_TAG_BLOCK_MODE, keymasterBlockModes);
if (params.getSignaturePaddings().length > 0) {
throw new KeyStoreException("Signature paddings not supported for symmetric keys");
}
- int[] keymasterPaddings = KeyStoreKeyProperties.EncryptionPadding.allToKeymaster(
+ int[] keymasterPaddings = KeyProperties.EncryptionPadding.allToKeymaster(
params.getEncryptionPaddings());
args.addInts(KeymasterDefs.KM_TAG_PADDING, keymasterPaddings);
KeymasterUtils.addUserAuthArgs(args,
- params.getContext(),
params.isUserAuthenticationRequired(),
params.getUserAuthenticationValidityDurationSeconds());
args.addDate(KeymasterDefs.KM_TAG_ACTIVE_DATETIME,
@@ -536,7 +621,7 @@
// TODO: Remove this once keymaster does not require us to specify the size of imported key.
args.addInt(KeymasterDefs.KM_TAG_KEY_SIZE, keyMaterial.length * 8);
- if (((purposes & KeyStoreKeyProperties.PURPOSE_ENCRYPT) != 0)
+ if (((purposes & KeyProperties.PURPOSE_ENCRYPT) != 0)
&& (!params.isRandomizedEncryptionRequired())) {
// Permit caller-provided IV when encrypting with this key
args.addBoolean(KeymasterDefs.KM_TAG_CALLER_NONCE);
@@ -774,19 +859,12 @@
return;
}
- if (param != null && !(param instanceof KeyStoreParameter)) {
- throw new KeyStoreException(
- "protParam should be android.security.KeyStoreParameter; was: "
- + param.getClass().getName());
- }
-
if (entry instanceof PrivateKeyEntry) {
PrivateKeyEntry prE = (PrivateKeyEntry) entry;
- setPrivateKeyEntry(alias, prE.getPrivateKey(), prE.getCertificateChain(),
- (KeyStoreParameter) param);
+ setPrivateKeyEntry(alias, prE.getPrivateKey(), prE.getCertificateChain(), param);
} else if (entry instanceof SecretKeyEntry) {
SecretKeyEntry secE = (SecretKeyEntry) entry;
- setSecretKeyEntry(alias, secE.getSecretKey(), (KeyStoreParameter) param);
+ setSecretKeyEntry(alias, secE.getSecretKey(), param);
} else {
throw new KeyStoreException(
"Entry must be a PrivateKeyEntry, SecretKeyEntry or TrustedCertificateEntry"
diff --git a/keystore/java/android/security/ArrayUtils.java b/keystore/java/android/security/ArrayUtils.java
index 2047d3f..71b99d0 100644
--- a/keystore/java/android/security/ArrayUtils.java
+++ b/keystore/java/android/security/ArrayUtils.java
@@ -5,7 +5,7 @@
/**
* @hide
*/
-abstract class ArrayUtils {
+public abstract class ArrayUtils {
private ArrayUtils() {}
public static String[] nullToEmpty(String[] array) {
diff --git a/keystore/java/android/security/KeyChain.java b/keystore/java/android/security/KeyChain.java
index 3853eca..19b62a6 100644
--- a/keystore/java/android/security/KeyChain.java
+++ b/keystore/java/android/security/KeyChain.java
@@ -28,6 +28,8 @@
import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
+import android.security.keystore.KeyProperties;
+
import java.io.ByteArrayInputStream;
import java.io.Closeable;
import java.security.InvalidKeyException;
@@ -266,7 +268,7 @@
*/
public static void choosePrivateKeyAlias(@NonNull Activity activity,
@NonNull KeyChainAliasCallback response,
- @KeyStoreKeyProperties.KeyAlgorithmEnum String[] keyTypes, Principal[] issuers,
+ @KeyProperties.KeyAlgorithmEnum String[] keyTypes, Principal[] issuers,
@Nullable String host, int port, @Nullable String alias) {
choosePrivateKeyAlias(activity, response, keyTypes, issuers, host, port, null, alias);
}
@@ -312,7 +314,7 @@
*/
public static void choosePrivateKeyAlias(@NonNull Activity activity,
@NonNull KeyChainAliasCallback response,
- @KeyStoreKeyProperties.KeyAlgorithmEnum String[] keyTypes, Principal[] issuers,
+ @KeyProperties.KeyAlgorithmEnum String[] keyTypes, Principal[] issuers,
@Nullable String host, int port, @Nullable String url, @Nullable String alias) {
/*
* TODO currently keyTypes, issuers are unused. They are meant
@@ -439,10 +441,10 @@
* "RSA").
*/
public static boolean isKeyAlgorithmSupported(
- @NonNull @KeyStoreKeyProperties.KeyAlgorithmEnum String algorithm) {
+ @NonNull @KeyProperties.KeyAlgorithmEnum String algorithm) {
final String algUpper = algorithm.toUpperCase(Locale.US);
- return KeyStoreKeyProperties.KEY_ALGORITHM_EC.equals(algUpper)
- || KeyStoreKeyProperties.KEY_ALGORITHM_RSA.equals(algUpper);
+ return KeyProperties.KEY_ALGORITHM_EC.equals(algUpper)
+ || KeyProperties.KEY_ALGORITHM_RSA.equals(algUpper);
}
/**
@@ -453,7 +455,7 @@
* that makes it non-exportable.
*/
public static boolean isBoundKeyAlgorithm(
- @NonNull @KeyStoreKeyProperties.KeyAlgorithmEnum String algorithm) {
+ @NonNull @KeyProperties.KeyAlgorithmEnum String algorithm) {
if (!isKeyAlgorithmSupported(algorithm)) {
return false;
}
diff --git a/keystore/java/android/security/KeyGeneratorSpec.java b/keystore/java/android/security/KeyGeneratorSpec.java
deleted file mode 100644
index e63566b..0000000
--- a/keystore/java/android/security/KeyGeneratorSpec.java
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.security;
-
-import android.annotation.IntRange;
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.app.KeyguardManager;
-import android.content.Context;
-import android.text.TextUtils;
-
-import java.security.spec.AlgorithmParameterSpec;
-import java.util.Date;
-
-import javax.crypto.Cipher;
-import javax.crypto.KeyGenerator;
-
-/**
- * {@link AlgorithmParameterSpec} for initializing a {@link KeyGenerator} of the
- * <a href="{@docRoot}training/articles/keystore.html">Android KeyStore facility</a>. This class
- * specifies whether user authentication is required for using the key, what uses the key is
- * authorized for (e.g., only in {@code CBC} mode), whether the key should be encrypted at rest, the
- * key's and validity start and end dates.
- *
- * <p>To generate a key, create an instance of this class using the {@link Builder}, initialize a
- * {@code KeyGenerator} of the desired key type (e.g., {@code AES} or {@code HmacSHA256}) from the
- * {@code AndroidKeyStore} provider with the {@code KeyGeneratorSpec} instance, and then generate a
- * key using {@link KeyGenerator#generateKey()}.
- *
- * <p>The generated key will be returned by the {@code KeyGenerator} and also stored in the Android
- * KeyStore under the alias specified in this {@code KeyGeneratorSpec}. To obtain the key from the
- * Android KeyStore use
- * {@link java.security.KeyStore#getKey(String, char[]) KeyStore.getKey(String, null)} or
- * {@link java.security.KeyStore#getEntry(String, java.security.KeyStore.ProtectionParameter) KeyStore.getEntry(String, null)}.
- *
- * <p>NOTE: The key material of the keys generating using the {@code KeyGeneratorSpec} is not
- * accessible.
- *
- * <p><h3>Example</h3>
- * The following example illustrates how to generate an HMAC key in the Android KeyStore under alias
- * {@code key1} authorized to be used only for HMAC with SHA-256 digest and only if the user has
- * been authenticated within the last five minutes.
- * <pre> {@code
- * KeyGenerator keyGenerator = KeyGenerator.getInstance(
- * KeyStoreKeyProperties.KEY_ALGORITHM_HMAC_SHA256,
- * "AndroidKeyStore");
- * keyGenerator.initialize(
- * new KeyGeneratorSpec.Builder(context)
- * .setAlias("key1")
- * .setPurposes(KeyStoreKeyProperties.PURPOSE_SIGN
- * | KeyStoreKeyProperties.PURPOSE_VERIFY)
- * // Only permit this key to be used if the user authenticated
- * // within the last five minutes.
- * .setUserAuthenticationRequired(true)
- * .setUserAuthenticationValidityDurationSeconds(5 * 60)
- * .build());
- * SecretKey key = keyGenerator.generateKey();
- *
- * // The key can also be obtained from the Android KeyStore any time as follows:
- * KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
- * keyStore.load(null);
- * SecretKey key = (SecretKey) keyStore.getKey("key1", null);
- * }</pre>
- */
-public class KeyGeneratorSpec implements AlgorithmParameterSpec {
-
- private final Context mContext;
- private final String mKeystoreAlias;
- private final int mFlags;
- private final int mKeySize;
- private final Date mKeyValidityStart;
- private final Date mKeyValidityForOriginationEnd;
- private final Date mKeyValidityForConsumptionEnd;
- private final @KeyStoreKeyProperties.PurposeEnum int mPurposes;
- private final @KeyStoreKeyProperties.EncryptionPaddingEnum String[] mEncryptionPaddings;
- private final @KeyStoreKeyProperties.BlockModeEnum String[] mBlockModes;
- private final boolean mRandomizedEncryptionRequired;
- private final boolean mUserAuthenticationRequired;
- private final int mUserAuthenticationValidityDurationSeconds;
-
- private KeyGeneratorSpec(
- Context context,
- String keyStoreAlias,
- int flags,
- int keySize,
- Date keyValidityStart,
- Date keyValidityForOriginationEnd,
- Date keyValidityForConsumptionEnd,
- @KeyStoreKeyProperties.PurposeEnum int purposes,
- @KeyStoreKeyProperties.EncryptionPaddingEnum String[] encryptionPaddings,
- @KeyStoreKeyProperties.BlockModeEnum String[] blockModes,
- boolean randomizedEncryptionRequired,
- boolean userAuthenticationRequired,
- int userAuthenticationValidityDurationSeconds) {
- if (context == null) {
- throw new IllegalArgumentException("context == null");
- } else if (TextUtils.isEmpty(keyStoreAlias)) {
- throw new IllegalArgumentException("keyStoreAlias must not be empty");
- } else if ((userAuthenticationValidityDurationSeconds < 0)
- && (userAuthenticationValidityDurationSeconds != -1)) {
- throw new IllegalArgumentException(
- "userAuthenticationValidityDurationSeconds must not be negative");
- }
-
- mContext = context;
- mKeystoreAlias = keyStoreAlias;
- mFlags = flags;
- mKeySize = keySize;
- mKeyValidityStart = keyValidityStart;
- mKeyValidityForOriginationEnd = keyValidityForOriginationEnd;
- mKeyValidityForConsumptionEnd = keyValidityForConsumptionEnd;
- mPurposes = purposes;
- mEncryptionPaddings =
- ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(encryptionPaddings));
- mBlockModes = ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(blockModes));
- mRandomizedEncryptionRequired = randomizedEncryptionRequired;
- mUserAuthenticationRequired = userAuthenticationRequired;
- mUserAuthenticationValidityDurationSeconds = userAuthenticationValidityDurationSeconds;
- }
-
- /**
- * Gets the Android context used for operations with this instance.
- */
- public Context getContext() {
- return mContext;
- }
-
- /**
- * Returns the alias that will be used in the {@code java.security.KeyStore} in conjunction with
- * the {@code AndroidKeyStore}.
- */
- public String getKeystoreAlias() {
- return mKeystoreAlias;
- }
-
- /**
- * @hide
- */
- public int getFlags() {
- return mFlags;
- }
-
- /**
- * Returns the requested key size or {@code -1} if default size should be used.
- */
- public int getKeySize() {
- return mKeySize;
- }
-
- /**
- * Gets the time instant before which the key is not yet valid.
- *
- * @return instant or {@code null} if not restricted.
- */
- @Nullable
- public Date getKeyValidityStart() {
- return mKeyValidityStart;
- }
-
- /**
- * Gets the time instant after which the key is no longer valid for decryption and verification.
- *
- * @return instant or {@code null} if not restricted.
- */
- @Nullable
- public Date getKeyValidityForConsumptionEnd() {
- return mKeyValidityForConsumptionEnd;
- }
-
- /**
- * Gets the time instant after which the key is no longer valid for encryption and signing.
- *
- * @return instant or {@code null} if not restricted.
- */
- @Nullable
- public Date getKeyValidityForOriginationEnd() {
- return mKeyValidityForOriginationEnd;
- }
-
- /**
- * Gets the set of purposes (e.g., encrypt, decrypt, sign) for which the key can be used.
- * Attempts to use the key for any other purpose will be rejected.
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code PURPOSE} flags.
- */
- public @KeyStoreKeyProperties.PurposeEnum int getPurposes() {
- return mPurposes;
- }
-
- /**
- * Gets the set of padding schemes (e.g., {@code PKCS7Padding}, {@code NoPadding}) with
- * which the key can be used when encrypting/decrypting. Attempts to use the key with any
- * other padding scheme will be rejected.
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code ENCRYPTION_PADDING} constants.
- */
- @NonNull
- public @KeyStoreKeyProperties.EncryptionPaddingEnum String[] getEncryptionPaddings() {
- return ArrayUtils.cloneIfNotEmpty(mEncryptionPaddings);
- }
-
- /**
- * Gets the set of block modes (e.g., {@code CBC}, {@code CTR}) with which the key can be used
- * when encrypting/decrypting. Attempts to use the key with any other block modes will be
- * rejected.
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code BLOCK_MODE} constants.
- */
- @NonNull
- public @KeyStoreKeyProperties.BlockModeEnum String[] getBlockModes() {
- return ArrayUtils.cloneIfNotEmpty(mBlockModes);
- }
-
- /**
- * Returns {@code true} if encryption using this key must be sufficiently randomized to produce
- * different ciphertexts for the same plaintext every time. The formal cryptographic property
- * being required is <em>indistinguishability under chosen-plaintext attack ({@code
- * IND-CPA})</em>. This property is important because it mitigates several classes of
- * weaknesses due to which ciphertext may leak information about plaintext. For example, if a
- * given plaintext always produces the same ciphertext, an attacker may see the repeated
- * ciphertexts and be able to deduce something about the plaintext.
- */
- public boolean isRandomizedEncryptionRequired() {
- return mRandomizedEncryptionRequired;
- }
-
- /**
- * Returns {@code true} if user authentication is required for this key to be used.
- *
- * @see #getUserAuthenticationValidityDurationSeconds()
- */
- public boolean isUserAuthenticationRequired() {
- return mUserAuthenticationRequired;
- }
-
- /**
- * Gets the duration of time (seconds) for which this key can be used after the user is
- * successfully authenticated. This has effect only if user authentication is required.
- *
- * @return duration in seconds or {@code -1} if authentication is required for every use of the
- * key.
- *
- * @see #isUserAuthenticationRequired()
- */
- public int getUserAuthenticationValidityDurationSeconds() {
- return mUserAuthenticationValidityDurationSeconds;
- }
-
- /**
- * Returns {@code true} if the key must be encrypted at rest. This will protect the key with the
- * secure lock screen credential (e.g., password, PIN, or pattern).
- */
- public boolean isEncryptionRequired() {
- return (mFlags & KeyStore.FLAG_ENCRYPTED) != 0;
- }
-
- public static class Builder {
- private final Context mContext;
- private String mKeystoreAlias;
- private int mFlags;
- private int mKeySize = -1;
- private Date mKeyValidityStart;
- private Date mKeyValidityForOriginationEnd;
- private Date mKeyValidityForConsumptionEnd;
- private @KeyStoreKeyProperties.PurposeEnum int mPurposes;
- private @KeyStoreKeyProperties.EncryptionPaddingEnum String[] mEncryptionPaddings;
- private @KeyStoreKeyProperties.BlockModeEnum String[] mBlockModes;
- private boolean mRandomizedEncryptionRequired = true;
- private boolean mUserAuthenticationRequired;
- private int mUserAuthenticationValidityDurationSeconds = -1;
-
- /**
- * Creates a new instance of the {@code Builder} with the given {@code context}. The
- * {@code context} passed in may be used to pop up some UI to ask the user to unlock or
- * initialize the Android KeyStore facility.
- */
- public Builder(@NonNull Context context) {
- if (context == null) {
- throw new NullPointerException("context == null");
- }
- mContext = context;
- }
-
- /**
- * Sets the alias to be used to retrieve the key later from a {@link java.security.KeyStore}
- * instance using the {@code AndroidKeyStore} provider.
- *
- * <p>The alias must be provided. There is no default.
- */
- @NonNull
- public Builder setAlias(@NonNull String alias) {
- if (alias == null) {
- throw new NullPointerException("alias == null");
- }
- mKeystoreAlias = alias;
- return this;
- }
-
- /**
- * Sets the size (in bits) of the key to be generated.
- *
- * <p>By default, the key size will be determines based on the key algorithm. For example,
- * for {@code HmacSHA256}, the key size will default to {@code 256}.
- */
- @NonNull
- public Builder setKeySize(int keySize) {
- mKeySize = keySize;
- return this;
- }
-
- /**
- * Indicates that this key must be encrypted at rest. This will protect the key with the
- * secure lock screen credential (e.g., password, PIN, or pattern).
- *
- * <p>Note that this feature requires that the secure lock screen (e.g., password, PIN,
- * pattern) is set up, otherwise key generation will fail. Moreover, this key will be
- * deleted when the secure lock screen is disabled or reset (e.g., by the user or a Device
- * Administrator). Finally, this key cannot be used until the user unlocks the secure lock
- * screen after boot.
- *
- * @see KeyguardManager#isDeviceSecure()
- */
- @NonNull
- public Builder setEncryptionRequired() {
- mFlags |= KeyStore.FLAG_ENCRYPTED;
- return this;
- }
-
- /**
- * Sets the time instant before which the key is not yet valid.
- *
- * <p>By default, the key is valid at any instant.
- *
- * @see #setKeyValidityEnd(Date)
- */
- @NonNull
- public Builder setKeyValidityStart(Date startDate) {
- mKeyValidityStart = startDate;
- return this;
- }
-
- /**
- * Sets the time instant after which the key is no longer valid.
- *
- * <p>By default, the key is valid at any instant.
- *
- * @see #setKeyValidityStart(Date)
- * @see #setKeyValidityForConsumptionEnd(Date)
- * @see #setKeyValidityForOriginationEnd(Date)
- */
- @NonNull
- public Builder setKeyValidityEnd(Date endDate) {
- setKeyValidityForOriginationEnd(endDate);
- setKeyValidityForConsumptionEnd(endDate);
- return this;
- }
-
- /**
- * Sets the time instant after which the key is no longer valid for encryption and signing.
- *
- * <p>By default, the key is valid at any instant.
- *
- * @see #setKeyValidityForConsumptionEnd(Date)
- */
- @NonNull
- public Builder setKeyValidityForOriginationEnd(Date endDate) {
- mKeyValidityForOriginationEnd = endDate;
- return this;
- }
-
- /**
- * Sets the time instant after which the key is no longer valid for decryption and
- * verification.
- *
- * <p>By default, the key is valid at any instant.
- *
- * @see #setKeyValidityForOriginationEnd(Date)
- */
- @NonNull
- public Builder setKeyValidityForConsumptionEnd(Date endDate) {
- mKeyValidityForConsumptionEnd = endDate;
- return this;
- }
-
- /**
- * Sets the set of purposes (e.g., encrypt, decrypt, sign) for which the key can be used.
- * Attempts to use the key for any other purpose will be rejected.
- *
- * <p>This must be specified for all keys. There is no default.
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code PURPOSE} flags.
- */
- @NonNull
- public Builder setPurposes(@KeyStoreKeyProperties.PurposeEnum int purposes) {
- mPurposes = purposes;
- return this;
- }
-
- /**
- * Sets the set of padding schemes (e.g., {@code PKCS7Padding}, {@code NoPadding}) with
- * which the key can be used when encrypting/decrypting. Attempts to use the key with any
- * other padding scheme will be rejected.
- *
- * <p>This must be specified for keys which are used for encryption/decryption.
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code ENCRYPTION_PADDING} constants.
- */
- @NonNull
- public Builder setEncryptionPaddings(
- @KeyStoreKeyProperties.EncryptionPaddingEnum String... paddings) {
- mEncryptionPaddings = ArrayUtils.cloneIfNotEmpty(paddings);
- return this;
- }
-
- /**
- * Sets the set of block modes (e.g., {@code CBC}, {@code CTR}) with which the key can be
- * used when encrypting/decrypting. Attempts to use the key with any other block modes will
- * be rejected.
- *
- * <p>This must be specified for encryption/decryption keys.
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code BLOCK_MODE} constants.
- */
- @NonNull
- public Builder setBlockModes(@KeyStoreKeyProperties.BlockModeEnum String... blockModes) {
- mBlockModes = ArrayUtils.cloneIfNotEmpty(blockModes);
- return this;
- }
-
- /**
- * Sets whether encryption using this key must be sufficiently randomized to produce
- * different ciphertexts for the same plaintext every time. The formal cryptographic
- * property being required is <em>indistinguishability under chosen-plaintext attack
- * ({@code IND-CPA})</em>. This property is important because it mitigates several classes
- * of weaknesses due to which ciphertext may leak information about plaintext. For example,
- * if a given plaintext always produces the same ciphertext, an attacker may see the
- * repeated ciphertexts and be able to deduce something about the plaintext.
- *
- * <p>By default, {@code IND-CPA} is required.
- *
- * <p>When {@code IND-CPA} is required:
- * <ul>
- * <li>block modes which do not offer {@code IND-CPA}, such as {@code ECB}, are prohibited;
- * </li>
- * <li>in block modes which use an IV, such as {@code CBC}, {@code CTR}, and {@code GCM},
- * caller-provided IVs are rejected when encrypting, to ensure that only random IVs are
- * used.</li>
- *
- * <p>Before disabling this requirement, consider the following approaches instead:
- * <ul>
- * <li>If you are generating a random IV for encryption and then initializing a {@code}
- * Cipher using the IV, the solution is to let the {@code Cipher} generate a random IV
- * instead. This will occur if the {@code Cipher} is initialized for encryption without an
- * IV. The IV can then be queried via {@link Cipher#getIV()}.</li>
- * <li>If you are generating a non-random IV (e.g., an IV derived from something not fully
- * random, such as the name of the file being encrypted, or transaction ID, or password,
- * or a device identifier), consider changing your design to use a random IV which will then
- * be provided in addition to the ciphertext to the entities which need to decrypt the
- * ciphertext.</li>
- * </ul>
- */
- @NonNull
- public Builder setRandomizedEncryptionRequired(boolean required) {
- mRandomizedEncryptionRequired = required;
- return this;
- }
-
- /**
- * Sets whether user authentication is required to use this key.
- *
- * <p>By default, the key can be used without user authentication.
- *
- * <p>When user authentication is required, the user authorizes the use of the key by
- * authenticating to this Android device using a subset of their secure lock screen
- * credentials. Different authentication methods are used depending on whether the every
- * use of the key must be authenticated (as specified by
- * {@link #setUserAuthenticationValidityDurationSeconds(int)}).
- * <a href="{@docRoot}training/articles/keystore.html#UserAuthentication">More
- * information</a>.
- *
- * @see #setUserAuthenticationValidityDurationSeconds(int)
- */
- @NonNull
- public Builder setUserAuthenticationRequired(boolean required) {
- mUserAuthenticationRequired = required;
- return this;
- }
-
- /**
- * Sets the duration of time (seconds) for which this key can be used after the user is
- * successfully authenticated. This has effect only if user authentication is required.
- *
- * <p>By default, the user needs to authenticate for every use of the key.
- *
- * @param seconds duration in seconds or {@code -1} if the user needs to authenticate for
- * every use of the key.
- *
- * @see #setUserAuthenticationRequired(boolean)
- */
- @NonNull
- public Builder setUserAuthenticationValidityDurationSeconds(
- @IntRange(from = -1) int seconds) {
- mUserAuthenticationValidityDurationSeconds = seconds;
- return this;
- }
-
- /**
- * Builds a new instance instance of {@code KeyGeneratorSpec}.
- *
- * @throws IllegalArgumentException if a required field is missing or violates a constraint.
- */
- @NonNull
- public KeyGeneratorSpec build() {
- return new KeyGeneratorSpec(mContext,
- mKeystoreAlias,
- mFlags,
- mKeySize,
- mKeyValidityStart,
- mKeyValidityForOriginationEnd,
- mKeyValidityForConsumptionEnd,
- mPurposes,
- mEncryptionPaddings,
- mBlockModes,
- mRandomizedEncryptionRequired,
- mUserAuthenticationRequired,
- mUserAuthenticationValidityDurationSeconds);
- }
- }
-}
diff --git a/keystore/java/android/security/KeyPairGeneratorSpec.java b/keystore/java/android/security/KeyPairGeneratorSpec.java
index b07c052..efbce41 100644
--- a/keystore/java/android/security/KeyPairGeneratorSpec.java
+++ b/keystore/java/android/security/KeyPairGeneratorSpec.java
@@ -17,14 +17,14 @@
package android.security;
import android.app.KeyguardManager;
-import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
+import android.security.keystore.KeyGenParameterSpec;
+import android.security.keystore.KeyProperties;
import android.text.TextUtils;
import java.math.BigInteger;
-import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.cert.Certificate;
@@ -34,72 +34,32 @@
import javax.security.auth.x500.X500Principal;
/**
- * {@link AlgorithmParameterSpec} for initializing a {@link KeyPairGenerator} of the
- * <a href="{@docRoot}training/articles/keystore.html">Android KeyStore facility</a>. This class
- * specifies whether user authentication is required for using the private key, what uses the
- * private key is authorized for (e.g., only for signing -- decryption not permitted), whether the
- * private key should be encrypted at rest, the private key's and validity start and end dates.
+ * This provides the required parameters needed for initializing the
+ * {@code KeyPairGenerator} that works with
+ * <a href="{@docRoot}training/articles/keystore.html">Android KeyStore
+ * facility</a>. The Android KeyStore facility is accessed through a
+ * {@link java.security.KeyPairGenerator} API using the {@code AndroidKeyStore}
+ * provider. The {@code context} passed in may be used to pop up some UI to ask
+ * the user to unlock or initialize the Android KeyStore facility.
+ * <p>
+ * After generation, the {@code keyStoreAlias} is used with the
+ * {@link java.security.KeyStore#getEntry(String, java.security.KeyStore.ProtectionParameter)}
+ * interface to retrieve the {@link PrivateKey} and its associated
+ * {@link Certificate} chain.
+ * <p>
+ * The KeyPair generator will create a self-signed certificate with the subject
+ * as its X.509v3 Subject Distinguished Name and as its X.509v3 Issuer
+ * Distinguished Name along with the other parameters specified with the
+ * {@link Builder}.
+ * <p>
+ * The self-signed X.509 certificate may be replaced at a later time by a
+ * certificate signed by a real Certificate Authority.
*
- * <p>To generate a key pair, create an instance of this class using the {@link Builder}, initialize
- * a {@code KeyPairGenerator} of the desired key type (e.g., {@code EC} or {@code RSA}) from the
- * {@code AndroidKeyStore} provider with the {@code KeyPairGeneratorSpec} instance, and then
- * generate a key pair using {@link KeyPairGenerator#generateKeyPair()}.
- *
- * <p>The generated key pair will be returned by the {@code KeyPairGenerator} and also stored in the
- * Android KeyStore under the alias specified in this {@code KeyPairGeneratorSpec}. To obtain the
- * private key from the Android KeyStore use
- * {@link java.security.KeyStore#getKey(String, char[]) KeyStore.getKey(String, null)} or
- * {@link java.security.KeyStore#getEntry(String, java.security.KeyStore.ProtectionParameter) KeyStore.getEntry(String, null)}.
- * To obtain the public key from the Android KeyStore use
- * {@link java.security.KeyStore#getCertificate(String)} and then
- * {@link Certificate#getPublicKey()}.
- *
- * <p>A self-signed X.509 certificate will be also generated and stored in the Android KeyStore.
- * This is because the {@link java.security.KeyStore} abstraction does not support storing key pairs
- * without a certificate. The subject, serial number, and validity dates of the certificate can be
- * specified in this {@code KeyPairGeneratorSpec}. The self-signed certificate may be replaced at a
- * later time by a certificate signed by a Certificate Authority (CA).
- *
- * <p>NOTE: The key material of the private keys generating using the {@code KeyPairGeneratorSpec}
- * is not accessible. The key material of the public keys is accessible.
- *
- * <p><h3>Example</h3>
- * The following example illustrates how to generate an EC key pair in the Android KeyStore under
- * alias {@code key2} authorized to be used only for signing using SHA-256, SHA-384, or SHA-512
- * digest and only if the user has been authenticated within the last five minutes.
- * <pre> {@code
- * KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(
- * KeyStoreKeyProperties.KEY_ALGORITHM_EC,
- * "AndroidKeyStore");
- * keyPairGenerator.initialize(
- * new KeyGeneratorSpec.Builder(context)
- * .setAlias("key2")
- * .setPurposes(KeyStoreKeyProperties.PURPOSE_SIGN
- * | KeyStoreKeyProperties.PURPOSE_VERIFY)
- * .setDigests(KeyStoreKeyProperties.DIGEST_SHA256
- * | KeyStoreKeyProperties.DIGEST_SHA384
- * | KeyStoreKeyProperties.DIGEST_SHA512)
- * // Only permit this key to be used if the user authenticated
- * // within the last five minutes.
- * .setUserAuthenticationRequired(true)
- * .setUserAuthenticationValidityDurationSeconds(5 * 60)
- * .build());
- * KeyPair keyPair = keyPairGenerator.generateKey();
- *
- * // The key pair can also be obtained from the Android KeyStore any time as follows:
- * KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
- * keyStore.load(null);
- * PrivateKey privateKey = (PrivateKey) keyStore.getKey("key2", null);
- * PublicKey publicKey = keyStore.getCertificate("key2").getPublicKey();
- * }</pre>
+ * @deprecated Use {@link KeyGenParameterSpec} instead.
*/
+@Deprecated
public final class KeyPairGeneratorSpec implements AlgorithmParameterSpec {
- private static final X500Principal DEFAULT_CERT_SUBJECT = new X500Principal("CN=fake");
- private static final BigInteger DEFAULT_CERT_SERIAL_NUMBER = new BigInteger("1");
- private static final Date DEFAULT_CERT_NOT_BEFORE = new Date(0L); // Jan 1 1970
- private static final Date DEFAULT_CERT_NOT_AFTER = new Date(2461449600000L); // Jan 1 2048
-
private final Context mContext;
private final String mKeystoreAlias;
@@ -120,28 +80,6 @@
private final int mFlags;
- private final Date mKeyValidityStart;
-
- private final Date mKeyValidityForOriginationEnd;
-
- private final Date mKeyValidityForConsumptionEnd;
-
- private final @KeyStoreKeyProperties.PurposeEnum int mPurposes;
-
- private final @KeyStoreKeyProperties.DigestEnum String[] mDigests;
-
- private final @KeyStoreKeyProperties.EncryptionPaddingEnum String[] mEncryptionPaddings;
-
- private final @KeyStoreKeyProperties.SignaturePaddingEnum String[] mSignaturePaddings;
-
- private final @KeyStoreKeyProperties.BlockModeEnum String[] mBlockModes;
-
- private final boolean mRandomizedEncryptionRequired;
-
- private final boolean mUserAuthenticationRequired;
-
- private final int mUserAuthenticationValidityDurationSeconds;
-
/**
* Parameter specification for the "{@code AndroidKeyPairGenerator}"
* instance of the {@link java.security.KeyPairGenerator} API. The
@@ -162,7 +100,7 @@
* @param context Android context for the activity
* @param keyStoreAlias name to use for the generated key in the Android
* keystore
- * @param keyType key algorithm to use (EC, RSA)
+ * @param keyType key algorithm to use (RSA, DSA, EC)
* @param keySize size of key to generate
* @param spec the underlying key type parameters
* @param subjectDN X.509 v3 Subject Distinguished Name
@@ -176,39 +114,21 @@
*/
public KeyPairGeneratorSpec(Context context, String keyStoreAlias, String keyType, int keySize,
AlgorithmParameterSpec spec, X500Principal subjectDN, BigInteger serialNumber,
- Date startDate, Date endDate, int flags,
- Date keyValidityStart,
- Date keyValidityForOriginationEnd,
- Date keyValidityForConsumptionEnd,
- @KeyStoreKeyProperties.PurposeEnum int purposes,
- @KeyStoreKeyProperties.DigestEnum String[] digests,
- @KeyStoreKeyProperties.EncryptionPaddingEnum String[] encryptionPaddings,
- @KeyStoreKeyProperties.SignaturePaddingEnum String[] signaturePaddings,
- @KeyStoreKeyProperties.BlockModeEnum String[] blockModes,
- boolean randomizedEncryptionRequired,
- boolean userAuthenticationRequired,
- int userAuthenticationValidityDurationSeconds) {
+ Date startDate, Date endDate, int flags) {
if (context == null) {
throw new IllegalArgumentException("context == null");
} else if (TextUtils.isEmpty(keyStoreAlias)) {
throw new IllegalArgumentException("keyStoreAlias must not be empty");
- } else if ((userAuthenticationValidityDurationSeconds < 0)
- && (userAuthenticationValidityDurationSeconds != -1)) {
- throw new IllegalArgumentException(
- "userAuthenticationValidityDurationSeconds must not be negative");
- }
-
- if (subjectDN == null) {
- subjectDN = DEFAULT_CERT_SUBJECT;
- }
- if (startDate == null) {
- startDate = DEFAULT_CERT_NOT_BEFORE;
- }
- if (endDate == null) {
- endDate = DEFAULT_CERT_NOT_AFTER;
- }
- if (serialNumber == null) {
- serialNumber = DEFAULT_CERT_SERIAL_NUMBER;
+ } else if (subjectDN == null) {
+ throw new IllegalArgumentException("subjectDN == null");
+ } else if (serialNumber == null) {
+ throw new IllegalArgumentException("serialNumber == null");
+ } else if (startDate == null) {
+ throw new IllegalArgumentException("startDate == null");
+ } else if (endDate == null) {
+ throw new IllegalArgumentException("endDate == null");
+ } else if (endDate.before(startDate)) {
+ throw new IllegalArgumentException("endDate < startDate");
}
if (endDate.before(startDate)) {
@@ -225,50 +145,6 @@
mStartDate = startDate;
mEndDate = endDate;
mFlags = flags;
- mKeyValidityStart = keyValidityStart;
- mKeyValidityForOriginationEnd = keyValidityForOriginationEnd;
- mKeyValidityForConsumptionEnd = keyValidityForConsumptionEnd;
- mPurposes = purposes;
- mDigests = ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(digests));
- mEncryptionPaddings =
- ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(encryptionPaddings));
- mSignaturePaddings = ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(signaturePaddings));
- mBlockModes = ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(blockModes));
- mRandomizedEncryptionRequired = randomizedEncryptionRequired;
- mUserAuthenticationRequired = userAuthenticationRequired;
- mUserAuthenticationValidityDurationSeconds = userAuthenticationValidityDurationSeconds;
- }
-
- /**
- * TODO: Remove this constructor once tests are switched over to the new one above.
- * @hide
- */
- public KeyPairGeneratorSpec(Context context, String keyStoreAlias, String keyType, int keySize,
- AlgorithmParameterSpec spec, X500Principal subjectDN, BigInteger serialNumber,
- Date startDate, Date endDate, int flags) {
-
- this(context,
- keyStoreAlias,
- keyType,
- keySize,
- spec,
- subjectDN,
- serialNumber,
- startDate,
- endDate,
- flags,
- startDate,
- endDate,
- endDate,
- 0, // purposes
- null, // digests
- null, // encryption paddings
- null, // signature paddings
- null, // block modes
- false, // randomized encryption required
- false, // user authentication required
- -1 // user authentication validity duration (seconds)
- );
}
/**
@@ -288,10 +164,10 @@
/**
* Returns the type of key pair (e.g., {@code EC}, {@code RSA}) to be generated. See
- * {@link KeyStoreKeyProperties}.{@code KEY_ALGORITHM} constants.
+ * {@link KeyProperties}.{@code KEY_ALGORITHM} constants.
*/
@Nullable
- public @KeyStoreKeyProperties.KeyAlgorithmEnum String getKeyType() {
+ public @KeyProperties.KeyAlgorithmEnum String getKeyType() {
return mKeyType;
}
@@ -352,148 +228,27 @@
/**
* @hide
*/
- int getFlags() {
+ public int getFlags() {
return mFlags;
}
/**
* Returns {@code true} if the key must be encrypted at rest. This will protect the key pair
* with the secure lock screen credential (e.g., password, PIN, or pattern).
+ *
+ * <p>Note that encrypting the key at rest requires that the secure lock screen (e.g., password,
+ * PIN, pattern) is set up, otherwise key generation will fail. Moreover, this key will be
+ * deleted when the secure lock screen is disabled or reset (e.g., by the user or a Device
+ * Administrator). Finally, this key cannot be used until the user unlocks the secure lock
+ * screen after boot.
+ *
+ * @see KeyguardManager#isDeviceSecure()
*/
public boolean isEncryptionRequired() {
return (mFlags & KeyStore.FLAG_ENCRYPTED) != 0;
}
/**
- * Gets the time instant before which the key pair is not yet valid.
- *
- * @return instant or {@code null} if not restricted.
- */
- @Nullable
- public Date getKeyValidityStart() {
- return mKeyValidityStart;
- }
-
- /**
- * Gets the time instant after which the key pair is no longer valid for decryption and
- * verification.
- *
- * @return instant or {@code null} if not restricted.
- */
- @Nullable
- public Date getKeyValidityForConsumptionEnd() {
- return mKeyValidityForConsumptionEnd;
- }
-
- /**
- * Gets the time instant after which the key pair is no longer valid for encryption and signing.
- *
- * @return instant or {@code null} if not restricted.
- */
- @Nullable
- public Date getKeyValidityForOriginationEnd() {
- return mKeyValidityForOriginationEnd;
- }
-
- /**
- * Gets the set of purposes (e.g., encrypt, decrypt, sign) for which the key can be used.
- * Attempts to use the key for any other purpose will be rejected.
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code PURPOSE} flags.
- */
- public @KeyStoreKeyProperties.PurposeEnum int getPurposes() {
- return mPurposes;
- }
-
- /**
- * Gets the set of digest algorithms (e.g., {@code SHA-256}, {@code SHA-384} with which the key
- * can be used.
- *
- * @see KeyStoreKeyProperties.Digest
- */
- @NonNull
- public @KeyStoreKeyProperties.DigestEnum String[] getDigests() {
- return ArrayUtils.cloneIfNotEmpty(mDigests);
- }
-
- /**
- * Gets the set of padding schemes (e.g., {@code OEAPPadding}, {@code PKCS1Padding},
- * {@code NoPadding}) with which the key can be used when encrypting/decrypting. Attempts to use
- * the key with any other padding scheme will be rejected.
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code ENCRYPTION_PADDING} constants.
- */
- @NonNull
- public @KeyStoreKeyProperties.EncryptionPaddingEnum String[] getEncryptionPaddings() {
- return ArrayUtils.cloneIfNotEmpty(mEncryptionPaddings);
- }
-
- /**
- * Gets the set of padding schemes (e.g., {@code PSS}, {@code PKCS#1}) with which the key
- * can be used when signing/verifying. Attempts to use the key with any other padding scheme
- * will be rejected.
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code SIGNATURE_PADDING} constants.
- */
- @NonNull
- public @KeyStoreKeyProperties.SignaturePaddingEnum String[] getSignaturePaddings() {
- return ArrayUtils.cloneIfNotEmpty(mSignaturePaddings);
- }
-
- /**
- * Gets the set of block modes (e.g., {@code CBC}, {@code CTR}) with which the key can be used
- * when encrypting/decrypting. Attempts to use the key with any other block modes will be
- * rejected.
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code BLOCK_MODE} constants.
- */
- @NonNull
- public @KeyStoreKeyProperties.BlockModeEnum String[] getBlockModes() {
- return ArrayUtils.cloneIfNotEmpty(mBlockModes);
- }
-
- /**
- * Returns {@code true} if encryption using this key must be sufficiently randomized to produce
- * different ciphertexts for the same plaintext every time. The formal cryptographic property
- * being required is <em>indistinguishability under chosen-plaintext attack ({@code
- * IND-CPA})</em>. This property is important because it mitigates several classes of
- * weaknesses due to which ciphertext may leak information about plaintext. For example, if a
- * given plaintext always produces the same ciphertext, an attacker may see the repeated
- * ciphertexts and be able to deduce something about the plaintext.
- */
- public boolean isRandomizedEncryptionRequired() {
- return mRandomizedEncryptionRequired;
- }
-
- /**
- * Returns {@code true} if user authentication is required for this key to be used.
- *
- * <p>This restriction applies only to private key operations. Public key operations are not
- * restricted.
- *
- * @see #getUserAuthenticationValidityDurationSeconds()
- */
- public boolean isUserAuthenticationRequired() {
- return mUserAuthenticationRequired;
- }
-
- /**
- * Gets the duration of time (seconds) for which this key can be used after the user is
- * successfully authenticated. This has effect only if user authentication is required.
- *
- * <p>This restriction applies only to private key operations. Public key operations are not
- * restricted.
- *
- * @return duration in seconds or {@code -1} if authentication is required for every use of the
- * key.
- *
- * @see #isUserAuthenticationRequired()
- */
- public int getUserAuthenticationValidityDurationSeconds() {
- return mUserAuthenticationValidityDurationSeconds;
- }
-
- /**
* Builder class for {@link KeyPairGeneratorSpec} objects.
* <p>
* This will build a parameter spec for use with the <a href="{@docRoot}
@@ -513,7 +268,10 @@
* .setSubject(new X500Principal("CN=myKey")).setSerial(BigInteger.valueOf(1337))
* .setStartDate(start.getTime()).setEndDate(end.getTime()).build();
* </pre>
+ *
+ * @deprecated Use {@link KeyGenParameterSpec.Builder} instead.
*/
+ @Deprecated
public final static class Builder {
private final Context mContext;
@@ -535,28 +293,6 @@
private int mFlags;
- private Date mKeyValidityStart;
-
- private Date mKeyValidityForOriginationEnd;
-
- private Date mKeyValidityForConsumptionEnd;
-
- private @KeyStoreKeyProperties.PurposeEnum int mPurposes;
-
- private @KeyStoreKeyProperties.DigestEnum String[] mDigests;
-
- private @KeyStoreKeyProperties.EncryptionPaddingEnum String[] mEncryptionPaddings;
-
- private @KeyStoreKeyProperties.SignaturePaddingEnum String[] mSignaturePaddings;
-
- private @KeyStoreKeyProperties.BlockModeEnum String[] mBlockModes;
-
- private boolean mRandomizedEncryptionRequired = true;
-
- private boolean mUserAuthenticationRequired;
-
- private int mUserAuthenticationValidityDurationSeconds = -1;
-
/**
* Creates a new instance of the {@code Builder} with the given
* {@code context}. The {@code context} passed in may be used to pop up
@@ -586,11 +322,11 @@
/**
* Sets the type of key pair (e.g., {@code EC}, {@code RSA}) of the key pair to be
- * generated. See {@link KeyStoreKeyProperties}.{@code KEY_ALGORITHM} constants.
+ * generated. See {@link KeyProperties}.{@code KEY_ALGORITHM} constants.
*
*/
@NonNull
- public Builder setKeyType(@NonNull @KeyStoreKeyProperties.KeyAlgorithmEnum String keyType)
+ public Builder setKeyType(@NonNull @KeyProperties.KeyAlgorithmEnum String keyType)
throws NoSuchAlgorithmException {
if (keyType == null) {
throw new NullPointerException("keyType == null");
@@ -632,10 +368,6 @@
/**
* Sets the subject used for the self-signed certificate of the
* generated key pair.
- *
- * <p>The subject must be specified on API Level
- * {@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1 LOLLIPOP_MR1} and older platforms. On
- * newer platforms the subject defaults to {@code CN=fake} if not specified.
*/
@NonNull
public Builder setSubject(@NonNull X500Principal subject) {
@@ -649,10 +381,6 @@
/**
* Sets the serial number used for the self-signed certificate of the
* generated key pair.
- *
- * <p>The serial number must be specified on API Level
- * {@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1 LOLLIPOP_MR1} and older platforms. On
- * newer platforms the serial number defaults to {@code 1} if not specified.
*/
@NonNull
public Builder setSerialNumber(@NonNull BigInteger serialNumber) {
@@ -666,10 +394,6 @@
/**
* Sets the start of the validity period for the self-signed certificate
* of the generated key pair.
- *
- * <p>The date must be specified on API Level
- * {@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1 LOLLIPOP_MR1} and older platforms. On
- * newer platforms the date defaults to {@code Jan 1 1970} if not specified.
*/
@NonNull
public Builder setStartDate(@NonNull Date startDate) {
@@ -683,10 +407,6 @@
/**
* Sets the end of the validity period for the self-signed certificate
* of the generated key pair.
- *
- * <p>The date must be specified on API Level
- * {@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1 LOLLIPOP_MR1} and older platforms. On
- * newer platforms the date defaults to {@code Jan 1 2048} if not specified.
*/
@NonNull
public Builder setEndDate(@NonNull Date endDate) {
@@ -716,239 +436,6 @@
}
/**
- * Sets the time instant before which the key is not yet valid.
- *
- * <p>By default, the key is valid at any instant.
- *
- * <p><b>NOTE: This has currently no effect.</b>
- *
- * @see #setKeyValidityEnd(Date)
- */
- @NonNull
- public Builder setKeyValidityStart(Date startDate) {
- mKeyValidityStart = startDate;
- return this;
- }
-
- /**
- * Sets the time instant after which the key is no longer valid.
- *
- * <p>By default, the key is valid at any instant.
- *
- * <p><b>NOTE: This has currently no effect.</b>
- *
- * @see #setKeyValidityStart(Date)
- * @see #setKeyValidityForConsumptionEnd(Date)
- * @see #setKeyValidityForOriginationEnd(Date)
- */
- @NonNull
- public Builder setKeyValidityEnd(Date endDate) {
- setKeyValidityForOriginationEnd(endDate);
- setKeyValidityForConsumptionEnd(endDate);
- return this;
- }
-
- /**
- * Sets the time instant after which the key is no longer valid for encryption and signing.
- *
- * <p>By default, the key is valid at any instant.
- *
- * <p><b>NOTE: This has currently no effect.</b>
- *
- * @see #setKeyValidityForConsumptionEnd(Date)
- */
- @NonNull
- public Builder setKeyValidityForOriginationEnd(Date endDate) {
- mKeyValidityForOriginationEnd = endDate;
- return this;
- }
-
- /**
- * Sets the time instant after which the key is no longer valid for decryption and
- * verification.
- *
- * <p>By default, the key is valid at any instant.
- *
- * <p><b>NOTE: This has currently no effect.</b>
- *
- * @see #setKeyValidityForOriginationEnd(Date)
- */
- @NonNull
- public Builder setKeyValidityForConsumptionEnd(Date endDate) {
- mKeyValidityForConsumptionEnd = endDate;
- return this;
- }
-
- /**
- * Sets the set of purposes (e.g., encrypt, decrypt, sign) for which the key can be used.
- * Attempts to use the key for any other purpose will be rejected.
- *
- * <p>This must be specified for all keys. There is no default.
- *
- * <p>If the set of purposes for which the key can be used does not contain
- * {@link KeyStoreKeyProperties#PURPOSE_SIGN}, the self-signed certificate generated by
- * {@link KeyPairGenerator} of {@code AndroidKeyStore} provider will contain an invalid
- * signature. This is OK if the certificate is only used for obtaining the public key from
- * Android KeyStore.
- *
- * <p><b>NOTE: This has currently no effect.</b>
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code PURPOSE} flags.
- */
- @NonNull
- public Builder setPurposes(@KeyStoreKeyProperties.PurposeEnum int purposes) {
- mPurposes = purposes;
- return this;
- }
-
- /**
- * Sets the set of digests algorithms (e.g., {@code SHA-256}, {@code SHA-384}) with which
- * the key can be used when signing/verifying. Attempts to use the key with any other digest
- * algorithm will be rejected.
- *
- * <p>This must be specified for keys which are used for signing/verification.
- *
- * <p><b>NOTE: This has currently no effect.</b>
- *
- * @see KeyStoreKeyProperties.Digest
- */
- @NonNull
- public Builder setDigests(@KeyStoreKeyProperties.DigestEnum String... digests) {
- mDigests = ArrayUtils.cloneIfNotEmpty(digests);
- return this;
- }
-
- /**
- * Sets the set of padding schemes (e.g., {@code OAEPPadding}, {@code PKCS1Padding},
- * {@code NoPadding}) with which the key can be used when encrypting/decrypting. Attempts to
- * use the key with any other padding scheme will be rejected.
- *
- * <p>This must be specified for keys which are used for encryption/decryption.
- *
- * <p><b>NOTE: This has currently no effect.</b>
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code ENCRYPTION_PADDING} constants.
- */
- @NonNull
- public Builder setEncryptionPaddings(
- @KeyStoreKeyProperties.EncryptionPaddingEnum String... paddings) {
- mEncryptionPaddings = ArrayUtils.cloneIfNotEmpty(paddings);
- return this;
- }
-
- /**
- * Sets the set of padding schemes (e.g., {@code PSS}, {@code PKCS#1}) with which the key
- * can be used when signing/verifying. Attempts to use the key with any other padding scheme
- * will be rejected.
- *
- * <p>This must be specified for RSA keys which are used for signing/verification.
- *
- * <p><b>NOTE: This has currently no effect.</b>
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code SIGNATURE_PADDING} constants.
- */
- @NonNull
- public Builder setSignaturePaddings(
- @KeyStoreKeyProperties.SignaturePaddingEnum String... paddings) {
- mSignaturePaddings = ArrayUtils.cloneIfNotEmpty(paddings);
- return this;
- }
-
- /**
- * Sets the set of block modes (e.g., {@code ECB}, {@code CBC}, {@code CTR}) with which the
- * key can be used when encrypting/decrypting. Attempts to use the key with any other block
- * modes will be rejected.
- *
- * <p>This must be specified for encryption/decryption keys.
- *
- * <p><b>NOTE: This has currently no effect.</b>
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code BLOCK_MODE} constants.
- */
- @NonNull
- public Builder setBlockModes(@KeyStoreKeyProperties.BlockModeEnum String... blockModes) {
- mBlockModes = ArrayUtils.cloneIfNotEmpty(blockModes);
- return this;
- }
-
- /**
- * Sets whether encryption using this key must be sufficiently randomized to produce
- * different ciphertexts for the same plaintext every time. The formal cryptographic
- * property being required is <em>indistinguishability under chosen-plaintext attack
- * ({@code IND-CPA})</em>. This property is important because it mitigates several classes
- * of weaknesses due to which ciphertext may leak information about plaintext. For example,
- * if a given plaintext always produces the same ciphertext, an attacker may see the
- * repeated ciphertexts and be able to deduce something about the plaintext.
- *
- * <p>By default, {@code IND-CPA} is required.
- *
- * <p>When {@code IND-CPA} is required, encryption/decryption transformations which do not
- * offer {@code IND-CPA}, such as RSA without padding, are prohibited.
- *
- * <p>Before disabling this requirement, consider the following approaches instead:
- * <ul>
- * <li>If you are using RSA encryption without padding, consider switching to padding
- * schemes which offer {@code IND-CPA}, such as PKCS#1 or OAEP.</li>
- * </ul>
- *
- * <p><b>NOTE: This has currently no effect.</b>
- */
- @NonNull
- public Builder setRandomizedEncryptionRequired(boolean required) {
- mRandomizedEncryptionRequired = required;
- return this;
- }
-
- /**
- * Sets whether user authentication is required to use this key.
- *
- * <p>By default, the key can be used without user authentication.
- *
- * <p>When user authentication is required, the user authorizes the use of the key by
- * authenticating to this Android device using a subset of their secure lock screen
- * credentials. Different authentication methods are used depending on whether the every
- * use of the key must be authenticated (as specified by
- * {@link #setUserAuthenticationValidityDurationSeconds(int)}).
- * <a href="{@docRoot}training/articles/keystore.html#UserAuthentication">More
- * information</a>.
- *
- * <p>This restriction applies only to private key operations. Public key operations are not
- * restricted.
- *
- * <p><b>NOTE: This has currently no effect.</b>
- *
- * @see #setUserAuthenticationValidityDurationSeconds(int)
- */
- @NonNull
- public Builder setUserAuthenticationRequired(boolean required) {
- mUserAuthenticationRequired = required;
- return this;
- }
-
- /**
- * Sets the duration of time (seconds) for which this key can be used after the user is
- * successfully authenticated. This has effect only if user authentication is required.
- *
- * <p>By default, the user needs to authenticate for every use of the key.
- *
- * <p>This restriction applies only to private key operations. Public key operations are not
- * restricted.
- *
- * <p><b>NOTE: This has currently no effect.</b>
- *
- * @param seconds duration in seconds or {@code -1} if the user needs to authenticate for
- * every use of the key.
- *
- * @see #setUserAuthenticationRequired(boolean)
- */
- @NonNull
- public Builder setUserAuthenticationValidityDurationSeconds(
- @IntRange(from = -1) int seconds) {
- mUserAuthenticationValidityDurationSeconds = seconds;
- return this;
- }
-
- /**
* Builds the instance of the {@code KeyPairGeneratorSpec}.
*
* @throws IllegalArgumentException if a required field is missing
@@ -965,18 +452,7 @@
mSerialNumber,
mStartDate,
mEndDate,
- mFlags,
- mKeyValidityStart,
- mKeyValidityForOriginationEnd,
- mKeyValidityForConsumptionEnd,
- mPurposes,
- mDigests,
- mEncryptionPaddings,
- mSignaturePaddings,
- mBlockModes,
- mRandomizedEncryptionRequired,
- mUserAuthenticationRequired,
- mUserAuthenticationValidityDurationSeconds);
+ mFlags);
}
}
}
diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java
index 7e3193d..72c74df 100644
--- a/keystore/java/android/security/KeyStore.java
+++ b/keystore/java/android/security/KeyStore.java
@@ -35,6 +35,11 @@
import android.security.keymaster.KeymasterBlob;
import android.security.keymaster.KeymasterDefs;
import android.security.keymaster.OperationResult;
+import android.security.keystore.KeyExpiredException;
+import android.security.keystore.KeyNotYetValidException;
+import android.security.keystore.KeyPermanentlyInvalidatedException;
+import android.security.keystore.KeyProperties;
+import android.security.keystore.UserNotAuthenticatedException;
import android.util.Log;
import java.security.InvalidKeyException;
@@ -101,10 +106,10 @@
private KeyStore(IKeystoreService binder) {
mBinder = binder;
- mContext = getContext();
+ mContext = getApplicationContext();
}
- private static Context getContext() {
+ static Context getApplicationContext() {
ActivityThread activityThread = ActivityThread.currentActivityThread();
if (activityThread == null) {
throw new IllegalStateException(
@@ -131,10 +136,10 @@
return mToken;
}
- static int getKeyTypeForAlgorithm(@KeyStoreKeyProperties.KeyAlgorithmEnum String keyType) {
- if (KeyStoreKeyProperties.KEY_ALGORITHM_RSA.equalsIgnoreCase(keyType)) {
+ static int getKeyTypeForAlgorithm(@KeyProperties.KeyAlgorithmEnum String keyType) {
+ if (KeyProperties.KEY_ALGORITHM_RSA.equalsIgnoreCase(keyType)) {
return NativeConstants.EVP_PKEY_RSA;
- } else if (KeyStoreKeyProperties.KEY_ALGORITHM_EC.equalsIgnoreCase(keyType)) {
+ } else if (KeyProperties.KEY_ALGORITHM_EC.equalsIgnoreCase(keyType)) {
return NativeConstants.EVP_PKEY_EC;
} else {
return -1;
@@ -581,6 +586,44 @@
}
}
+ /**
+ * Notify keystore that a user was added.
+ *
+ * @param userId the new user.
+ * @param parentId the parent of the new user, or -1 if the user has no parent. If parentId is
+ * specified then the new user's keystore will be intialized with the same secure lockscreen
+ * password as the parent.
+ */
+ public void onUserAdded(int userId, int parentId) {
+ try {
+ mBinder.onUserAdded(userId, parentId);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Cannot connect to keystore", e);
+ }
+ }
+
+ /**
+ * Notify keystore that a user was added.
+ *
+ * @param userId the new user.
+ */
+ public void onUserAdded(int userId) {
+ onUserAdded(userId, -1);
+ }
+
+ /**
+ * Notify keystore that a user was removed.
+ *
+ * @param userId the removed user.
+ */
+ public void onUserRemoved(int userId) {
+ try {
+ mBinder.onUserRemoved(userId);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Cannot connect to keystore", e);
+ }
+ }
+
public boolean onUserPasswordChanged(String newPassword) {
return onUserPasswordChanged(UserHandle.getUserId(Process.myUid()), newPassword);
}
diff --git a/keystore/java/android/security/KeyStoreCipherSpi.java b/keystore/java/android/security/KeyStoreCipherSpi.java
index 4eeca47..b0f1695 100644
--- a/keystore/java/android/security/KeyStoreCipherSpi.java
+++ b/keystore/java/android/security/KeyStoreCipherSpi.java
@@ -20,6 +20,7 @@
import android.security.keymaster.KeymasterArguments;
import android.security.keymaster.KeymasterDefs;
import android.security.keymaster.OperationResult;
+import android.security.keystore.KeyProperties;
import java.security.AlgorithmParameters;
import java.security.GeneralSecurityException;
@@ -496,7 +497,7 @@
if ((mIv != null) && (mIv.length > 0)) {
try {
AlgorithmParameters params =
- AlgorithmParameters.getInstance(KeyStoreKeyProperties.KEY_ALGORITHM_AES);
+ AlgorithmParameters.getInstance(KeyProperties.KEY_ALGORITHM_AES);
params.init(new IvParameterSpec(mIv));
return params;
} catch (NoSuchAlgorithmException e) {
diff --git a/keystore/java/android/security/KeyStoreCryptoOperationUtils.java b/keystore/java/android/security/KeyStoreCryptoOperationUtils.java
index 311278b..c9bdd41 100644
--- a/keystore/java/android/security/KeyStoreCryptoOperationUtils.java
+++ b/keystore/java/android/security/KeyStoreCryptoOperationUtils.java
@@ -17,6 +17,7 @@
package android.security;
import android.security.keymaster.KeymasterDefs;
+import android.security.keystore.UserNotAuthenticatedException;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
diff --git a/keystore/java/android/security/KeyStoreKeyGeneratorSpi.java b/keystore/java/android/security/KeyStoreKeyGeneratorSpi.java
index d734d66..feec00f 100644
--- a/keystore/java/android/security/KeyStoreKeyGeneratorSpi.java
+++ b/keystore/java/android/security/KeyStoreKeyGeneratorSpi.java
@@ -19,11 +19,16 @@
import android.security.keymaster.KeyCharacteristics;
import android.security.keymaster.KeymasterArguments;
import android.security.keymaster.KeymasterDefs;
+import android.security.keystore.KeyGenParameterSpec;
+import android.security.keystore.KeyProperties;
+
+import libcore.util.EmptyArray;
import java.security.InvalidAlgorithmParameterException;
import java.security.ProviderException;
import java.security.SecureRandom;
import java.security.spec.AlgorithmParameterSpec;
+import java.util.Arrays;
import java.util.Date;
import javax.crypto.KeyGeneratorSpi;
@@ -96,13 +101,14 @@
private final int mKeymasterDigest;
private final int mDefaultKeySizeBits;
- private KeyGeneratorSpec mSpec;
+ private KeyGenParameterSpec mSpec;
private SecureRandom mRng;
protected int mKeySizeBits;
private int[] mKeymasterPurposes;
private int[] mKeymasterBlockModes;
private int[] mKeymasterPaddings;
+ private int[] mKeymasterDigests;
protected KeyStoreKeyGeneratorSpi(
int keymasterAlgorithm,
@@ -129,14 +135,14 @@
@Override
protected void engineInit(SecureRandom random) {
- throw new UnsupportedOperationException("Cannot initialize without an "
- + KeyGeneratorSpec.class.getName() + " parameter");
+ throw new UnsupportedOperationException("Cannot initialize without a "
+ + KeyGenParameterSpec.class.getName() + " parameter");
}
@Override
protected void engineInit(int keySize, SecureRandom random) {
throw new UnsupportedOperationException("Cannot initialize without a "
- + KeyGeneratorSpec.class.getName() + " parameter");
+ + KeyGenParameterSpec.class.getName() + " parameter");
}
@Override
@@ -146,11 +152,11 @@
boolean success = false;
try {
- if ((params == null) || (!(params instanceof KeyGeneratorSpec))) {
- throw new InvalidAlgorithmParameterException("Cannot initialize without an "
- + KeyGeneratorSpec.class.getName() + " parameter");
+ if ((params == null) || (!(params instanceof KeyGenParameterSpec))) {
+ throw new InvalidAlgorithmParameterException("Cannot initialize without a "
+ + KeyGenParameterSpec.class.getName() + " parameter");
}
- KeyGeneratorSpec spec = (KeyGeneratorSpec) params;
+ KeyGenParameterSpec spec = (KeyGenParameterSpec) params;
if (spec.getKeystoreAlias() == null) {
throw new InvalidAlgorithmParameterException("KeyStore entry alias not provided");
}
@@ -168,13 +174,11 @@
}
try {
- mKeymasterPurposes =
- KeyStoreKeyProperties.Purpose.allToKeymaster(spec.getPurposes());
- mKeymasterPaddings = KeyStoreKeyProperties.EncryptionPadding.allToKeymaster(
+ mKeymasterPurposes = KeyProperties.Purpose.allToKeymaster(spec.getPurposes());
+ mKeymasterPaddings = KeyProperties.EncryptionPadding.allToKeymaster(
spec.getEncryptionPaddings());
- mKeymasterBlockModes =
- KeyStoreKeyProperties.BlockMode.allToKeymaster(spec.getBlockModes());
- if (((spec.getPurposes() & KeyStoreKeyProperties.PURPOSE_ENCRYPT) != 0)
+ mKeymasterBlockModes = KeyProperties.BlockMode.allToKeymaster(spec.getBlockModes());
+ if (((spec.getPurposes() & KeyProperties.PURPOSE_ENCRYPT) != 0)
&& (spec.isRandomizedEncryptionRequired())) {
for (int keymasterBlockMode : mKeymasterBlockModes) {
if (!KeymasterUtils.isKeymasterBlockModeIndCpaCompatible(
@@ -182,14 +186,55 @@
throw new InvalidAlgorithmParameterException(
"Randomized encryption (IND-CPA) required but may be violated"
+ " by block mode: "
- + KeyStoreKeyProperties.BlockMode.fromKeymaster(
- keymasterBlockMode)
- + ". See " + KeyGeneratorSpec.class.getName()
+ + KeyProperties.BlockMode.fromKeymaster(keymasterBlockMode)
+ + ". See " + KeyGenParameterSpec.class.getName()
+ " documentation.");
}
}
}
- } catch (IllegalArgumentException e) {
+ if (spec.isDigestsSpecified()) {
+ // Digest(s) explicitly specified in the spec
+ mKeymasterDigests = KeyProperties.Digest.allToKeymaster(spec.getDigests());
+ if (mKeymasterDigest != -1) {
+ // Key algorithm implies a digest -- ensure it's specified in the spec as
+ // first digest.
+ if (!com.android.internal.util.ArrayUtils.contains(
+ mKeymasterDigests, mKeymasterDigest)) {
+ throw new InvalidAlgorithmParameterException(
+ "Digests specified in algorithm parameters ("
+ + Arrays.asList(spec.getDigests()) + ") must include "
+ + " the digest "
+ + KeyProperties.Digest.fromKeymaster(mKeymasterDigest)
+ + " implied by key algorithm");
+ }
+ if (mKeymasterDigests[0] != mKeymasterDigest) {
+ // The first digest is not the one implied by the key algorithm.
+ // Swap the implied digest with the first one.
+ for (int i = 0; i < mKeymasterDigests.length; i++) {
+ if (mKeymasterDigests[i] == mKeymasterDigest) {
+ mKeymasterDigests[i] = mKeymasterDigests[0];
+ mKeymasterDigests[0] = mKeymasterDigest;
+ break;
+ }
+ }
+ }
+ }
+ } else {
+ // No digest specified in the spec
+ if (mKeymasterDigest != -1) {
+ // Key algorithm implies a digest -- use that digest
+ mKeymasterDigests = new int[] {mKeymasterDigest};
+ } else {
+ mKeymasterDigests = EmptyArray.INT;
+ }
+ }
+ if (mKeymasterAlgorithm == KeymasterDefs.KM_ALGORITHM_HMAC) {
+ if (mKeymasterDigests.length == 0) {
+ throw new InvalidAlgorithmParameterException(
+ "At least one digest algorithm must be specified");
+ }
+ }
+ } catch (IllegalStateException | IllegalArgumentException e) {
throw new InvalidAlgorithmParameterException(e);
}
@@ -212,29 +257,26 @@
@Override
protected SecretKey engineGenerateKey() {
- KeyGeneratorSpec spec = mSpec;
+ KeyGenParameterSpec spec = mSpec;
if (spec == null) {
throw new IllegalStateException("Not initialized");
}
- if ((spec.isEncryptionRequired())
+ if ((spec.isEncryptionAtRestRequired())
&& (mKeyStore.state() != KeyStore.State.UNLOCKED)) {
throw new IllegalStateException(
- "Android KeyStore must be in initialized and unlocked state if encryption is"
- + " required");
+ "Requested to import a key which must be encrypted at rest using secure lock"
+ + " screen credential, but the credential hasn't yet been entered by the user");
}
KeymasterArguments args = new KeymasterArguments();
args.addInt(KeymasterDefs.KM_TAG_KEY_SIZE, mKeySizeBits);
args.addInt(KeymasterDefs.KM_TAG_ALGORITHM, mKeymasterAlgorithm);
- if (mKeymasterDigest != -1) {
- args.addInt(KeymasterDefs.KM_TAG_DIGEST, mKeymasterDigest);
- }
args.addInts(KeymasterDefs.KM_TAG_PURPOSE, mKeymasterPurposes);
args.addInts(KeymasterDefs.KM_TAG_BLOCK_MODE, mKeymasterBlockModes);
args.addInts(KeymasterDefs.KM_TAG_PADDING, mKeymasterPaddings);
+ args.addInts(KeymasterDefs.KM_TAG_DIGEST, mKeymasterDigests);
KeymasterUtils.addUserAuthArgs(args,
- spec.getContext(),
spec.isUserAuthenticationRequired(),
spec.getUserAuthenticationValidityDurationSeconds());
args.addDate(KeymasterDefs.KM_TAG_ACTIVE_DATETIME,
@@ -247,7 +289,7 @@
(spec.getKeyValidityForConsumptionEnd() != null)
? spec.getKeyValidityForConsumptionEnd() : new Date(Long.MAX_VALUE));
- if (((spec.getPurposes() & KeyStoreKeyProperties.PURPOSE_ENCRYPT) != 0)
+ if (((spec.getPurposes() & KeyProperties.PURPOSE_ENCRYPT) != 0)
&& (!spec.isRandomizedEncryptionRequired())) {
// Permit caller-provided IV when encrypting with this key
args.addBoolean(KeymasterDefs.KM_TAG_CALLER_NONCE);
@@ -265,9 +307,9 @@
throw new ProviderException(
"Keystore operation failed", KeyStore.getKeyStoreException(errorCode));
}
- @KeyStoreKeyProperties.KeyAlgorithmEnum String keyAlgorithmJCA;
+ @KeyProperties.KeyAlgorithmEnum String keyAlgorithmJCA;
try {
- keyAlgorithmJCA = KeyStoreKeyProperties.KeyAlgorithm.fromKeymasterSecretKeyAlgorithm(
+ keyAlgorithmJCA = KeyProperties.KeyAlgorithm.fromKeymasterSecretKeyAlgorithm(
mKeymasterAlgorithm, mKeymasterDigest);
} catch (IllegalArgumentException e) {
throw new ProviderException("Failed to obtain JCA secret key algorithm name", e);
diff --git a/keystore/java/android/security/KeyStoreParameter.java b/keystore/java/android/security/KeyStoreParameter.java
index a7fab80..174e03f 100644
--- a/keystore/java/android/security/KeyStoreParameter.java
+++ b/keystore/java/android/security/KeyStoreParameter.java
@@ -16,145 +16,51 @@
package android.security;
-import android.annotation.IntRange;
import android.annotation.NonNull;
-import android.annotation.Nullable;
import android.app.KeyguardManager;
import android.content.Context;
+import android.security.keystore.KeyGenParameterSpec;
+import android.security.keystore.KeyProtection;
-import java.security.Key;
+import java.security.KeyPairGenerator;
import java.security.KeyStore.ProtectionParameter;
-import java.security.cert.Certificate;
-import java.util.Date;
-
-import javax.crypto.Cipher;
/**
- * Parameters specifying how to secure and restrict the use of a key or key pair being imported into
- * the <a href="{@docRoot}training/articles/keystore.html">Android KeyStore facility</a>. This class
- * specifies whether user authentication is required for using the key, what uses the key is
- * authorized for (e.g., only in {@code CTR} mode, or only for signing -- decryption not permitted),
- * whether the key should be encrypted at rest, the key's and validity start and end dates.
+ * This provides the optional parameters that can be specified for
+ * {@code KeyStore} entries that work with
+ * <a href="{@docRoot}training/articles/keystore.html">Android KeyStore
+ * facility</a>. The Android KeyStore facility is accessed through a
+ * {@link java.security.KeyStore} API using the {@code AndroidKeyStore}
+ * provider. The {@code context} passed in may be used to pop up some UI to ask
+ * the user to unlock or initialize the Android KeyStore facility.
+ * <p>
+ * Any entries placed in the {@code KeyStore} may be retrieved later. Note that
+ * there is only one logical instance of the {@code KeyStore} per application
+ * UID so apps using the {@code sharedUid} facility will also share a
+ * {@code KeyStore}.
+ * <p>
+ * Keys may be generated using the {@link KeyPairGenerator} facility with a
+ * {@link KeyPairGeneratorSpec} to specify the entry's {@code alias}. A
+ * self-signed X.509 certificate will be attached to generated entries, but that
+ * may be replaced at a later time by a certificate signed by a real Certificate
+ * Authority.
*
- * <p>To import a key or key pair into the Android KeyStore, create an instance of this class using
- * the {@link Builder} and pass the instance into {@link java.security.KeyStore#setEntry(String, java.security.KeyStore.Entry, ProtectionParameter) KeyStore.setEntry}
- * with the key or key pair being imported.
- *
- * <p>To obtain the secret/symmetric or private key from the Android KeyStore use
- * {@link java.security.KeyStore#getKey(String, char[]) KeyStore.getKey(String, null)} or
- * {@link java.security.KeyStore#getEntry(String, java.security.KeyStore.ProtectionParameter) KeyStore.getEntry(String, null)}.
- * To obtain the public key from the Android KeyStore use
- * {@link java.security.KeyStore#getCertificate(String)} and then
- * {@link Certificate#getPublicKey()}.
- *
- * <p>NOTE: The key material of keys stored in the Android KeyStore is not accessible.
- *
- * <p><h3>Example: Symmetric Key</h3>
- * The following example illustrates how to import an AES key into the Android KeyStore under alias
- * {@code key1} authorized to be used only for encryption/decryption in CBC mode with PKCS#7
- * padding. The key must export its key material via {@link Key#getEncoded()} in {@code RAW} format.
- * <pre> {@code
- * SecretKey key = ...; // AES key
- *
- * KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
- * keyStore.load(null);
- * keyStore.setEntry(
- * "key1",
- * new KeyStore.SecretKeyEntry(key),
- * new KeyStoreParameter.Builder(context)
- * .setPurposes(KeyStoreKeyProperties.PURPOSE_ENCRYPT
- * | KeyStoreKeyProperties.PURPOSE_DECRYPT)
- * .setBlockMode(KeyStoreKeyProperties.BLOCK_MODE_CBC)
- * .setEncryptionPaddings(
- * KeyStoreKeyProperties.ENCRYPTION_PADDING_PKCS7)
- * .build());
- * // Key imported, obtain a reference to it.
- * SecretKey keyStoreKey = (SecretKey) keyStore.getKey("key1", null);
- * // The original key can now be thrown away.
- * }</pre>
- *
- * <p><h3>Example: Asymmetric Key Pair</h3>
- * The following example illustrates how to import an EC key pair into the Android KeyStore under
- * alias {@code key2} authorized to be used only for signing with SHA-256 digest and only if
- * the user has been authenticated within the last ten minutes. Both the private and the public key
- * must export their key material via {@link Key#getEncoded()} in {@code PKCS#8} and {@code X.509}
- * format respectively.
- * <pre> {@code
- * PrivateKey privateKey = ...; // EC private key
- * Certificate[] certChain = ...; // Certificate chain with the first certificate
- * // containing the corresponding EC public key.
- *
- * KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
- * keyStore.load(null);
- * keyStore.setEntry(
- * "key2",
- * new KeyStore.PrivateKeyEntry(privateKey, certChain),
- * new KeyStoreParameter.Builder(context)
- * .setPurposes(KeyStoreKeyProperties.PURPOSE_SIGN)
- * .setDigests(KeyStoreKeyProperties.DIGEST_SHA256)
- * // Only permit this key to be used if the user
- * // authenticated within the last ten minutes.
- * .setUserAuthenticationRequired(true)
- * .setUserAuthenticationValidityDurationSeconds(10 * 60)
- * .build());
- * // Key pair imported, obtain a reference to it.
- * PrivateKey keyStorePrivateKey = (PrivateKey) keyStore.getKey("key2", null);
- * PublicKey publicKey = keyStore.getCertificate("key2").getPublicKey();
- * // The original private key can now be thrown away.
- * }</pre>
+ * @deprecated Use {@link KeyProtection} instead.
*/
+@Deprecated
public final class KeyStoreParameter implements ProtectionParameter {
private final Context mContext;
private final int mFlags;
- private final Date mKeyValidityStart;
- private final Date mKeyValidityForOriginationEnd;
- private final Date mKeyValidityForConsumptionEnd;
- private final @KeyStoreKeyProperties.PurposeEnum int mPurposes;
- private final @KeyStoreKeyProperties.EncryptionPaddingEnum String[] mEncryptionPaddings;
- private final @KeyStoreKeyProperties.SignaturePaddingEnum String[] mSignaturePaddings;
- private final @KeyStoreKeyProperties.DigestEnum String[] mDigests;
- private final @KeyStoreKeyProperties.BlockModeEnum String[] mBlockModes;
- private final boolean mRandomizedEncryptionRequired;
- private final boolean mUserAuthenticationRequired;
- private final int mUserAuthenticationValidityDurationSeconds;
private KeyStoreParameter(
Context context,
- int flags,
- Date keyValidityStart,
- Date keyValidityForOriginationEnd,
- Date keyValidityForConsumptionEnd,
- @KeyStoreKeyProperties.PurposeEnum int purposes,
- @KeyStoreKeyProperties.EncryptionPaddingEnum String[] encryptionPaddings,
- @KeyStoreKeyProperties.SignaturePaddingEnum String[] signaturePaddings,
- @KeyStoreKeyProperties.DigestEnum String[] digests,
- @KeyStoreKeyProperties.BlockModeEnum String[] blockModes,
- boolean randomizedEncryptionRequired,
- boolean userAuthenticationRequired,
- int userAuthenticationValidityDurationSeconds) {
+ int flags) {
if (context == null) {
throw new IllegalArgumentException("context == null");
- } else if ((userAuthenticationValidityDurationSeconds < 0)
- && (userAuthenticationValidityDurationSeconds != -1)) {
- throw new IllegalArgumentException(
- "userAuthenticationValidityDurationSeconds must not be negative");
}
mContext = context;
mFlags = flags;
- mKeyValidityStart = keyValidityStart;
- mKeyValidityForOriginationEnd = keyValidityForOriginationEnd;
- mKeyValidityForConsumptionEnd = keyValidityForConsumptionEnd;
- mPurposes = purposes;
- mEncryptionPaddings =
- ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(encryptionPaddings));
- mSignaturePaddings =
- ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(signaturePaddings));
- mDigests = ArrayUtils.cloneIfNotEmpty(digests);
- mBlockModes = ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(blockModes));
- mRandomizedEncryptionRequired = randomizedEncryptionRequired;
- mUserAuthenticationRequired = userAuthenticationRequired;
- mUserAuthenticationValidityDurationSeconds = userAuthenticationValidityDurationSeconds;
}
/**
@@ -175,151 +81,20 @@
* Returns {@code true} if the {@link java.security.KeyStore} entry must be encrypted at rest.
* This will protect the entry with the secure lock screen credential (e.g., password, PIN, or
* pattern).
+ *
+ * <p>Note that encrypting the key at rest requires that the secure lock screen (e.g., password,
+ * PIN, pattern) is set up, otherwise key generation will fail. Moreover, this key will be
+ * deleted when the secure lock screen is disabled or reset (e.g., by the user or a Device
+ * Administrator). Finally, this key cannot be used until the user unlocks the secure lock
+ * screen after boot.
+ *
+ * @see KeyguardManager#isDeviceSecure()
*/
public boolean isEncryptionRequired() {
return (mFlags & KeyStore.FLAG_ENCRYPTED) != 0;
}
/**
- * Gets the time instant before which the key is not yet valid.
- *
- * @return instant or {@code null} if not restricted.
- */
- @Nullable
- public Date getKeyValidityStart() {
- return mKeyValidityStart;
- }
-
- /**
- * Gets the time instant after which the key is no long valid for decryption and verification.
- *
- * @return instant or {@code null} if not restricted.
- */
- @Nullable
- public Date getKeyValidityForConsumptionEnd() {
- return mKeyValidityForConsumptionEnd;
- }
-
- /**
- * Gets the time instant after which the key is no long valid for encryption and signing.
- *
- * @return instant or {@code null} if not restricted.
- */
- @Nullable
- public Date getKeyValidityForOriginationEnd() {
- return mKeyValidityForOriginationEnd;
- }
-
- /**
- * Gets the set of purposes (e.g., encrypt, decrypt, sign) for which the key can be used.
- * Attempts to use the key for any other purpose will be rejected.
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code PURPOSE} flags.
- */
- public @KeyStoreKeyProperties.PurposeEnum int getPurposes() {
- return mPurposes;
- }
-
- /**
- * Gets the set of padding schemes (e.g., {@code PKCS7Padding}, {@code PKCS1Padding},
- * {@code NoPadding}) with which the key can be used when encrypting/decrypting. Attempts to use
- * the key with any other padding scheme will be rejected.
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code ENCRYPTION_PADDING} constants.
- */
- @NonNull
- public @KeyStoreKeyProperties.EncryptionPaddingEnum String[] getEncryptionPaddings() {
- return ArrayUtils.cloneIfNotEmpty(mEncryptionPaddings);
- }
-
- /**
- * Gets the set of padding schemes (e.g., {@code PSS}, {@code PKCS#1}) with which the key
- * can be used when signing/verifying. Attempts to use the key with any other padding scheme
- * will be rejected.
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code SIGNATURE_PADDING} constants.
- */
- @NonNull
- public @KeyStoreKeyProperties.SignaturePaddingEnum String[] getSignaturePaddings() {
- return ArrayUtils.cloneIfNotEmpty(mSignaturePaddings);
- }
-
- /**
- * Gets the set of digest algorithms (e.g., {@code SHA-256}, {@code SHA-384}) with which the key
- * can be used.
- *
- * @throws IllegalStateException if this set has not been specified.
- *
- * @see #isDigestsSpecified()
- * @see KeyStoreKeyProperties.Digest
- */
- @NonNull
- public @KeyStoreKeyProperties.DigestEnum String[] getDigests() {
- if (mDigests == null) {
- throw new IllegalStateException("Digests not specified");
- }
- return ArrayUtils.cloneIfNotEmpty(mDigests);
- }
-
- /**
- * Returns {@code true} if the set of digest algorithms with which the key can be used has been
- * specified.
- *
- * @see #getDigests()
- */
- @NonNull
- public boolean isDigestsSpecified() {
- return mDigests != null;
- }
-
- /**
- * Gets the set of block modes (e.g., {@code CBC}, {@code CTR}) with which the key can be used
- * when encrypting/decrypting. Attempts to use the key with any other block modes will be
- * rejected.
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code BLOCK_MODE} constants.
- */
- @NonNull
- public @KeyStoreKeyProperties.BlockModeEnum String[] getBlockModes() {
- return ArrayUtils.cloneIfNotEmpty(mBlockModes);
- }
-
- /**
- * Returns {@code true} if encryption using this key must be sufficiently randomized to produce
- * different ciphertexts for the same plaintext every time. The formal cryptographic property
- * being required is <em>indistinguishability under chosen-plaintext attack ({@code
- * IND-CPA})</em>. This property is important because it mitigates several classes of
- * weaknesses due to which ciphertext may leak information about plaintext. For example, if a
- * given plaintext always produces the same ciphertext, an attacker may see the repeated
- * ciphertexts and be able to deduce something about the plaintext.
- */
- public boolean isRandomizedEncryptionRequired() {
- return mRandomizedEncryptionRequired;
- }
-
- /**
- * Returns {@code true} if user authentication is required for this key to be used.
- *
- * @see #getUserAuthenticationValidityDurationSeconds()
- */
- public boolean isUserAuthenticationRequired() {
- return mUserAuthenticationRequired;
- }
-
- /**
- * Gets the duration of time (seconds) for which this key can be used after the user is
- * successfully authenticated. This has effect only if user authentication is required.
- *
- * @return duration in seconds or {@code -1} if authentication is required for every use of the
- * key.
- *
- * @see #isUserAuthenticationRequired()
- */
- public int getUserAuthenticationValidityDurationSeconds() {
- return mUserAuthenticationValidityDurationSeconds;
- }
-
- /**
* Builder class for {@link KeyStoreParameter} objects.
* <p>
* This will build protection parameters for use with the
@@ -332,24 +107,16 @@
*
* <pre class="prettyprint">
* KeyStoreParameter params = new KeyStoreParameter.Builder(mContext)
- * .setEncryptionRequired(true)
+ * .setEncryptionRequired()
* .build();
* </pre>
+ *
+ * @deprecated Use {@link KeyProtection.Builder} instead.
*/
+ @Deprecated
public final static class Builder {
private final Context mContext;
private int mFlags;
- private Date mKeyValidityStart;
- private Date mKeyValidityForOriginationEnd;
- private Date mKeyValidityForConsumptionEnd;
- private @KeyStoreKeyProperties.PurposeEnum int mPurposes;
- private @KeyStoreKeyProperties.EncryptionPaddingEnum String[] mEncryptionPaddings;
- private @KeyStoreKeyProperties.SignaturePaddingEnum String[] mSignaturePaddings;
- private @KeyStoreKeyProperties.DigestEnum String[] mDigests;
- private @KeyStoreKeyProperties.BlockModeEnum String[] mBlockModes;
- private boolean mRandomizedEncryptionRequired = true;
- private boolean mUserAuthenticationRequired;
- private int mUserAuthenticationValidityDurationSeconds = -1;
/**
* Creates a new instance of the {@code Builder} with the given
@@ -388,244 +155,6 @@
}
/**
- * Sets the time instant before which the key is not yet valid.
- *
- * <p>By default, the key is valid at any instant.
- *
- * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
- *
- * @see #setKeyValidityEnd(Date)
- */
- @NonNull
- public Builder setKeyValidityStart(Date startDate) {
- mKeyValidityStart = startDate;
- return this;
- }
-
- /**
- * Sets the time instant after which the key is no longer valid.
- *
- * <p>By default, the key is valid at any instant.
- *
- * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
- *
- * @see #setKeyValidityStart(Date)
- * @see #setKeyValidityForConsumptionEnd(Date)
- * @see #setKeyValidityForOriginationEnd(Date)
- */
- @NonNull
- public Builder setKeyValidityEnd(Date endDate) {
- setKeyValidityForOriginationEnd(endDate);
- setKeyValidityForConsumptionEnd(endDate);
- return this;
- }
-
- /**
- * Sets the time instant after which the key is no longer valid for encryption and signing.
- *
- * <p>By default, the key is valid at any instant.
- *
- * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
- *
- * @see #setKeyValidityForConsumptionEnd(Date)
- */
- @NonNull
- public Builder setKeyValidityForOriginationEnd(Date endDate) {
- mKeyValidityForOriginationEnd = endDate;
- return this;
- }
-
- /**
- * Sets the time instant after which the key is no longer valid for decryption and
- * verification.
- *
- * <p>By default, the key is valid at any instant.
- *
- * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
- *
- * @see #setKeyValidityForOriginationEnd(Date)
- */
- @NonNull
- public Builder setKeyValidityForConsumptionEnd(Date endDate) {
- mKeyValidityForConsumptionEnd = endDate;
- return this;
- }
-
- /**
- * Sets the set of purposes (e.g., encrypt, decrypt, sign) for which the key can be used.
- * Attempts to use the key for any other purpose will be rejected.
- *
- * <p>This must be specified for all keys. There is no default.
- *
- * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code PURPOSE} flags.
- */
- @NonNull
- public Builder setPurposes(@KeyStoreKeyProperties.PurposeEnum int purposes) {
- mPurposes = purposes;
- return this;
- }
-
- /**
- * Sets the set of padding schemes (e.g., {@code OAEPPadding}, {@code PKCS7Padding},
- * {@code NoPadding}) with which the key can be used when encrypting/decrypting. Attempts to
- * use the key with any other padding scheme will be rejected.
- *
- * <p>This must be specified for keys which are used for encryption/decryption.
- *
- * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code ENCRYPTION_PADDING} constants.
- */
- @NonNull
- public Builder setEncryptionPaddings(
- @KeyStoreKeyProperties.EncryptionPaddingEnum String... paddings) {
- mEncryptionPaddings = ArrayUtils.cloneIfNotEmpty(paddings);
- return this;
- }
-
- /**
- * Sets the set of padding schemes (e.g., {@code PSS}, {@code PKCS#1}) with which the key
- * can be used when signing/verifying. Attempts to use the key with any other padding scheme
- * will be rejected.
- *
- * <p>This must be specified for RSA keys which are used for signing/verification.
- *
- * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code SIGNATURE_PADDING} constants.
- */
- @NonNull
- public Builder setSignaturePaddings(
- @KeyStoreKeyProperties.SignaturePaddingEnum String... paddings) {
- mSignaturePaddings = ArrayUtils.cloneIfNotEmpty(paddings);
- return this;
- }
-
-
- /**
- * Sets the set of digest algorithms (e.g., {@code SHA-256}, {@code SHA-384}) with which the
- * key can be used when signing/verifying or generating MACs. Attempts to use the key with
- * any other digest algorithm will be rejected.
- *
- * <p>For HMAC keys, the default is the digest algorithm specified in
- * {@link Key#getAlgorithm()}. For asymmetric signing keys the set of digest algorithms
- * must be specified.
- *
- * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
- *
- * @see KeyStoreKeyProperties.Digest
- */
- @NonNull
- public Builder setDigests(@KeyStoreKeyProperties.DigestEnum String... digests) {
- mDigests = ArrayUtils.cloneIfNotEmpty(digests);
- return this;
- }
-
- /**
- * Sets the set of block modes (e.g., {@code CBC}, {@code CTR}, {@code ECB}) with which the
- * key can be used when encrypting/decrypting. Attempts to use the key with any other block
- * modes will be rejected.
- *
- * <p>This must be specified for encryption/decryption keys.
- *
- * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
- *
- * <p>See {@link KeyStoreKeyProperties}.{@code BLOCK_MODE} constants.
- */
- @NonNull
- public Builder setBlockModes(@KeyStoreKeyProperties.BlockModeEnum String... blockModes) {
- mBlockModes = ArrayUtils.cloneIfNotEmpty(blockModes);
- return this;
- }
-
- /**
- * Sets whether encryption using this key must be sufficiently randomized to produce
- * different ciphertexts for the same plaintext every time. The formal cryptographic
- * property being required is <em>indistinguishability under chosen-plaintext attack
- * ({@code IND-CPA})</em>. This property is important because it mitigates several classes
- * of weaknesses due to which ciphertext may leak information about plaintext. For example,
- * if a given plaintext always produces the same ciphertext, an attacker may see the
- * repeated ciphertexts and be able to deduce something about the plaintext.
- *
- * <p>By default, {@code IND-CPA} is required.
- *
- * <p>When {@code IND-CPA} is required:
- * <ul>
- * <li>transformation which do not offer {@code IND-CPA}, such as symmetric ciphers using
- * {@code ECB} mode or RSA encryption without padding, are prohibited;</li>
- * <li>in transformations which use an IV, such as symmetric ciphers in {@code CBC},
- * {@code CTR}, and {@code GCM} block modes, caller-provided IVs are rejected when
- * encrypting, to ensure that only random IVs are used.</li>
- *
- * <p>Before disabling this requirement, consider the following approaches instead:
- * <ul>
- * <li>If you are generating a random IV for encryption and then initializing a {@code}
- * Cipher using the IV, the solution is to let the {@code Cipher} generate a random IV
- * instead. This will occur if the {@code Cipher} is initialized for encryption without an
- * IV. The IV can then be queried via {@link Cipher#getIV()}.</li>
- * <li>If you are generating a non-random IV (e.g., an IV derived from something not fully
- * random, such as the name of the file being encrypted, or transaction ID, or password,
- * or a device identifier), consider changing your design to use a random IV which will then
- * be provided in addition to the ciphertext to the entities which need to decrypt the
- * ciphertext.</li>
- * <li>If you are using RSA encryption without padding, consider switching to padding
- * schemes which offer {@code IND-CPA}, such as PKCS#1 or OAEP.</li>
- * </ul>
- *
- * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
- */
- @NonNull
- public Builder setRandomizedEncryptionRequired(boolean required) {
- mRandomizedEncryptionRequired = required;
- return this;
- }
-
- /**
- * Sets whether user authentication is required to use this key.
- *
- * <p>By default, the key can be used without user authentication.
- *
- * <p>When user authentication is required, the user authorizes the use of the key by
- * authenticating to this Android device using a subset of their secure lock screen
- * credentials. Different authentication methods are used depending on whether the every
- * use of the key must be authenticated (as specified by
- * {@link #setUserAuthenticationValidityDurationSeconds(int)}).
- * <a href="{@docRoot}training/articles/keystore.html#UserAuthentication">More
- * information</a>.
- *
- * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
- *
- * @see #setUserAuthenticationValidityDurationSeconds(int)
- */
- @NonNull
- public Builder setUserAuthenticationRequired(boolean required) {
- mUserAuthenticationRequired = required;
- return this;
- }
-
- /**
- * Sets the duration of time (seconds) for which this key can be used after the user is
- * successfully authenticated. This has effect only if user authentication is required.
- *
- * <p>By default, the user needs to authenticate for every use of the key.
- *
- * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
- *
- * @param seconds duration in seconds or {@code -1} if the user needs to authenticate for
- * every use of the key.
- *
- * @see #setUserAuthenticationRequired(boolean)
- */
- @NonNull
- public Builder setUserAuthenticationValidityDurationSeconds(
- @IntRange(from = -1) int seconds) {
- mUserAuthenticationValidityDurationSeconds = seconds;
- return this;
- }
-
- /**
* Builds the instance of the {@code KeyStoreParameter}.
*
* @throws IllegalArgumentException if a required field is missing
@@ -635,18 +164,7 @@
public KeyStoreParameter build() {
return new KeyStoreParameter(
mContext,
- mFlags,
- mKeyValidityStart,
- mKeyValidityForOriginationEnd,
- mKeyValidityForConsumptionEnd,
- mPurposes,
- mEncryptionPaddings,
- mSignaturePaddings,
- mDigests,
- mBlockModes,
- mRandomizedEncryptionRequired,
- mUserAuthenticationRequired,
- mUserAuthenticationValidityDurationSeconds);
+ mFlags);
}
}
}
diff --git a/keystore/java/android/security/KeyStoreSecretKeyFactorySpi.java b/keystore/java/android/security/KeyStoreSecretKeyFactorySpi.java
index 548296b..618ba47 100644
--- a/keystore/java/android/security/KeyStoreSecretKeyFactorySpi.java
+++ b/keystore/java/android/security/KeyStoreSecretKeyFactorySpi.java
@@ -18,6 +18,8 @@
import android.security.keymaster.KeyCharacteristics;
import android.security.keymaster.KeymasterDefs;
+import android.security.keystore.KeyInfo;
+import android.security.keystore.KeyProperties;
import libcore.util.EmptyArray;
@@ -55,7 +57,7 @@
throw new InvalidKeySpecException(
"Key material export of Android KeyStore keys is not supported");
}
- if (!KeyStoreKeySpec.class.equals(keySpecClass)) {
+ if (!KeyInfo.class.equals(keySpecClass)) {
throw new InvalidKeySpecException("Unsupported key spec: " + keySpecClass.getName());
}
String keyAliasInKeystore = ((KeyStoreSecretKey) key).getAlias();
@@ -75,22 +77,22 @@
}
boolean insideSecureHardware;
- @KeyStoreKeyProperties.OriginEnum int origin;
+ @KeyProperties.OriginEnum int origin;
int keySize;
- @KeyStoreKeyProperties.PurposeEnum int purposes;
+ @KeyProperties.PurposeEnum int purposes;
String[] encryptionPaddings;
- @KeyStoreKeyProperties.DigestEnum String[] digests;
- @KeyStoreKeyProperties.BlockModeEnum String[] blockModes;
+ @KeyProperties.DigestEnum String[] digests;
+ @KeyProperties.BlockModeEnum String[] blockModes;
int keymasterSwEnforcedUserAuthenticators;
int keymasterHwEnforcedUserAuthenticators;
try {
if (keyCharacteristics.hwEnforced.containsTag(KeymasterDefs.KM_TAG_ORIGIN)) {
insideSecureHardware = true;
- origin = KeyStoreKeyProperties.Origin.fromKeymaster(
+ origin = KeyProperties.Origin.fromKeymaster(
keyCharacteristics.hwEnforced.getInt(KeymasterDefs.KM_TAG_ORIGIN, -1));
} else if (keyCharacteristics.swEnforced.containsTag(KeymasterDefs.KM_TAG_ORIGIN)) {
insideSecureHardware = false;
- origin = KeyStoreKeyProperties.Origin.fromKeymaster(
+ origin = KeyProperties.Origin.fromKeymaster(
keyCharacteristics.swEnforced.getInt(KeymasterDefs.KM_TAG_ORIGIN, -1));
} else {
throw new InvalidKeySpecException("Key origin not available");
@@ -100,15 +102,14 @@
throw new InvalidKeySpecException("Key size not available");
}
keySize = keySizeInteger;
- purposes = KeyStoreKeyProperties.Purpose.allFromKeymaster(
+ purposes = KeyProperties.Purpose.allFromKeymaster(
keyCharacteristics.getInts(KeymasterDefs.KM_TAG_PURPOSE));
List<String> encryptionPaddingsList = new ArrayList<String>();
for (int keymasterPadding : keyCharacteristics.getInts(KeymasterDefs.KM_TAG_PADDING)) {
- @KeyStoreKeyProperties.EncryptionPaddingEnum String jcaPadding;
+ @KeyProperties.EncryptionPaddingEnum String jcaPadding;
try {
- jcaPadding =
- KeyStoreKeyProperties.EncryptionPadding.fromKeymaster(keymasterPadding);
+ jcaPadding = KeyProperties.EncryptionPadding.fromKeymaster(keymasterPadding);
} catch (IllegalArgumentException e) {
throw new InvalidKeySpecException(
"Unsupported encryption padding: " + keymasterPadding);
@@ -118,9 +119,9 @@
encryptionPaddings =
encryptionPaddingsList.toArray(new String[encryptionPaddingsList.size()]);
- digests = KeyStoreKeyProperties.Digest.allFromKeymaster(
+ digests = KeyProperties.Digest.allFromKeymaster(
keyCharacteristics.getInts(KeymasterDefs.KM_TAG_DIGEST));
- blockModes = KeyStoreKeyProperties.BlockMode.allFromKeymaster(
+ blockModes = KeyProperties.BlockMode.allFromKeymaster(
keyCharacteristics.getInts(KeymasterDefs.KM_TAG_BLOCK_MODE));
keymasterSwEnforcedUserAuthenticators =
keyCharacteristics.swEnforced.getInt(KeymasterDefs.KM_TAG_USER_AUTH_TYPE, 0);
@@ -154,7 +155,7 @@
&& (keymasterHwEnforcedUserAuthenticators != 0)
&& (keymasterSwEnforcedUserAuthenticators == 0);
- return new KeyStoreKeySpec(entryAlias,
+ return new KeyInfo(entryAlias,
insideSecureHardware,
origin,
keySize,
diff --git a/keystore/java/android/security/KeymasterUtils.java b/keystore/java/android/security/KeymasterUtils.java
index df67ae7..0f8f190 100644
--- a/keystore/java/android/security/KeymasterUtils.java
+++ b/keystore/java/android/security/KeymasterUtils.java
@@ -16,7 +16,6 @@
package android.security;
-import android.content.Context;
import android.hardware.fingerprint.FingerprintManager;
import android.security.keymaster.KeymasterArguments;
import android.security.keymaster.KeymasterDefs;
@@ -73,7 +72,6 @@
* use of the key needs authorization.
*/
public static void addUserAuthArgs(KeymasterArguments args,
- Context context,
boolean userAuthenticationRequired,
int userAuthenticationValidityDurationSeconds) {
if (!userAuthenticationRequired) {
@@ -85,7 +83,7 @@
// Every use of this key needs to be authorized by the user. This currently means
// fingerprint-only auth.
FingerprintManager fingerprintManager =
- context.getSystemService(FingerprintManager.class);
+ KeyStore.getApplicationContext().getSystemService(FingerprintManager.class);
if ((fingerprintManager == null) || (!fingerprintManager.isHardwareDetected())) {
throw new IllegalStateException(
"This device does not support keys which require authentication for every"
diff --git a/keystore/java/android/security/KeyExpiredException.java b/keystore/java/android/security/keystore/KeyExpiredException.java
similarity index 97%
rename from keystore/java/android/security/KeyExpiredException.java
rename to keystore/java/android/security/keystore/KeyExpiredException.java
index f58e48a..15b8d67 100644
--- a/keystore/java/android/security/KeyExpiredException.java
+++ b/keystore/java/android/security/keystore/KeyExpiredException.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import java.security.InvalidKeyException;
diff --git a/keystore/java/android/security/keystore/KeyGenParameterSpec.java b/keystore/java/android/security/keystore/KeyGenParameterSpec.java
new file mode 100644
index 0000000..fa3b1cb
--- /dev/null
+++ b/keystore/java/android/security/keystore/KeyGenParameterSpec.java
@@ -0,0 +1,857 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.security.keystore;
+
+import android.app.KeyguardManager;
+import android.annotation.IntRange;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.text.TextUtils;
+import android.security.ArrayUtils;
+import android.security.KeyStore;
+
+import java.math.BigInteger;
+import java.security.KeyPairGenerator;
+import java.security.cert.Certificate;
+import java.security.spec.AlgorithmParameterSpec;
+import java.util.Date;
+
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.security.auth.x500.X500Principal;
+
+/**
+ * {@link AlgorithmParameterSpec} for initializing a {@link KeyPairGenerator} or a
+ * {@link KeyGenerator} of the <a href="{@docRoot}training/articles/keystore.html">Android Keystore
+ * system</a>. The spec determines whether user authentication is required for using the key, what
+ * uses the key is authorized for (e.g., only for signing -- decryption not permitted), whether the
+ * key should be encrypted at rest, the key's and validity start and end dates.
+ *
+ * <p>To generate an asymmetric key pair or a symmetric key, create an instance of this class using
+ * the {@link Builder}, initialize a {@code KeyPairGenerator} or a {@code KeyGenerator} of the
+ * desired key type (e.g., {@code EC} or {@code AES} -- see
+ * {@link KeyProperties}.{@code KEY_ALGORITHM} constants) from the {@code AndroidKeyStore} provider
+ * with the {@code KeyPairGeneratorSpec} instance, and then generate a key or key pair using
+ * {@link KeyPairGenerator#generateKeyPair()}.
+ *
+ * <p>The generated key pair or key will be returned by the generator and also stored in the Android
+ * Keystore system under the alias specified in this spec. To obtain the secret or private key from
+ * the Android KeyStore use {@link java.security.KeyStore#getKey(String, char[]) KeyStore.getKey(String, null)}
+ * or {@link java.security.KeyStore#getEntry(String, java.security.KeyStore.ProtectionParameter) KeyStore.getEntry(String, null)}.
+ * To obtain the public key from the Android Keystore system use
+ * {@link java.security.KeyStore#getCertificate(String)} and then
+ * {@link Certificate#getPublicKey()}.
+ *
+ * <p>For asymmetric key pairs, a self-signed X.509 certificate will be also generated and stored in
+ * the Android KeyStore. This is because the {@link java.security.KeyStore} abstraction does not
+ * support storing key pairs without a certificate. The subject, serial number, and validity dates
+ * of the certificate can be customized in this spec. The self-signed certificate may be replaced at
+ * a later time by a certificate signed by a Certificate Authority (CA).
+ *
+ * <p>NOTE: The key material of the generated symmetric and private keys is not accessible. The key
+ * material of the public keys is accessible.
+ *
+ * <p><h3>Example: Asymmetric key pair</h3>
+ * The following example illustrates how to generate an EC key pair in the Android KeyStore system
+ * under alias {@code key1} authorized to be used only for signing using SHA-256, SHA-384,
+ * or SHA-512 digest and only if the user has been authenticated within the last five minutes.
+ * <pre> {@code
+ * KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(
+ * KeyProperties.KEY_ALGORITHM_EC,
+ * "AndroidKeyStore");
+ * keyPairGenerator.initialize(
+ * new KeyGenParameterSpec.Builder("key1",
+ * KeyProperties.PURPOSE_SIGN | KeyProperties.PURPOSE_VERIFY)
+ * .setDigests(KeyProperties.DIGEST_SHA256
+ * | KeyProperties.DIGEST_SHA384
+ * | KeyProperties.DIGEST_SHA512)
+ * // Only permit this key to be used if the user authenticated
+ * // within the last five minutes.
+ * .setUserAuthenticationRequired(true)
+ * .setUserAuthenticationValidityDurationSeconds(5 * 60)
+ * .build());
+ * KeyPair keyPair = keyPairGenerator.generateKeyPair();
+ *
+ * // The key pair can also be obtained from the Android Keystore any time as follows:
+ * KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
+ * keyStore.load(null);
+ * PrivateKey privateKey = (PrivateKey) keyStore.getKey("key1", null);
+ * PublicKey publicKey = keyStore.getCertificate("key1").getPublicKey();
+ * }</pre>
+ *
+ * <p><h3>Example: Symmetric key</h3>
+ * The following example illustrates how to generate an AES key in the Android KeyStore system under
+ * alias {@code key2} authorized to be used only for encryption/decryption in CTR mode.
+ * <pre> {@code
+ * KeyGenerator keyGenerator = KeyGenerator.getInstance(
+ * KeyProperties.KEY_ALGORITHM_HMAC_SHA256,
+ * "AndroidKeyStore");
+ * keyGenerator.initialize(
+ * new KeyGenParameterSpec.Builder("key2",
+ * KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT)
+ * .setBlockModes(KeyProperties.BLOCK_MODE_CTR)
+ * .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE)
+ * .build());
+ * SecretKey key = keyGenerator.generateKey();
+ *
+ * // The key can also be obtained from the Android Keystore any time as follows:
+ * KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
+ * keyStore.load(null);
+ * key = (SecretKey) keyStore.getKey("key2", null);
+ * }</pre>
+ */
+public final class KeyGenParameterSpec implements AlgorithmParameterSpec {
+
+ private static final X500Principal DEFAULT_CERT_SUBJECT = new X500Principal("CN=fake");
+ private static final BigInteger DEFAULT_CERT_SERIAL_NUMBER = new BigInteger("1");
+ private static final Date DEFAULT_CERT_NOT_BEFORE = new Date(0L); // Jan 1 1970
+ private static final Date DEFAULT_CERT_NOT_AFTER = new Date(2461449600000L); // Jan 1 2048
+
+ private final String mKeystoreAlias;
+ private final int mKeySize;
+ private final AlgorithmParameterSpec mSpec;
+ private final X500Principal mCertificateSubject;
+ private final BigInteger mCertificateSerialNumber;
+ private final Date mCertificateNotBefore;
+ private final Date mCertificateNotAfter;
+ private final int mFlags;
+ private final Date mKeyValidityStart;
+ private final Date mKeyValidityForOriginationEnd;
+ private final Date mKeyValidityForConsumptionEnd;
+ private final @KeyProperties.PurposeEnum int mPurposes;
+ private final @KeyProperties.DigestEnum String[] mDigests;
+ private final @KeyProperties.EncryptionPaddingEnum String[] mEncryptionPaddings;
+ private final @KeyProperties.SignaturePaddingEnum String[] mSignaturePaddings;
+ private final @KeyProperties.BlockModeEnum String[] mBlockModes;
+ private final boolean mRandomizedEncryptionRequired;
+ private final boolean mUserAuthenticationRequired;
+ private final int mUserAuthenticationValidityDurationSeconds;
+
+ /**
+ * @hide should be built with Builder
+ */
+ public KeyGenParameterSpec(
+ String keyStoreAlias,
+ int keySize,
+ AlgorithmParameterSpec spec,
+ X500Principal certificateSubject,
+ BigInteger certificateSerialNumber,
+ Date certificateNotBefore,
+ Date certificateNotAfter,
+ int flags,
+ Date keyValidityStart,
+ Date keyValidityForOriginationEnd,
+ Date keyValidityForConsumptionEnd,
+ @KeyProperties.PurposeEnum int purposes,
+ @KeyProperties.DigestEnum String[] digests,
+ @KeyProperties.EncryptionPaddingEnum String[] encryptionPaddings,
+ @KeyProperties.SignaturePaddingEnum String[] signaturePaddings,
+ @KeyProperties.BlockModeEnum String[] blockModes,
+ boolean randomizedEncryptionRequired,
+ boolean userAuthenticationRequired,
+ int userAuthenticationValidityDurationSeconds) {
+ if (TextUtils.isEmpty(keyStoreAlias)) {
+ throw new IllegalArgumentException("keyStoreAlias must not be empty");
+ } else if ((userAuthenticationValidityDurationSeconds < 0)
+ && (userAuthenticationValidityDurationSeconds != -1)) {
+ throw new IllegalArgumentException(
+ "userAuthenticationValidityDurationSeconds must not be negative");
+ }
+
+ if (certificateSubject == null) {
+ certificateSubject = DEFAULT_CERT_SUBJECT;
+ }
+ if (certificateNotBefore == null) {
+ certificateNotBefore = DEFAULT_CERT_NOT_BEFORE;
+ }
+ if (certificateNotAfter == null) {
+ certificateNotAfter = DEFAULT_CERT_NOT_AFTER;
+ }
+ if (certificateSerialNumber == null) {
+ certificateSerialNumber = DEFAULT_CERT_SERIAL_NUMBER;
+ }
+
+ if (certificateNotAfter.before(certificateNotBefore)) {
+ throw new IllegalArgumentException("certificateNotAfter < certificateNotBefore");
+ }
+
+ mKeystoreAlias = keyStoreAlias;
+ mKeySize = keySize;
+ mSpec = spec;
+ mCertificateSubject = certificateSubject;
+ mCertificateSerialNumber = certificateSerialNumber;
+ mCertificateNotBefore = certificateNotBefore;
+ mCertificateNotAfter = certificateNotAfter;
+ mFlags = flags;
+ mKeyValidityStart = keyValidityStart;
+ mKeyValidityForOriginationEnd = keyValidityForOriginationEnd;
+ mKeyValidityForConsumptionEnd = keyValidityForConsumptionEnd;
+ mPurposes = purposes;
+ mDigests = ArrayUtils.cloneIfNotEmpty(digests);
+ mEncryptionPaddings =
+ ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(encryptionPaddings));
+ mSignaturePaddings = ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(signaturePaddings));
+ mBlockModes = ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(blockModes));
+ mRandomizedEncryptionRequired = randomizedEncryptionRequired;
+ mUserAuthenticationRequired = userAuthenticationRequired;
+ mUserAuthenticationValidityDurationSeconds = userAuthenticationValidityDurationSeconds;
+ }
+
+ /**
+ * Returns the alias that will be used in the {@code java.security.KeyStore}
+ * in conjunction with the {@code AndroidKeyStore}.
+ */
+ public String getKeystoreAlias() {
+ return mKeystoreAlias;
+ }
+
+ /**
+ * Returns the requested key size or {@code -1} if default size should be used.
+ */
+ public int getKeySize() {
+ return mKeySize;
+ }
+
+ /**
+ * Returns the {@link AlgorithmParameterSpec} that will be used for creation
+ * of the key pair.
+ */
+ @NonNull
+ public AlgorithmParameterSpec getAlgorithmParameterSpec() {
+ return mSpec;
+ }
+
+ /**
+ * Returns the subject distinguished name to be used on the X.509 certificate that will be put
+ * in the {@link java.security.KeyStore}.
+ */
+ @NonNull
+ public X500Principal getCertificateSubject() {
+ return mCertificateSubject;
+ }
+
+ /**
+ * Returns the serial number to be used on the X.509 certificate that will be put in the
+ * {@link java.security.KeyStore}.
+ */
+ @NonNull
+ public BigInteger getCertificateSerialNumber() {
+ return mCertificateSerialNumber;
+ }
+
+ /**
+ * Returns the start date to be used on the X.509 certificate that will be put in the
+ * {@link java.security.KeyStore}.
+ */
+ @NonNull
+ public Date getCertificateNotBefore() {
+ return mCertificateNotBefore;
+ }
+
+ /**
+ * Returns the end date to be used on the X.509 certificate that will be put in the
+ * {@link java.security.KeyStore}.
+ */
+ @NonNull
+ public Date getCertificateNotAfter() {
+ return mCertificateNotAfter;
+ }
+
+ /**
+ * @hide
+ */
+ public int getFlags() {
+ return mFlags;
+ }
+
+ /**
+ * Returns {@code true} if the key must be encrypted at rest. This will protect the key with the
+ * secure lock screen credential (e.g., password, PIN, or pattern).
+ *
+ * <p>Note that encrypting the key at rest requires that the secure lock screen (e.g., password,
+ * PIN, pattern) is set up, otherwise key generation will fail. Moreover, this key will be
+ * deleted when the secure lock screen is disabled or reset (e.g., by the user or a Device
+ * Administrator). Finally, this key cannot be used until the user unlocks the secure lock
+ * screen after boot.
+ *
+ * @see KeyguardManager#isDeviceSecure()
+ */
+ public boolean isEncryptionAtRestRequired() {
+ return (mFlags & KeyStore.FLAG_ENCRYPTED) != 0;
+ }
+
+ /**
+ * Returns the time instant before which the key is not yet valid or {@code null} if not
+ * restricted.
+ */
+ @Nullable
+ public Date getKeyValidityStart() {
+ return mKeyValidityStart;
+ }
+
+ /**
+ * Returns the time instant after which the key is no longer valid for decryption and
+ * verification or {@code null} if not restricted.
+ */
+ @Nullable
+ public Date getKeyValidityForConsumptionEnd() {
+ return mKeyValidityForConsumptionEnd;
+ }
+
+ /**
+ * Returns the time instant after which the key is no longer valid for encryption and signing
+ * or {@code null} if not restricted.
+ */
+ @Nullable
+ public Date getKeyValidityForOriginationEnd() {
+ return mKeyValidityForOriginationEnd;
+ }
+
+ /**
+ * Returns the set of purposes (e.g., encrypt, decrypt, sign) for which the key can be used.
+ * Attempts to use the key for any other purpose will be rejected.
+ *
+ * <p>See {@link KeyProperties}.{@code PURPOSE} flags.
+ */
+ public @KeyProperties.PurposeEnum int getPurposes() {
+ return mPurposes;
+ }
+
+ /**
+ * Returns the set of digest algorithms (e.g., {@code SHA-256}, {@code SHA-384} with which the
+ * key can be used or {@code null} if not specified.
+ *
+ * <p>See {@link KeyProperties}.{@code DIGEST} constants.
+ *
+ * @throws IllegalStateException if this set has not been specified.
+ *
+ * @see #isDigestsSpecified()
+ */
+ @NonNull
+ public @KeyProperties.DigestEnum String[] getDigests() {
+ if (mDigests == null) {
+ throw new IllegalStateException("Digests not specified");
+ }
+ return ArrayUtils.cloneIfNotEmpty(mDigests);
+ }
+
+ /**
+ * Returns {@code true} if the set of digest algorithms with which the key can be used has been
+ * specified.
+ *
+ * @see #getDigests()
+ */
+ @NonNull
+ public boolean isDigestsSpecified() {
+ return mDigests != null;
+ }
+
+ /**
+ * Returns the set of padding schemes (e.g., {@code PKCS7Padding}, {@code OEAPPadding},
+ * {@code PKCS1Padding}, {@code NoPadding}) with which the key can be used when
+ * encrypting/decrypting. Attempts to use the key with any other padding scheme will be
+ * rejected.
+ *
+ * <p>See {@link KeyProperties}.{@code ENCRYPTION_PADDING} constants.
+ */
+ @NonNull
+ public @KeyProperties.EncryptionPaddingEnum String[] getEncryptionPaddings() {
+ return ArrayUtils.cloneIfNotEmpty(mEncryptionPaddings);
+ }
+
+ /**
+ * Gets the set of padding schemes (e.g., {@code PSS}, {@code PKCS#1}) with which the key
+ * can be used when signing/verifying. Attempts to use the key with any other padding scheme
+ * will be rejected.
+ *
+ * <p>See {@link KeyProperties}.{@code SIGNATURE_PADDING} constants.
+ */
+ @NonNull
+ public @KeyProperties.SignaturePaddingEnum String[] getSignaturePaddings() {
+ return ArrayUtils.cloneIfNotEmpty(mSignaturePaddings);
+ }
+
+ /**
+ * Gets the set of block modes (e.g., {@code CBC}, {@code CTR}) with which the key can be used
+ * when encrypting/decrypting. Attempts to use the key with any other block modes will be
+ * rejected.
+ *
+ * <p>See {@link KeyProperties}.{@code BLOCK_MODE} constants.
+ */
+ @NonNull
+ public @KeyProperties.BlockModeEnum String[] getBlockModes() {
+ return ArrayUtils.cloneIfNotEmpty(mBlockModes);
+ }
+
+ /**
+ * Returns {@code true} if encryption using this key must be sufficiently randomized to produce
+ * different ciphertexts for the same plaintext every time. The formal cryptographic property
+ * being required is <em>indistinguishability under chosen-plaintext attack ({@code
+ * IND-CPA})</em>. This property is important because it mitigates several classes of
+ * weaknesses due to which ciphertext may leak information about plaintext. For example, if a
+ * given plaintext always produces the same ciphertext, an attacker may see the repeated
+ * ciphertexts and be able to deduce something about the plaintext.
+ */
+ public boolean isRandomizedEncryptionRequired() {
+ return mRandomizedEncryptionRequired;
+ }
+
+ /**
+ * Returns {@code true} if user authentication is required for this key to be used.
+ *
+ * <p>This restriction applies only to private key operations. Public key operations are not
+ * restricted.
+ *
+ * @see #getUserAuthenticationValidityDurationSeconds()
+ */
+ public boolean isUserAuthenticationRequired() {
+ return mUserAuthenticationRequired;
+ }
+
+ /**
+ * Gets the duration of time (seconds) for which this key can be used after the user is
+ * successfully authenticated. This has effect only if user authentication is required.
+ *
+ * <p>This restriction applies only to private key operations. Public key operations are not
+ * restricted.
+ *
+ * @return duration in seconds or {@code -1} if authentication is required for every use of the
+ * key.
+ *
+ * @see #isUserAuthenticationRequired()
+ */
+ public int getUserAuthenticationValidityDurationSeconds() {
+ return mUserAuthenticationValidityDurationSeconds;
+ }
+
+ /**
+ * Builder of {@link KeyGenParameterSpec} instances.
+ */
+ public final static class Builder {
+ private final String mKeystoreAlias;
+ private @KeyProperties.PurposeEnum int mPurposes;
+
+ private int mKeySize = -1;
+ private AlgorithmParameterSpec mSpec;
+ private X500Principal mCertificateSubject;
+ private BigInteger mCertificateSerialNumber;
+ private Date mCertificateNotBefore;
+ private Date mCertificateNotAfter;
+ private int mFlags;
+ private Date mKeyValidityStart;
+ private Date mKeyValidityForOriginationEnd;
+ private Date mKeyValidityForConsumptionEnd;
+ private @KeyProperties.DigestEnum String[] mDigests;
+ private @KeyProperties.EncryptionPaddingEnum String[] mEncryptionPaddings;
+ private @KeyProperties.SignaturePaddingEnum String[] mSignaturePaddings;
+ private @KeyProperties.BlockModeEnum String[] mBlockModes;
+ private boolean mRandomizedEncryptionRequired = true;
+ private boolean mUserAuthenticationRequired;
+ private int mUserAuthenticationValidityDurationSeconds = -1;
+
+ /**
+ * Creates a new instance of the {@code Builder}.
+ *
+ * @param keystoreAlias alias of the entry in which the generated key will appear in
+ * Android KeyStore.
+ * @param purposes set of purposes (e.g., encrypt, decrypt, sign) for which the key can be
+ * used. Attempts to use the key for any other purpose will be rejected.
+ *
+ * <p>If the set of purposes for which the key can be used does not contain
+ * {@link KeyProperties#PURPOSE_SIGN}, the self-signed certificate generated by
+ * {@link KeyPairGenerator} of {@code AndroidKeyStore} provider will contain an
+ * invalid signature. This is OK if the certificate is only used for obtaining the
+ * public key from Android KeyStore.
+ *
+ * <p><b>NOTE: The {@code purposes} parameter has currently no effect on asymmetric
+ * key pairs.</b>
+ *
+ * <p>See {@link KeyProperties}.{@code PURPOSE} flags.
+ */
+ public Builder(@NonNull String keystoreAlias, @KeyProperties.PurposeEnum int purposes) {
+ if (keystoreAlias == null) {
+ throw new NullPointerException("keystoreAlias == null");
+ }
+ mKeystoreAlias = keystoreAlias;
+ mPurposes = purposes;
+ }
+
+ /**
+ * Sets the size (in bits) of the key to be generated. For instance, for RSA keys this sets
+ * the modulus size, for EC keys this selects a curve with a matching field size, and for
+ * symmetric keys this sets the size of the bitstring which is their key material.
+ *
+ * <p>The default key size is specific to each key algorithm.
+ */
+ @NonNull
+ public Builder setKeySize(int keySize) {
+ if (keySize < 0) {
+ throw new IllegalArgumentException("keySize < 0");
+ }
+ mKeySize = keySize;
+ return this;
+ }
+
+ /**
+ * Sets the algorithm-specific key generation parameters. For example, for RSA keys this may
+ * be an instance of {@link java.security.spec.RSAKeyGenParameterSpec}.
+ */
+ public Builder setAlgorithmParameterSpec(@NonNull AlgorithmParameterSpec spec) {
+ if (spec == null) {
+ throw new NullPointerException("spec == null");
+ }
+ mSpec = spec;
+ return this;
+ }
+
+ /**
+ * Sets the subject used for the self-signed certificate of the generated key pair.
+ *
+ * <p>By default, the subject is {@code CN=fake}.
+ */
+ @NonNull
+ public Builder setCertificateSubject(@NonNull X500Principal subject) {
+ if (subject == null) {
+ throw new NullPointerException("subject == null");
+ }
+ mCertificateSubject = subject;
+ return this;
+ }
+
+ /**
+ * Sets the serial number used for the self-signed certificate of the generated key pair.
+ *
+ * <p>By default, the serial number is {@code 1}.
+ */
+ @NonNull
+ public Builder setCertificateSerialNumber(@NonNull BigInteger serialNumber) {
+ if (serialNumber == null) {
+ throw new NullPointerException("serialNumber == null");
+ }
+ mCertificateSerialNumber = serialNumber;
+ return this;
+ }
+
+ /**
+ * Sets the start of the validity period for the self-signed certificate of the generated
+ * key pair.
+ *
+ * <p>By default, this date is {@code Jan 1 1970}.
+ */
+ @NonNull
+ public Builder setCertificateNotBefore(@NonNull Date date) {
+ if (date == null) {
+ throw new NullPointerException("date == null");
+ }
+ mCertificateNotBefore = date;
+ return this;
+ }
+
+ /**
+ * Sets the end of the validity period for the self-signed certificate of the generated key
+ * pair.
+ *
+ * <p>By default, this date is {@code Jan 1 2048}.
+ */
+ @NonNull
+ public Builder setCertificateNotAfter(@NonNull Date date) {
+ if (date == null) {
+ throw new NullPointerException("date == null");
+ }
+ mCertificateNotAfter = date;
+ return this;
+ }
+
+ /**
+ * Sets whether this key pair or key must be encrypted at rest. This will protect the key
+ * pair or key with the secure lock screen credential (e.g., password, PIN, or pattern).
+ *
+ * <p>Note that enabling this feature requires that the secure lock screen (e.g., password,
+ * PIN, pattern) is set up, otherwise key generation will fail. Moreover, this key will be
+ * deleted when the secure lock screen is disabled or reset (e.g., by the user or a Device
+ * Administrator). Finally, this key cannot be used until the user unlocks the secure lock
+ * screen after boot.
+ *
+ * @see KeyguardManager#isDeviceSecure()
+ */
+ @NonNull
+ public Builder setEncryptionAtRestRequired(boolean required) {
+ if (required) {
+ mFlags |= KeyStore.FLAG_ENCRYPTED;
+ } else {
+ mFlags &= ~KeyStore.FLAG_ENCRYPTED;
+ }
+ return this;
+ }
+
+ /**
+ * Sets the time instant before which the key is not yet valid.
+ *
+ * <p>By default, the key is valid at any instant.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * @see #setKeyValidityEnd(Date)
+ */
+ @NonNull
+ public Builder setKeyValidityStart(Date startDate) {
+ mKeyValidityStart = startDate;
+ return this;
+ }
+
+ /**
+ * Sets the time instant after which the key is no longer valid.
+ *
+ * <p>By default, the key is valid at any instant.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * @see #setKeyValidityStart(Date)
+ * @see #setKeyValidityForConsumptionEnd(Date)
+ * @see #setKeyValidityForOriginationEnd(Date)
+ */
+ @NonNull
+ public Builder setKeyValidityEnd(Date endDate) {
+ setKeyValidityForOriginationEnd(endDate);
+ setKeyValidityForConsumptionEnd(endDate);
+ return this;
+ }
+
+ /**
+ * Sets the time instant after which the key is no longer valid for encryption and signing.
+ *
+ * <p>By default, the key is valid at any instant.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * @see #setKeyValidityForConsumptionEnd(Date)
+ */
+ @NonNull
+ public Builder setKeyValidityForOriginationEnd(Date endDate) {
+ mKeyValidityForOriginationEnd = endDate;
+ return this;
+ }
+
+ /**
+ * Sets the time instant after which the key is no longer valid for decryption and
+ * verification.
+ *
+ * <p>By default, the key is valid at any instant.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * @see #setKeyValidityForOriginationEnd(Date)
+ */
+ @NonNull
+ public Builder setKeyValidityForConsumptionEnd(Date endDate) {
+ mKeyValidityForConsumptionEnd = endDate;
+ return this;
+ }
+
+ /**
+ * Sets the set of digests algorithms (e.g., {@code SHA-256}, {@code SHA-384}) with which
+ * the key can be used when signing/verifying. Attempts to use the key with any other digest
+ * algorithm will be rejected.
+ *
+ * <p>This must be specified for keys which are used for signing/verification. For HMAC
+ * keys, the set of digests defaults to the digest associated with the key algorithm (e.g.,
+ * {@code SHA-256} for key algorithm {@code HmacSHA256}
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * @see KeyProperties.Digest
+ */
+ @NonNull
+ public Builder setDigests(@KeyProperties.DigestEnum String... digests) {
+ mDigests = ArrayUtils.cloneIfNotEmpty(digests);
+ return this;
+ }
+
+ /**
+ * Sets the set of padding schemes (e.g., {@code PKCS7Padding}, {@code OAEPPadding},
+ * {@code PKCS1Padding}, {@code NoPadding}) with which the key can be used when
+ * encrypting/decrypting. Attempts to use the key with any other padding scheme will be
+ * rejected.
+ *
+ * <p>This must be specified for keys which are used for encryption/decryption.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * <p>See {@link KeyProperties}.{@code ENCRYPTION_PADDING} constants.
+ */
+ @NonNull
+ public Builder setEncryptionPaddings(
+ @KeyProperties.EncryptionPaddingEnum String... paddings) {
+ mEncryptionPaddings = ArrayUtils.cloneIfNotEmpty(paddings);
+ return this;
+ }
+
+ /**
+ * Sets the set of padding schemes (e.g., {@code PSS}, {@code PKCS#1}) with which the key
+ * can be used when signing/verifying. Attempts to use the key with any other padding scheme
+ * will be rejected.
+ *
+ * <p>This must be specified for RSA keys which are used for signing/verification.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * <p>See {@link KeyProperties}.{@code SIGNATURE_PADDING} constants.
+ */
+ @NonNull
+ public Builder setSignaturePaddings(
+ @KeyProperties.SignaturePaddingEnum String... paddings) {
+ mSignaturePaddings = ArrayUtils.cloneIfNotEmpty(paddings);
+ return this;
+ }
+
+ /**
+ * Sets the set of block modes (e.g., {@code CBC}, {@code CTR}, {@code ECB}) with which the
+ * key can be used when encrypting/decrypting. Attempts to use the key with any other block
+ * modes will be rejected.
+ *
+ * <p>This must be specified for encryption/decryption keys.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * <p>See {@link KeyProperties}.{@code BLOCK_MODE} constants.
+ */
+ @NonNull
+ public Builder setBlockModes(@KeyProperties.BlockModeEnum String... blockModes) {
+ mBlockModes = ArrayUtils.cloneIfNotEmpty(blockModes);
+ return this;
+ }
+
+ /**
+ * Sets whether encryption using this key must be sufficiently randomized to produce
+ * different ciphertexts for the same plaintext every time. The formal cryptographic
+ * property being required is <em>indistinguishability under chosen-plaintext attack
+ * ({@code IND-CPA})</em>. This property is important because it mitigates several classes
+ * of weaknesses due to which ciphertext may leak information about plaintext. For example,
+ * if a given plaintext always produces the same ciphertext, an attacker may see the
+ * repeated ciphertexts and be able to deduce something about the plaintext.
+ *
+ * <p>By default, {@code IND-CPA} is required.
+ *
+ * <p>When {@code IND-CPA} is required:
+ * <ul>
+ * <li>encryption/decryption transformation which do not offer {@code IND-CPA}, such as
+ * {@code ECB} with a symmetric encryption algorithm, or RSA encryption/decryption without
+ * padding, are prohibited;</li>
+ * <li>in block modes which use an IV, such as {@code CBC}, {@code CTR}, and {@code GCM},
+ * caller-provided IVs are rejected when encrypting, to ensure that only random IVs are
+ * used.</li>
+ * </ul>
+ *
+ * <p>Before disabling this requirement, consider the following approaches instead:
+ * <ul>
+ * <li>If you are generating a random IV for encryption and then initializing a {@code}
+ * Cipher using the IV, the solution is to let the {@code Cipher} generate a random IV
+ * instead. This will occur if the {@code Cipher} is initialized for encryption without an
+ * IV. The IV can then be queried via {@link Cipher#getIV()}.</li>
+ * <li>If you are generating a non-random IV (e.g., an IV derived from something not fully
+ * random, such as the name of the file being encrypted, or transaction ID, or password,
+ * or a device identifier), consider changing your design to use a random IV which will then
+ * be provided in addition to the ciphertext to the entities which need to decrypt the
+ * ciphertext.</li>
+ * <li>If you are using RSA encryption without padding, consider switching to encryption
+ * padding schemes which offer {@code IND-CPA}, such as PKCS#1 or OAEP.</li>
+ * </ul>
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ */
+ @NonNull
+ public Builder setRandomizedEncryptionRequired(boolean required) {
+ mRandomizedEncryptionRequired = required;
+ return this;
+ }
+
+ /**
+ * Sets whether user authentication is required to use this key.
+ *
+ * <p>By default, the key can be used without user authentication.
+ *
+ * <p>When user authentication is required, the user authorizes the use of the key by
+ * authenticating to this Android device using a subset of their secure lock screen
+ * credentials. Different authentication methods are used depending on whether the every
+ * use of the key must be authenticated (as specified by
+ * {@link #setUserAuthenticationValidityDurationSeconds(int)}).
+ * <a href="{@docRoot}training/articles/keystore.html#UserAuthentication">More
+ * information</a>.
+ *
+ * <p>This restriction applies only to private key operations. Public key operations are not
+ * restricted.
+ *
+ * <p><b>NOTE: This has currently no effect.</b>
+ *
+ * @see #setUserAuthenticationValidityDurationSeconds(int)
+ */
+ @NonNull
+ public Builder setUserAuthenticationRequired(boolean required) {
+ mUserAuthenticationRequired = required;
+ return this;
+ }
+
+ /**
+ * Sets the duration of time (seconds) for which this key can be used after the user is
+ * successfully authenticated. This has effect only if user authentication is required.
+ *
+ * <p>By default, the user needs to authenticate for every use of the key.
+ *
+ * <p><b>NOTE: This has currently no effect.</b>
+ *
+ * @param seconds duration in seconds or {@code -1} if the user needs to authenticate for
+ * every use of the key.
+ *
+ * @see #setUserAuthenticationRequired(boolean)
+ */
+ @NonNull
+ public Builder setUserAuthenticationValidityDurationSeconds(
+ @IntRange(from = -1) int seconds) {
+ mUserAuthenticationValidityDurationSeconds = seconds;
+ return this;
+ }
+
+ /**
+ * Builds an instance of {@code KeyGenParameterSpec}.
+ *
+ * @throws IllegalArgumentException if a required field is missing
+ */
+ @NonNull
+ public KeyGenParameterSpec build() {
+ return new KeyGenParameterSpec(
+ mKeystoreAlias,
+ mKeySize,
+ mSpec,
+ mCertificateSubject,
+ mCertificateSerialNumber,
+ mCertificateNotBefore,
+ mCertificateNotAfter,
+ mFlags,
+ mKeyValidityStart,
+ mKeyValidityForOriginationEnd,
+ mKeyValidityForConsumptionEnd,
+ mPurposes,
+ mDigests,
+ mEncryptionPaddings,
+ mSignaturePaddings,
+ mBlockModes,
+ mRandomizedEncryptionRequired,
+ mUserAuthenticationRequired,
+ mUserAuthenticationValidityDurationSeconds);
+ }
+ }
+}
diff --git a/keystore/java/android/security/KeyStoreKeySpec.java b/keystore/java/android/security/keystore/KeyInfo.java
similarity index 76%
rename from keystore/java/android/security/KeyStoreKeySpec.java
rename to keystore/java/android/security/keystore/KeyInfo.java
index 4c43f89..aec2512 100644
--- a/keystore/java/android/security/KeyStoreKeySpec.java
+++ b/keystore/java/android/security/keystore/KeyInfo.java
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.security.ArrayUtils;
import java.security.PrivateKey;
import java.security.spec.KeySpec;
@@ -27,55 +28,55 @@
/**
* Information about a key from the <a href="{@docRoot}training/articles/keystore.html">Android
- * KeyStore</a>. This class describes whether the key material is available in
+ * Keystore system</a>. This class describes whether the key material is available in
* plaintext outside of secure hardware, whether user authentication is required for using the key
* and whether this requirement is enforced by secure hardware, the key's origin, what uses the key
* is authorized for (e.g., only in {@code CBC} mode, or signing only), whether the key should be
* encrypted at rest, the key's and validity start and end dates.
*
* <p><h3>Example: Symmetric Key</h3>
- * The following example illustrates how to obtain a {@link KeyStoreKeySpec} describing the provided
- * Android KeyStore {@link SecretKey}.
+ * The following example illustrates how to obtain a {@code KeyInfo} describing the provided Android
+ * Keystore {@link SecretKey}.
* <pre> {@code
- * SecretKey key = ...; // Android KeyStore key
+ * SecretKey key = ...; // Android Keystore key
*
* SecretKeyFactory factory = SecretKeyFactory.getInstance(key.getAlgorithm(), "AndroidKeyStore");
- * KeyStoreKeySpec spec;
+ * KeyInfo keyInfo;
* try {
- * spec = (KeyStoreKeySpec) factory.getKeySpec(key, KeyStoreKeySpec.class);
+ * keyInfo = (KeyInfo) factory.getKeySpec(key, KeyInfo.class);
* } catch (InvalidKeySpecException e) {
* // Not an Android KeyStore key.
* }
* }</pre>
*
* <p><h3>Example: Private Key</h3>
- * The following example illustrates how to obtain a {@link KeyStoreKeySpec} describing the provided
+ * The following example illustrates how to obtain a {@code KeyInfo} describing the provided
* Android KeyStore {@link PrivateKey}.
* <pre> {@code
* PrivateKey key = ...; // Android KeyStore key
*
* KeyFactory factory = KeyFactory.getInstance(key.getAlgorithm(), "AndroidKeyStore");
- * KeyStoreKeySpec spec;
+ * KeyInfo keyInfo;
* try {
- * spec = factory.getKeySpec(key, KeyStoreKeySpec.class);
+ * keyInfo = factory.getKeySpec(key, KeyInfo.class);
* } catch (InvalidKeySpecException e) {
* // Not an Android KeyStore key.
* }
* }</pre>
*/
-public class KeyStoreKeySpec implements KeySpec {
+public class KeyInfo implements KeySpec {
private final String mKeystoreAlias;
private final int mKeySize;
private final boolean mInsideSecureHardware;
- private final @KeyStoreKeyProperties.OriginEnum int mOrigin;
+ private final @KeyProperties.OriginEnum int mOrigin;
private final Date mKeyValidityStart;
private final Date mKeyValidityForOriginationEnd;
private final Date mKeyValidityForConsumptionEnd;
- private final @KeyStoreKeyProperties.PurposeEnum int mPurposes;
- private final @KeyStoreKeyProperties.EncryptionPaddingEnum String[] mEncryptionPaddings;
- private final @KeyStoreKeyProperties.SignaturePaddingEnum String[] mSignaturePaddings;
- private final @KeyStoreKeyProperties.DigestEnum String[] mDigests;
- private final @KeyStoreKeyProperties.BlockModeEnum String[] mBlockModes;
+ private final @KeyProperties.PurposeEnum int mPurposes;
+ private final @KeyProperties.EncryptionPaddingEnum String[] mEncryptionPaddings;
+ private final @KeyProperties.SignaturePaddingEnum String[] mSignaturePaddings;
+ private final @KeyProperties.DigestEnum String[] mDigests;
+ private final @KeyProperties.BlockModeEnum String[] mBlockModes;
private final boolean mUserAuthenticationRequired;
private final int mUserAuthenticationValidityDurationSeconds;
private final boolean mUserAuthenticationRequirementEnforcedBySecureHardware;
@@ -83,18 +84,18 @@
/**
* @hide
*/
- KeyStoreKeySpec(String keystoreKeyAlias,
+ public KeyInfo(String keystoreKeyAlias,
boolean insideSecureHardware,
- @KeyStoreKeyProperties.OriginEnum int origin,
+ @KeyProperties.OriginEnum int origin,
int keySize,
Date keyValidityStart,
Date keyValidityForOriginationEnd,
Date keyValidityForConsumptionEnd,
- @KeyStoreKeyProperties.PurposeEnum int purposes,
- @KeyStoreKeyProperties.EncryptionPaddingEnum String[] encryptionPaddings,
- @KeyStoreKeyProperties.SignaturePaddingEnum String[] signaturePaddings,
- @KeyStoreKeyProperties.DigestEnum String[] digests,
- @KeyStoreKeyProperties.BlockModeEnum String[] blockModes,
+ @KeyProperties.PurposeEnum int purposes,
+ @KeyProperties.EncryptionPaddingEnum String[] encryptionPaddings,
+ @KeyProperties.SignaturePaddingEnum String[] signaturePaddings,
+ @KeyProperties.DigestEnum String[] digests,
+ @KeyProperties.BlockModeEnum String[] blockModes,
boolean userAuthenticationRequired,
int userAuthenticationValidityDurationSeconds,
boolean userAuthenticationRequirementEnforcedBySecureHardware) {
@@ -135,9 +136,9 @@
}
/**
- * Gets the origin of the key. See {@link KeyStoreKeyProperties}.{@code ORIGIN} constants.
+ * Gets the origin of the key. See {@link KeyProperties}.{@code ORIGIN} constants.
*/
- public @KeyStoreKeyProperties.OriginEnum int getOrigin() {
+ public @KeyProperties.OriginEnum int getOrigin() {
return mOrigin;
}
@@ -182,9 +183,9 @@
* Gets the set of purposes (e.g., encrypt, decrypt, sign) for which the key can be used.
* Attempts to use the key for any other purpose will be rejected.
*
- * <p>See {@link KeyStoreKeyProperties}.{@code PURPOSE} flags.
+ * <p>See {@link KeyProperties}.{@code PURPOSE} flags.
*/
- public @KeyStoreKeyProperties.PurposeEnum int getPurposes() {
+ public @KeyProperties.PurposeEnum int getPurposes() {
return mPurposes;
}
@@ -193,10 +194,10 @@
* when encrypting/decrypting. Attempts to use the key with any other block modes will be
* rejected.
*
- * <p>See {@link KeyStoreKeyProperties}.{@code BLOCK_MODE} constants.
+ * <p>See {@link KeyProperties}.{@code BLOCK_MODE} constants.
*/
@NonNull
- public @KeyStoreKeyProperties.BlockModeEnum String[] getBlockModes() {
+ public @KeyProperties.BlockModeEnum String[] getBlockModes() {
return ArrayUtils.cloneIfNotEmpty(mBlockModes);
}
@@ -205,10 +206,10 @@
* {@code NoPadding}) with which the key can be used when encrypting/decrypting. Attempts to use
* the key with any other padding scheme will be rejected.
*
- * <p>See {@link KeyStoreKeyProperties}.{@code ENCRYPTION_PADDING} constants.
+ * <p>See {@link KeyProperties}.{@code ENCRYPTION_PADDING} constants.
*/
@NonNull
- public @KeyStoreKeyProperties.EncryptionPaddingEnum String[] getEncryptionPaddings() {
+ public @KeyProperties.EncryptionPaddingEnum String[] getEncryptionPaddings() {
return ArrayUtils.cloneIfNotEmpty(mEncryptionPaddings);
}
@@ -217,10 +218,10 @@
* can be used when signing/verifying. Attempts to use the key with any other padding scheme
* will be rejected.
*
- * <p>See {@link KeyStoreKeyProperties}.{@code SIGNATURE_PADDING} constants.
+ * <p>See {@link KeyProperties}.{@code SIGNATURE_PADDING} constants.
*/
@NonNull
- public @KeyStoreKeyProperties.SignaturePaddingEnum String[] getSignaturePaddings() {
+ public @KeyProperties.SignaturePaddingEnum String[] getSignaturePaddings() {
return ArrayUtils.cloneIfNotEmpty(mSignaturePaddings);
}
@@ -228,10 +229,10 @@
* Gets the set of digest algorithms (e.g., {@code SHA-256}, {@code SHA-384}) with which the key
* can be used.
*
- * @see KeyStoreKeyProperties.Digest
+ * <p>See {@link KeyProperties}.{@code DIGEST} constants.
*/
@NonNull
- public @KeyStoreKeyProperties.DigestEnum String[] getDigests() {
+ public @KeyProperties.DigestEnum String[] getDigests() {
return ArrayUtils.cloneIfNotEmpty(mDigests);
}
diff --git a/keystore/java/android/security/KeyNotYetValidException.java b/keystore/java/android/security/keystore/KeyNotYetValidException.java
similarity index 97%
rename from keystore/java/android/security/KeyNotYetValidException.java
rename to keystore/java/android/security/keystore/KeyNotYetValidException.java
index 4ea27ef..2cec77d 100644
--- a/keystore/java/android/security/KeyNotYetValidException.java
+++ b/keystore/java/android/security/keystore/KeyNotYetValidException.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import java.security.InvalidKeyException;
diff --git a/keystore/java/android/security/KeyPermanentlyInvalidatedException.java b/keystore/java/android/security/keystore/KeyPermanentlyInvalidatedException.java
similarity index 98%
rename from keystore/java/android/security/KeyPermanentlyInvalidatedException.java
rename to keystore/java/android/security/keystore/KeyPermanentlyInvalidatedException.java
index 229eab0..e320c9c 100644
--- a/keystore/java/android/security/KeyPermanentlyInvalidatedException.java
+++ b/keystore/java/android/security/keystore/KeyPermanentlyInvalidatedException.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import java.security.InvalidKeyException;
diff --git a/keystore/java/android/security/KeyStoreKeyProperties.java b/keystore/java/android/security/keystore/KeyProperties.java
similarity index 89%
rename from keystore/java/android/security/KeyStoreKeyProperties.java
rename to keystore/java/android/security/keystore/KeyProperties.java
index b58a7dd..e3c2d1d 100644
--- a/keystore/java/android/security/KeyStoreKeyProperties.java
+++ b/keystore/java/android/security/keystore/KeyProperties.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -30,10 +30,10 @@
import java.util.Locale;
/**
- * Properties of {@code AndroidKeyStore} keys.
+ * Properties of <a href="{@docRoot}training/articles/keystore.html">Android Keystore</a> keys.
*/
-public abstract class KeyStoreKeyProperties {
- private KeyStoreKeyProperties() {}
+public abstract class KeyProperties {
+ private KeyProperties() {}
/**
* @hide
@@ -68,10 +68,13 @@
*/
public static final int PURPOSE_VERIFY = 1 << 3;
- static abstract class Purpose {
+ /**
+ * @hide
+ */
+ public static abstract class Purpose {
private Purpose() {}
- static int toKeymaster(@PurposeEnum int purpose) {
+ public static int toKeymaster(@PurposeEnum int purpose) {
switch (purpose) {
case PURPOSE_ENCRYPT:
return KeymasterDefs.KM_PURPOSE_ENCRYPT;
@@ -86,7 +89,7 @@
}
}
- static @PurposeEnum int fromKeymaster(int purpose) {
+ public static @PurposeEnum int fromKeymaster(int purpose) {
switch (purpose) {
case KeymasterDefs.KM_PURPOSE_ENCRYPT:
return PURPOSE_ENCRYPT;
@@ -102,7 +105,7 @@
}
@NonNull
- static int[] allToKeymaster(@PurposeEnum int purposes) {
+ public static int[] allToKeymaster(@PurposeEnum int purposes) {
int[] result = getSetFlags(purposes);
for (int i = 0; i < result.length; i++) {
result[i] = toKeymaster(result[i]);
@@ -110,7 +113,7 @@
return result;
}
- static @PurposeEnum int allFromKeymaster(@NonNull Collection<Integer> purposes) {
+ public static @PurposeEnum int allFromKeymaster(@NonNull Collection<Integer> purposes) {
@PurposeEnum int result = 0;
for (int keymasterPurpose : purposes) {
result |= fromKeymaster(keymasterPurpose);
@@ -159,10 +162,14 @@
/** Keyed-Hash Message Authentication Code (HMAC) key using SHA-512 as the hash. */
public static final String KEY_ALGORITHM_HMAC_SHA512 = "HmacSHA512";
- static abstract class KeyAlgorithm {
+ /**
+ * @hide
+ */
+ public static abstract class KeyAlgorithm {
private KeyAlgorithm() {}
- static int toKeymasterSecretKeyAlgorithm(@NonNull @KeyAlgorithmEnum String algorithm) {
+ public static int toKeymasterSecretKeyAlgorithm(
+ @NonNull @KeyAlgorithmEnum String algorithm) {
if (KEY_ALGORITHM_AES.equalsIgnoreCase(algorithm)) {
return KeymasterDefs.KM_ALGORITHM_AES;
} else if (algorithm.toUpperCase(Locale.US).startsWith("HMAC")) {
@@ -174,7 +181,7 @@
}
@NonNull
- static @KeyAlgorithmEnum String fromKeymasterSecretKeyAlgorithm(
+ public static @KeyAlgorithmEnum String fromKeymasterSecretKeyAlgorithm(
int keymasterAlgorithm, int keymasterDigest) {
switch (keymasterAlgorithm) {
case KeymasterDefs.KM_ALGORITHM_AES:
@@ -210,7 +217,7 @@
*
* @return keymaster digest or {@code -1} if the algorithm does not involve a digest.
*/
- static int toKeymasterDigest(@NonNull @KeyAlgorithmEnum String algorithm) {
+ public static int toKeymasterDigest(@NonNull @KeyAlgorithmEnum String algorithm) {
String algorithmUpper = algorithm.toUpperCase(Locale.US);
if (algorithmUpper.startsWith("HMAC")) {
String digestUpper = algorithmUpper.substring("HMAC".length());
@@ -259,10 +266,13 @@
/** Galois/Counter Mode (GCM) block mode. */
public static final String BLOCK_MODE_GCM = "GCM";
- static abstract class BlockMode {
+ /**
+ * @hide
+ */
+ public static abstract class BlockMode {
private BlockMode() {}
- static int toKeymaster(@NonNull @BlockModeEnum String blockMode) {
+ public static int toKeymaster(@NonNull @BlockModeEnum String blockMode) {
if (BLOCK_MODE_ECB.equalsIgnoreCase(blockMode)) {
return KeymasterDefs.KM_MODE_ECB;
} else if (BLOCK_MODE_CBC.equalsIgnoreCase(blockMode)) {
@@ -277,7 +287,7 @@
}
@NonNull
- static @BlockModeEnum String fromKeymaster(int blockMode) {
+ public static @BlockModeEnum String fromKeymaster(int blockMode) {
switch (blockMode) {
case KeymasterDefs.KM_MODE_ECB:
return BLOCK_MODE_ECB;
@@ -293,7 +303,8 @@
}
@NonNull
- static @BlockModeEnum String[] allFromKeymaster(@NonNull Collection<Integer> blockModes) {
+ public static @BlockModeEnum String[] allFromKeymaster(
+ @NonNull Collection<Integer> blockModes) {
if ((blockModes == null) || (blockModes.isEmpty())) {
return EmptyArray.STRING;
}
@@ -306,7 +317,7 @@
return result;
}
- static int[] allToKeymaster(@Nullable @BlockModeEnum String[] blockModes) {
+ public static int[] allToKeymaster(@Nullable @BlockModeEnum String[] blockModes) {
if ((blockModes == null) || (blockModes.length == 0)) {
return EmptyArray.INT;
}
@@ -350,10 +361,13 @@
*/
public static final String ENCRYPTION_PADDING_RSA_OAEP = "OAEPPadding";
- static abstract class EncryptionPadding {
+ /**
+ * @hide
+ */
+ public static abstract class EncryptionPadding {
private EncryptionPadding() {}
- static int toKeymaster(@NonNull @EncryptionPaddingEnum String padding) {
+ public static int toKeymaster(@NonNull @EncryptionPaddingEnum String padding) {
if (ENCRYPTION_PADDING_NONE.equalsIgnoreCase(padding)) {
return KeymasterDefs.KM_PAD_NONE;
} else if (ENCRYPTION_PADDING_PKCS7.equalsIgnoreCase(padding)) {
@@ -369,7 +383,7 @@
}
@NonNull
- static @EncryptionPaddingEnum String fromKeymaster(int padding) {
+ public static @EncryptionPaddingEnum String fromKeymaster(int padding) {
switch (padding) {
case KeymasterDefs.KM_PAD_NONE:
return ENCRYPTION_PADDING_NONE;
@@ -386,7 +400,7 @@
}
@NonNull
- static int[] allToKeymaster(@Nullable @EncryptionPaddingEnum String[] paddings) {
+ public static int[] allToKeymaster(@Nullable @EncryptionPaddingEnum String[] paddings) {
if ((paddings == null) || (paddings.length == 0)) {
return EmptyArray.INT;
}
@@ -508,10 +522,13 @@
*/
public static final String DIGEST_SHA512 = "SHA-512";
- static abstract class Digest {
+ /**
+ * @hide
+ */
+ public static abstract class Digest {
private Digest() {}
- static int toKeymaster(@NonNull @DigestEnum String digest) {
+ public static int toKeymaster(@NonNull @DigestEnum String digest) {
switch (digest.toUpperCase(Locale.US)) {
case DIGEST_SHA1:
return KeymasterDefs.KM_DIGEST_SHA1;
@@ -533,7 +550,7 @@
}
@NonNull
- static @DigestEnum String fromKeymaster(int digest) {
+ public static @DigestEnum String fromKeymaster(int digest) {
switch (digest) {
case KeymasterDefs.KM_DIGEST_NONE:
return DIGEST_NONE;
@@ -555,7 +572,7 @@
}
@NonNull
- static @DigestEnum String[] allFromKeymaster(@NonNull Collection<Integer> digests) {
+ public static @DigestEnum String[] allFromKeymaster(@NonNull Collection<Integer> digests) {
if (digests.isEmpty()) {
return EmptyArray.STRING;
}
@@ -569,7 +586,7 @@
}
@NonNull
- static int[] allToKeymaster(@Nullable @DigestEnum String[] digests) {
+ public static int[] allToKeymaster(@Nullable @DigestEnum String[] digests) {
if ((digests == null) || (digests.length == 0)) {
return EmptyArray.INT;
}
@@ -606,10 +623,13 @@
*/
public static final int ORIGIN_UNKNOWN = 1 << 2;
- static abstract class Origin {
+ /**
+ * @hide
+ */
+ public static abstract class Origin {
private Origin() {}
- static @OriginEnum int fromKeymaster(int origin) {
+ public static @OriginEnum int fromKeymaster(int origin) {
switch (origin) {
case KeymasterDefs.KM_ORIGIN_GENERATED:
return ORIGIN_GENERATED;
diff --git a/keystore/java/android/security/keystore/KeyProtection.java b/keystore/java/android/security/keystore/KeyProtection.java
new file mode 100644
index 0000000..113159d
--- /dev/null
+++ b/keystore/java/android/security/keystore/KeyProtection.java
@@ -0,0 +1,608 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.security.keystore;
+
+import android.annotation.IntRange;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.app.KeyguardManager;
+import android.content.Context;
+import android.security.ArrayUtils;
+import android.security.KeyStore;
+
+import java.security.Key;
+import java.security.KeyStore.ProtectionParameter;
+import java.security.cert.Certificate;
+import java.util.Date;
+
+import javax.crypto.Cipher;
+
+/**
+ * Specification of how a key or key pair is secured when imported into the
+ * <a href="{@docRoot}training/articles/keystore.html">Android KeyStore facility</a>. This class
+ * specifies parameters such as whether user authentication is required for using the key, what uses
+ * the key is authorized for (e.g., only in {@code CTR} mode, or only for signing -- decryption not
+ * permitted), whether the key should be encrypted at rest, the key's and validity start and end
+ * dates.
+ *
+ * <p>To import a key or key pair into the Android KeyStore, create an instance of this class using
+ * the {@link Builder} and pass the instance into {@link java.security.KeyStore#setEntry(String, java.security.KeyStore.Entry, ProtectionParameter) KeyStore.setEntry}
+ * with the key or key pair being imported.
+ *
+ * <p>To obtain the secret/symmetric or private key from the Android KeyStore use
+ * {@link java.security.KeyStore#getKey(String, char[]) KeyStore.getKey(String, null)} or
+ * {@link java.security.KeyStore#getEntry(String, java.security.KeyStore.ProtectionParameter) KeyStore.getEntry(String, null)}.
+ * To obtain the public key from the Android KeyStore use
+ * {@link java.security.KeyStore#getCertificate(String)} and then
+ * {@link Certificate#getPublicKey()}.
+ *
+ * <p>NOTE: The key material of keys stored in the Android KeyStore is not accessible.
+ *
+ * <p><h3>Example: Symmetric Key</h3>
+ * The following example illustrates how to import an AES key into the Android KeyStore under alias
+ * {@code key1} authorized to be used only for encryption/decryption in CBC mode with PKCS#7
+ * padding. The key must export its key material via {@link Key#getEncoded()} in {@code RAW} format.
+ * <pre> {@code
+ * SecretKey key = ...; // AES key
+ *
+ * KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
+ * keyStore.load(null);
+ * keyStore.setEntry(
+ * "key1",
+ * new KeyStore.SecretKeyEntry(key),
+ * new KeyProtection.Builder(KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT)
+ * .setBlockMode(KeyProperties.BLOCK_MODE_CBC)
+ * .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7)
+ * .build());
+ * // Key imported, obtain a reference to it.
+ * SecretKey keyStoreKey = (SecretKey) keyStore.getKey("key1", null);
+ * // The original key can now be thrown away.
+ * }</pre>
+ *
+ * <p><h3>Example: Asymmetric Key Pair</h3>
+ * The following example illustrates how to import an EC key pair into the Android KeyStore under
+ * alias {@code key2} authorized to be used only for signing with SHA-256 digest and only if
+ * the user has been authenticated within the last ten minutes. Both the private and the public key
+ * must export their key material via {@link Key#getEncoded()} in {@code PKCS#8} and {@code X.509}
+ * format respectively.
+ * <pre> {@code
+ * PrivateKey privateKey = ...; // EC private key
+ * Certificate[] certChain = ...; // Certificate chain with the first certificate
+ * // containing the corresponding EC public key.
+ *
+ * KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
+ * keyStore.load(null);
+ * keyStore.setEntry(
+ * "key2",
+ * new KeyStore.PrivateKeyEntry(privateKey, certChain),
+ * new KeyProtection.Builder(KeyProperties.PURPOSE_SIGN)
+ * .setDigests(KeyProperties.DIGEST_SHA256)
+ * // Only permit this key to be used if the user
+ * // authenticated within the last ten minutes.
+ * .setUserAuthenticationRequired(true)
+ * .setUserAuthenticationValidityDurationSeconds(10 * 60)
+ * .build());
+ * // Key pair imported, obtain a reference to it.
+ * PrivateKey keyStorePrivateKey = (PrivateKey) keyStore.getKey("key2", null);
+ * PublicKey publicKey = keyStore.getCertificate("key2").getPublicKey();
+ * // The original private key can now be thrown away.
+ * }</pre>
+ */
+public final class KeyProtection implements ProtectionParameter {
+ private final int mFlags;
+ private final Date mKeyValidityStart;
+ private final Date mKeyValidityForOriginationEnd;
+ private final Date mKeyValidityForConsumptionEnd;
+ private final @KeyProperties.PurposeEnum int mPurposes;
+ private final @KeyProperties.EncryptionPaddingEnum String[] mEncryptionPaddings;
+ private final @KeyProperties.SignaturePaddingEnum String[] mSignaturePaddings;
+ private final @KeyProperties.DigestEnum String[] mDigests;
+ private final @KeyProperties.BlockModeEnum String[] mBlockModes;
+ private final boolean mRandomizedEncryptionRequired;
+ private final boolean mUserAuthenticationRequired;
+ private final int mUserAuthenticationValidityDurationSeconds;
+
+ private KeyProtection(
+ int flags,
+ Date keyValidityStart,
+ Date keyValidityForOriginationEnd,
+ Date keyValidityForConsumptionEnd,
+ @KeyProperties.PurposeEnum int purposes,
+ @KeyProperties.EncryptionPaddingEnum String[] encryptionPaddings,
+ @KeyProperties.SignaturePaddingEnum String[] signaturePaddings,
+ @KeyProperties.DigestEnum String[] digests,
+ @KeyProperties.BlockModeEnum String[] blockModes,
+ boolean randomizedEncryptionRequired,
+ boolean userAuthenticationRequired,
+ int userAuthenticationValidityDurationSeconds) {
+ if ((userAuthenticationValidityDurationSeconds < 0)
+ && (userAuthenticationValidityDurationSeconds != -1)) {
+ throw new IllegalArgumentException(
+ "userAuthenticationValidityDurationSeconds must not be negative");
+ }
+
+ mFlags = flags;
+ mKeyValidityStart = keyValidityStart;
+ mKeyValidityForOriginationEnd = keyValidityForOriginationEnd;
+ mKeyValidityForConsumptionEnd = keyValidityForConsumptionEnd;
+ mPurposes = purposes;
+ mEncryptionPaddings =
+ ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(encryptionPaddings));
+ mSignaturePaddings =
+ ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(signaturePaddings));
+ mDigests = ArrayUtils.cloneIfNotEmpty(digests);
+ mBlockModes = ArrayUtils.cloneIfNotEmpty(ArrayUtils.nullToEmpty(blockModes));
+ mRandomizedEncryptionRequired = randomizedEncryptionRequired;
+ mUserAuthenticationRequired = userAuthenticationRequired;
+ mUserAuthenticationValidityDurationSeconds = userAuthenticationValidityDurationSeconds;
+ }
+
+ /**
+ * @hide
+ */
+ public int getFlags() {
+ return mFlags;
+ }
+
+ /**
+ * Returns {@code true} if the {@link java.security.KeyStore} entry must be encrypted at rest.
+ * This will protect the entry with the secure lock screen credential (e.g., password, PIN, or
+ * pattern).
+ */
+ public boolean isEncryptionAtRestRequired() {
+ return (mFlags & KeyStore.FLAG_ENCRYPTED) != 0;
+ }
+
+ /**
+ * Gets the time instant before which the key is not yet valid.
+ *
+ * @return instant or {@code null} if not restricted.
+ */
+ @Nullable
+ public Date getKeyValidityStart() {
+ return mKeyValidityStart;
+ }
+
+ /**
+ * Gets the time instant after which the key is no long valid for decryption and verification.
+ *
+ * @return instant or {@code null} if not restricted.
+ */
+ @Nullable
+ public Date getKeyValidityForConsumptionEnd() {
+ return mKeyValidityForConsumptionEnd;
+ }
+
+ /**
+ * Gets the time instant after which the key is no long valid for encryption and signing.
+ *
+ * @return instant or {@code null} if not restricted.
+ */
+ @Nullable
+ public Date getKeyValidityForOriginationEnd() {
+ return mKeyValidityForOriginationEnd;
+ }
+
+ /**
+ * Gets the set of purposes (e.g., encrypt, decrypt, sign) for which the key can be used.
+ * Attempts to use the key for any other purpose will be rejected.
+ *
+ * <p>See {@link KeyProperties}.{@code PURPOSE} flags.
+ */
+ public @KeyProperties.PurposeEnum int getPurposes() {
+ return mPurposes;
+ }
+
+ /**
+ * Gets the set of padding schemes (e.g., {@code PKCS7Padding}, {@code PKCS1Padding},
+ * {@code NoPadding}) with which the key can be used when encrypting/decrypting. Attempts to use
+ * the key with any other padding scheme will be rejected.
+ *
+ * <p>See {@link KeyProperties}.{@code ENCRYPTION_PADDING} constants.
+ */
+ @NonNull
+ public @KeyProperties.EncryptionPaddingEnum String[] getEncryptionPaddings() {
+ return ArrayUtils.cloneIfNotEmpty(mEncryptionPaddings);
+ }
+
+ /**
+ * Gets the set of padding schemes (e.g., {@code PSS}, {@code PKCS#1}) with which the key
+ * can be used when signing/verifying. Attempts to use the key with any other padding scheme
+ * will be rejected.
+ *
+ * <p>See {@link KeyProperties}.{@code SIGNATURE_PADDING} constants.
+ */
+ @NonNull
+ public @KeyProperties.SignaturePaddingEnum String[] getSignaturePaddings() {
+ return ArrayUtils.cloneIfNotEmpty(mSignaturePaddings);
+ }
+
+ /**
+ * Gets the set of digest algorithms (e.g., {@code SHA-256}, {@code SHA-384}) with which the key
+ * can be used.
+ *
+ * <p>See {@link KeyProperties}.{@code DIGEST} constants.
+ *
+ * @throws IllegalStateException if this set has not been specified.
+ *
+ * @see #isDigestsSpecified()
+ */
+ @NonNull
+ public @KeyProperties.DigestEnum String[] getDigests() {
+ if (mDigests == null) {
+ throw new IllegalStateException("Digests not specified");
+ }
+ return ArrayUtils.cloneIfNotEmpty(mDigests);
+ }
+
+ /**
+ * Returns {@code true} if the set of digest algorithms with which the key can be used has been
+ * specified.
+ *
+ * @see #getDigests()
+ */
+ public boolean isDigestsSpecified() {
+ return mDigests != null;
+ }
+
+ /**
+ * Gets the set of block modes (e.g., {@code CBC}, {@code CTR}) with which the key can be used
+ * when encrypting/decrypting. Attempts to use the key with any other block modes will be
+ * rejected.
+ *
+ * <p>See {@link KeyProperties}.{@code BLOCK_MODE} constants.
+ */
+ @NonNull
+ public @KeyProperties.BlockModeEnum String[] getBlockModes() {
+ return ArrayUtils.cloneIfNotEmpty(mBlockModes);
+ }
+
+ /**
+ * Returns {@code true} if encryption using this key must be sufficiently randomized to produce
+ * different ciphertexts for the same plaintext every time. The formal cryptographic property
+ * being required is <em>indistinguishability under chosen-plaintext attack ({@code
+ * IND-CPA})</em>. This property is important because it mitigates several classes of
+ * weaknesses due to which ciphertext may leak information about plaintext. For example, if a
+ * given plaintext always produces the same ciphertext, an attacker may see the repeated
+ * ciphertexts and be able to deduce something about the plaintext.
+ */
+ public boolean isRandomizedEncryptionRequired() {
+ return mRandomizedEncryptionRequired;
+ }
+
+ /**
+ * Returns {@code true} if user authentication is required for this key to be used.
+ *
+ * @see #getUserAuthenticationValidityDurationSeconds()
+ */
+ public boolean isUserAuthenticationRequired() {
+ return mUserAuthenticationRequired;
+ }
+
+ /**
+ * Gets the duration of time (seconds) for which this key can be used after the user is
+ * successfully authenticated. This has effect only if user authentication is required.
+ *
+ * @return duration in seconds or {@code -1} if authentication is required for every use of the
+ * key.
+ *
+ * @see #isUserAuthenticationRequired()
+ */
+ public int getUserAuthenticationValidityDurationSeconds() {
+ return mUserAuthenticationValidityDurationSeconds;
+ }
+
+ /**
+ * Builder of {@link KeyProtection} instances.
+ */
+ public final static class Builder {
+ private @KeyProperties.PurposeEnum int mPurposes;
+
+ private int mFlags;
+ private Date mKeyValidityStart;
+ private Date mKeyValidityForOriginationEnd;
+ private Date mKeyValidityForConsumptionEnd;
+ private @KeyProperties.EncryptionPaddingEnum String[] mEncryptionPaddings;
+ private @KeyProperties.SignaturePaddingEnum String[] mSignaturePaddings;
+ private @KeyProperties.DigestEnum String[] mDigests;
+ private @KeyProperties.BlockModeEnum String[] mBlockModes;
+ private boolean mRandomizedEncryptionRequired = true;
+ private boolean mUserAuthenticationRequired;
+ private int mUserAuthenticationValidityDurationSeconds = -1;
+
+ /**
+ * Creates a new instance of the {@code Builder}.
+ *
+ * @param purposes set of purposes (e.g., encrypt, decrypt, sign) for which the key can be
+ * used. Attempts to use the key for any other purpose will be rejected.
+ *
+ * <p><b>NOTE: The {@code purposes} parameter has currently no effect on asymmetric
+ * key pairs.</b>
+ *
+ * <p>See {@link KeyProperties}.{@code PURPOSE} flags.
+ */
+ public Builder(@KeyProperties.PurposeEnum int purposes) {
+ mPurposes = purposes;
+ }
+
+ /**
+ * Sets whether this {@link java.security.KeyStore} entry must be encrypted at rest.
+ * Encryption at rest will protect the entry with the secure lock screen credential (e.g.,
+ * password, PIN, or pattern).
+ *
+ * <p>Note that enabling this feature requires that the secure lock screen (e.g., password,
+ * PIN, pattern) is set up, otherwise setting the {@code KeyStore} entry will fail.
+ * Moreover, this entry will be deleted when the secure lock screen is disabled or reset
+ * (e.g., by the user or a Device Administrator). Finally, this entry cannot be used until
+ * the user unlocks the secure lock screen after boot.
+ *
+ * @see KeyguardManager#isDeviceSecure()
+ */
+ @NonNull
+ public Builder setEncryptionAtRestRequired(boolean required) {
+ if (required) {
+ mFlags |= KeyStore.FLAG_ENCRYPTED;
+ } else {
+ mFlags &= ~KeyStore.FLAG_ENCRYPTED;
+ }
+ return this;
+ }
+
+ /**
+ * Sets the time instant before which the key is not yet valid.
+ *
+ * <p>By default, the key is valid at any instant.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * @see #setKeyValidityEnd(Date)
+ */
+ @NonNull
+ public Builder setKeyValidityStart(Date startDate) {
+ mKeyValidityStart = startDate;
+ return this;
+ }
+
+ /**
+ * Sets the time instant after which the key is no longer valid.
+ *
+ * <p>By default, the key is valid at any instant.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * @see #setKeyValidityStart(Date)
+ * @see #setKeyValidityForConsumptionEnd(Date)
+ * @see #setKeyValidityForOriginationEnd(Date)
+ */
+ @NonNull
+ public Builder setKeyValidityEnd(Date endDate) {
+ setKeyValidityForOriginationEnd(endDate);
+ setKeyValidityForConsumptionEnd(endDate);
+ return this;
+ }
+
+ /**
+ * Sets the time instant after which the key is no longer valid for encryption and signing.
+ *
+ * <p>By default, the key is valid at any instant.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * @see #setKeyValidityForConsumptionEnd(Date)
+ */
+ @NonNull
+ public Builder setKeyValidityForOriginationEnd(Date endDate) {
+ mKeyValidityForOriginationEnd = endDate;
+ return this;
+ }
+
+ /**
+ * Sets the time instant after which the key is no longer valid for decryption and
+ * verification.
+ *
+ * <p>By default, the key is valid at any instant.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * @see #setKeyValidityForOriginationEnd(Date)
+ */
+ @NonNull
+ public Builder setKeyValidityForConsumptionEnd(Date endDate) {
+ mKeyValidityForConsumptionEnd = endDate;
+ return this;
+ }
+
+ /**
+ * Sets the set of padding schemes (e.g., {@code OAEPPadding}, {@code PKCS7Padding},
+ * {@code NoPadding}) with which the key can be used when encrypting/decrypting. Attempts to
+ * use the key with any other padding scheme will be rejected.
+ *
+ * <p>This must be specified for keys which are used for encryption/decryption.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * <p>See {@link KeyProperties}.{@code ENCRYPTION_PADDING} constants.
+ */
+ @NonNull
+ public Builder setEncryptionPaddings(
+ @KeyProperties.EncryptionPaddingEnum String... paddings) {
+ mEncryptionPaddings = ArrayUtils.cloneIfNotEmpty(paddings);
+ return this;
+ }
+
+ /**
+ * Sets the set of padding schemes (e.g., {@code PSS}, {@code PKCS#1}) with which the key
+ * can be used when signing/verifying. Attempts to use the key with any other padding scheme
+ * will be rejected.
+ *
+ * <p>This must be specified for RSA keys which are used for signing/verification.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * <p>See {@link KeyProperties}.{@code SIGNATURE_PADDING} constants.
+ */
+ @NonNull
+ public Builder setSignaturePaddings(
+ @KeyProperties.SignaturePaddingEnum String... paddings) {
+ mSignaturePaddings = ArrayUtils.cloneIfNotEmpty(paddings);
+ return this;
+ }
+
+ /**
+ * Sets the set of digest algorithms (e.g., {@code SHA-256}, {@code SHA-384}) with which the
+ * key can be used when signing/verifying or generating MACs. Attempts to use the key with
+ * any other digest algorithm will be rejected.
+ *
+ * <p>For HMAC keys, the default is the digest algorithm specified in
+ * {@link Key#getAlgorithm()}. For asymmetric signing keys the set of digest algorithms
+ * must be specified.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * <p>See {@link KeyProperties}.{@code DIGEST} constants.
+ */
+ @NonNull
+ public Builder setDigests(@KeyProperties.DigestEnum String... digests) {
+ mDigests = ArrayUtils.cloneIfNotEmpty(digests);
+ return this;
+ }
+
+ /**
+ * Sets the set of block modes (e.g., {@code CBC}, {@code CTR}, {@code ECB}) with which the
+ * key can be used when encrypting/decrypting. Attempts to use the key with any other block
+ * modes will be rejected.
+ *
+ * <p>This must be specified for encryption/decryption keys.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * <p>See {@link KeyProperties}.{@code BLOCK_MODE} constants.
+ */
+ @NonNull
+ public Builder setBlockModes(@KeyProperties.BlockModeEnum String... blockModes) {
+ mBlockModes = ArrayUtils.cloneIfNotEmpty(blockModes);
+ return this;
+ }
+
+ /**
+ * Sets whether encryption using this key must be sufficiently randomized to produce
+ * different ciphertexts for the same plaintext every time. The formal cryptographic
+ * property being required is <em>indistinguishability under chosen-plaintext attack
+ * ({@code IND-CPA})</em>. This property is important because it mitigates several classes
+ * of weaknesses due to which ciphertext may leak information about plaintext. For example,
+ * if a given plaintext always produces the same ciphertext, an attacker may see the
+ * repeated ciphertexts and be able to deduce something about the plaintext.
+ *
+ * <p>By default, {@code IND-CPA} is required.
+ *
+ * <p>When {@code IND-CPA} is required:
+ * <ul>
+ * <li>transformation which do not offer {@code IND-CPA}, such as symmetric ciphers using
+ * {@code ECB} mode or RSA encryption without padding, are prohibited;</li>
+ * <li>in transformations which use an IV, such as symmetric ciphers in {@code CBC},
+ * {@code CTR}, and {@code GCM} block modes, caller-provided IVs are rejected when
+ * encrypting, to ensure that only random IVs are used.</li>
+ *
+ * <p>Before disabling this requirement, consider the following approaches instead:
+ * <ul>
+ * <li>If you are generating a random IV for encryption and then initializing a {@code}
+ * Cipher using the IV, the solution is to let the {@code Cipher} generate a random IV
+ * instead. This will occur if the {@code Cipher} is initialized for encryption without an
+ * IV. The IV can then be queried via {@link Cipher#getIV()}.</li>
+ * <li>If you are generating a non-random IV (e.g., an IV derived from something not fully
+ * random, such as the name of the file being encrypted, or transaction ID, or password,
+ * or a device identifier), consider changing your design to use a random IV which will then
+ * be provided in addition to the ciphertext to the entities which need to decrypt the
+ * ciphertext.</li>
+ * <li>If you are using RSA encryption without padding, consider switching to padding
+ * schemes which offer {@code IND-CPA}, such as PKCS#1 or OAEP.</li>
+ * </ul>
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ */
+ @NonNull
+ public Builder setRandomizedEncryptionRequired(boolean required) {
+ mRandomizedEncryptionRequired = required;
+ return this;
+ }
+
+ /**
+ * Sets whether user authentication is required to use this key.
+ *
+ * <p>By default, the key can be used without user authentication.
+ *
+ * <p>When user authentication is required, the user authorizes the use of the key by
+ * authenticating to this Android device using a subset of their secure lock screen
+ * credentials. Different authentication methods are used depending on whether the every
+ * use of the key must be authenticated (as specified by
+ * {@link #setUserAuthenticationValidityDurationSeconds(int)}).
+ * <a href="{@docRoot}training/articles/keystore.html#UserAuthentication">More
+ * information</a>.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * @see #setUserAuthenticationValidityDurationSeconds(int)
+ */
+ @NonNull
+ public Builder setUserAuthenticationRequired(boolean required) {
+ mUserAuthenticationRequired = required;
+ return this;
+ }
+
+ /**
+ * Sets the duration of time (seconds) for which this key can be used after the user is
+ * successfully authenticated. This has effect only if user authentication is required.
+ *
+ * <p>By default, the user needs to authenticate for every use of the key.
+ *
+ * <p><b>NOTE: This has currently no effect on asymmetric key pairs.</b>
+ *
+ * @param seconds duration in seconds or {@code -1} if the user needs to authenticate for
+ * every use of the key.
+ *
+ * @see #setUserAuthenticationRequired(boolean)
+ */
+ @NonNull
+ public Builder setUserAuthenticationValidityDurationSeconds(
+ @IntRange(from = -1) int seconds) {
+ mUserAuthenticationValidityDurationSeconds = seconds;
+ return this;
+ }
+
+ /**
+ * Builds an instance of {@link KeyProtection}.
+ *
+ * @throws IllegalArgumentException if a required field is missing
+ */
+ @NonNull
+ public KeyProtection build() {
+ return new KeyProtection(
+ mFlags,
+ mKeyValidityStart,
+ mKeyValidityForOriginationEnd,
+ mKeyValidityForConsumptionEnd,
+ mPurposes,
+ mEncryptionPaddings,
+ mSignaturePaddings,
+ mDigests,
+ mBlockModes,
+ mRandomizedEncryptionRequired,
+ mUserAuthenticationRequired,
+ mUserAuthenticationValidityDurationSeconds);
+ }
+ }
+}
diff --git a/keystore/java/android/security/UserNotAuthenticatedException.java b/keystore/java/android/security/keystore/UserNotAuthenticatedException.java
similarity index 97%
rename from keystore/java/android/security/UserNotAuthenticatedException.java
rename to keystore/java/android/security/keystore/UserNotAuthenticatedException.java
index 2954fa7..21f861c 100644
--- a/keystore/java/android/security/UserNotAuthenticatedException.java
+++ b/keystore/java/android/security/keystore/UserNotAuthenticatedException.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.security;
+package android.security.keystore;
import java.security.InvalidKeyException;
diff --git a/keystore/tests/src/android/security/KeyPairGeneratorSpecTest.java b/keystore/tests/src/android/security/KeyPairGeneratorSpecTest.java
index 681a9ff..bc8dd13 100644
--- a/keystore/tests/src/android/security/KeyPairGeneratorSpecTest.java
+++ b/keystore/tests/src/android/security/KeyPairGeneratorSpecTest.java
@@ -24,11 +24,6 @@
import javax.security.auth.x500.X500Principal;
public class KeyPairGeneratorSpecTest extends AndroidTestCase {
- private static final X500Principal DEFAULT_CERT_SUBJECT = new X500Principal("CN=fake");
- private static final BigInteger DEFAULT_CERT_SERIAL_NUMBER = new BigInteger("1");
- private static final Date DEFAULT_CERT_NOT_BEFORE = new Date(0L); // Jan 1 1980
- private static final Date DEFAULT_CERT_NOT_AFTER = new Date(2461449600000L); // Jan 1 2048
-
private static final String TEST_ALIAS_1 = "test1";
private static final X500Principal TEST_DN_1 = new X500Principal("CN=test1");
@@ -110,37 +105,46 @@
}
}
- public void testConstructor_NullSubjectDN_Success() throws Exception {
- KeyPairGeneratorSpec spec = new KeyPairGeneratorSpec(
- getContext(), TEST_ALIAS_1, "RSA", 1024, null, null, SERIAL_1, NOW,
- NOW_PLUS_10_YEARS, 0);
- assertEquals(DEFAULT_CERT_SUBJECT, spec.getSubjectDN());
+ public void testConstructor_NullSubjectDN_Failure() throws Exception {
+ try {
+ new KeyPairGeneratorSpec(getContext(), TEST_ALIAS_1, "RSA", 1024, null, null, SERIAL_1, NOW,
+ NOW_PLUS_10_YEARS, 0);
+ fail("Should throw IllegalArgumentException when subjectDN is null");
+ } catch (IllegalArgumentException success) {
+ }
}
- public void testConstructor_NullSerial_Success() throws Exception {
- KeyPairGeneratorSpec spec = new KeyPairGeneratorSpec(
- getContext(), TEST_ALIAS_1, "RSA", 1024, null, TEST_DN_1, null, NOW,
- NOW_PLUS_10_YEARS, 0);
- assertEquals(DEFAULT_CERT_SERIAL_NUMBER, spec.getSerialNumber());
+ public void testConstructor_NullSerial_Failure() throws Exception {
+ try {
+ new KeyPairGeneratorSpec(getContext(), TEST_ALIAS_1, "RSA", 1024, null, TEST_DN_1, null, NOW,
+ NOW_PLUS_10_YEARS, 0);
+ fail("Should throw IllegalArgumentException when startDate is null");
+ } catch (IllegalArgumentException success) {
+ }
}
- public void testConstructor_NullStartDate_Success() throws Exception {
- KeyPairGeneratorSpec spec = new KeyPairGeneratorSpec(
- getContext(), TEST_ALIAS_1, "RSA", 1024, null, TEST_DN_1, SERIAL_1, null,
- NOW_PLUS_10_YEARS, 0);
- assertEquals(DEFAULT_CERT_NOT_BEFORE, spec.getStartDate());
+ public void testConstructor_NullStartDate_Failure() throws Exception {
+ try {
+ new KeyPairGeneratorSpec(getContext(), TEST_ALIAS_1, "RSA", 1024, null, TEST_DN_1, SERIAL_1,
+ null, NOW_PLUS_10_YEARS, 0);
+ fail("Should throw IllegalArgumentException when startDate is null");
+ } catch (IllegalArgumentException success) {
+ }
}
- public void testConstructor_NullEndDate_Success() throws Exception {
- KeyPairGeneratorSpec spec = new KeyPairGeneratorSpec(
- getContext(), TEST_ALIAS_1, "RSA", 1024, null, TEST_DN_1, SERIAL_1, NOW, null, 0);
- assertEquals(DEFAULT_CERT_NOT_AFTER, spec.getEndDate());
+ public void testConstructor_NullEndDate_Failure() throws Exception {
+ try {
+ new KeyPairGeneratorSpec(getContext(), TEST_ALIAS_1, "RSA", 1024, null, TEST_DN_1, SERIAL_1,
+ NOW, null, 0);
+ fail("Should throw IllegalArgumentException when keystoreAlias is null");
+ } catch (IllegalArgumentException success) {
+ }
}
public void testConstructor_EndBeforeStart_Failure() throws Exception {
try {
- new KeyPairGeneratorSpec(getContext(), TEST_ALIAS_1, "RSA", 1024, null, TEST_DN_1,
- SERIAL_1, NOW_PLUS_10_YEARS, NOW, 0);
+ new KeyPairGeneratorSpec(getContext(), TEST_ALIAS_1, "RSA", 1024, null, TEST_DN_1, SERIAL_1,
+ NOW_PLUS_10_YEARS, NOW, 0);
fail("Should throw IllegalArgumentException when end is before start");
} catch (IllegalArgumentException success) {
}
diff --git a/keystore/tests/src/android/security/KeyStoreTest.java b/keystore/tests/src/android/security/KeyStoreTest.java
index d138c24..7421120 100644
--- a/keystore/tests/src/android/security/KeyStoreTest.java
+++ b/keystore/tests/src/android/security/KeyStoreTest.java
@@ -21,7 +21,6 @@
import android.os.IBinder;
import android.os.Process;
import android.os.ServiceManager;
-import android.security.KeyStore;
import android.security.keymaster.ExportResult;
import android.security.keymaster.KeyCharacteristics;
import android.security.keymaster.KeymasterArguments;
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index 72198b6..6f28bf6 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -660,7 +660,7 @@
* surface in the current state.
* @throws IllegalArgumentException if the new surface is not of a suitable type for the codec.
*/
- public void setSurface(@NonNull Surface surface) {
+ public void setOutputSurface(@NonNull Surface surface) {
if (!mHasSurface) {
throw new IllegalStateException("codec was not configured for an output surface");
}
@@ -677,7 +677,7 @@
* <p>
* The application is responsible for calling release() on the Surface when done.
*
- * @return an input surface that can be used with {@link #usePersistentInputSurface}.
+ * @return an input surface that can be used with {@link #setInputSurface}.
*/
@NonNull
public static Surface createPersistentInputSurface() {
@@ -707,17 +707,17 @@
* @throws IllegalArgumentException if the surface was not created by
* {@link #createPersistentInputSurface}.
*/
- public void usePersistentInputSurface(@NonNull Surface surface) {
+ public void setInputSurface(@NonNull Surface surface) {
if (!(surface instanceof PersistentSurface)) {
throw new IllegalArgumentException("not a PersistentSurface");
}
- native_usePersistentInputSurface(surface);
+ native_setInputSurface(surface);
}
@NonNull
private static native final PersistentSurface native_createPersistentInputSurface();
private static native final void native_releasePersistentInputSurface(@NonNull Surface surface);
- private native final void native_usePersistentInputSurface(@NonNull Surface surface);
+ private native final void native_setInputSurface(@NonNull Surface surface);
private native final void native_setCallback(@Nullable Callback cb);
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index f27e635..ed2c4cbd 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -156,14 +156,14 @@
* @see MediaCodec#createPersistentInputSurface
* @see MediaRecorder.VideoSource
*/
- public void usePersistentSurface(@NonNull Surface surface) {
+ public void setInputSurface(@NonNull Surface surface) {
if (!(surface instanceof MediaCodec.PersistentSurface)) {
throw new IllegalArgumentException("not a PersistentSurface");
}
- native_usePersistentSurface(surface);
+ native_setInputSurface(surface);
}
- private native final void native_usePersistentSurface(@NonNull Surface surface);
+ private native final void native_setInputSurface(@NonNull Surface surface);
/**
* Sets a Surface to show a preview of recorded media (video). Calls this
diff --git a/media/java/android/media/tv/ITvInputSessionWrapper.java b/media/java/android/media/tv/ITvInputSessionWrapper.java
index 0191652..58954bd 100644
--- a/media/java/android/media/tv/ITvInputSessionWrapper.java
+++ b/media/java/android/media/tv/ITvInputSessionWrapper.java
@@ -18,6 +18,7 @@
import android.content.Context;
import android.graphics.Rect;
+import android.media.PlaybackParams;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
@@ -172,7 +173,10 @@
break;
}
case DO_TIME_SHIFT_SET_PLAYBACK_RATE: {
- mTvInputSessionImpl.timeShiftSetPlaybackRate((Float) msg.obj, msg.arg1);
+ PlaybackParams params = new PlaybackParams()
+ .setSpeed((Float) msg.obj)
+ .setAudioFallbackMode(msg.arg1);
+ mTvInputSessionImpl.timeShiftSetPlaybackParams(params);
break;
}
case DO_TIME_SHIFT_ENABLE_POSITION_TRACKING: {
diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java
index 8b0472a..4b84090 100644
--- a/media/java/android/media/tv/TvInputService.java
+++ b/media/java/android/media/tv/TvInputService.java
@@ -26,6 +26,8 @@
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.hardware.hdmi.HdmiDeviceInfo;
+import android.media.PlaybackParams;
+import android.media.tv.TvInputService.HardwareSession;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -586,7 +588,7 @@
* set playback rate and audio mode. The implementation should override
* {@link #onTimeShiftPause}, {@link #onTimeShiftResume}, {@link #onTimeShiftSeekTo},
* {@link #onTimeShiftGetStartPosition}, {@link #onTimeShiftGetCurrentPosition} and
- * {@link #onTimeShiftSetPlaybackRate}.
+ * {@link #onTimeShiftSetPlaybackParams}.
*
* @param status The current time shift status. Should be one of the followings.
* <ul>
@@ -853,7 +855,7 @@
*
* @see #onTimeShiftResume
* @see #onTimeShiftSeekTo
- * @see #onTimeShiftSetPlaybackRate
+ * @see #onTimeShiftSetPlaybackParams
* @see #onTimeShiftGetStartPosition
* @see #onTimeShiftGetCurrentPosition
*/
@@ -865,7 +867,7 @@
*
* @see #onTimeShiftPause
* @see #onTimeShiftSeekTo
- * @see #onTimeShiftSetPlaybackRate
+ * @see #onTimeShiftSetPlaybackParams
* @see #onTimeShiftGetStartPosition
* @see #onTimeShiftGetCurrentPosition
*/
@@ -881,7 +883,7 @@
* @param timeMs The time position to seek to, in milliseconds since the epoch.
* @see #onTimeShiftResume
* @see #onTimeShiftPause
- * @see #onTimeShiftSetPlaybackRate
+ * @see #onTimeShiftSetPlaybackParams
* @see #onTimeShiftGetStartPosition
* @see #onTimeShiftGetCurrentPosition
*/
@@ -889,25 +891,20 @@
}
/**
- * Called when the application sets playback rate and audio mode.
+ * Called when the application sets playback parameters containing the speed and audio mode.
*
- * <p>Once a playback rate is set, the implementation should honor the value until a new
- * tune request. Pause/resume/seek request does not reset the playback rate previously set.
+ * <p>Once the playback parameters are set, the implementation should honor the current
+ * settings until the next tune request. Pause/resume/seek request does not reset the
+ * parameters previously set.
*
- * @param rate The ratio between desired playback rate and normal one.
- * @param audioMode Audio playback mode. Must be one of the supported audio modes:
- * <ul>
- * <li> {@link android.media.MediaPlayer#PLAYBACK_RATE_AUDIO_MODE_DEFAULT}
- * <li> {@link android.media.MediaPlayer#PLAYBACK_RATE_AUDIO_MODE_STRETCH}
- * <li> {@link android.media.MediaPlayer#PLAYBACK_RATE_AUDIO_MODE_RESAMPLE}
- * </ul>
+ * @param params The playback params.
* @see #onTimeShiftResume
* @see #onTimeShiftPause
* @see #onTimeShiftSeekTo
* @see #onTimeShiftGetStartPosition
* @see #onTimeShiftGetCurrentPosition
*/
- public void onTimeShiftSetPlaybackRate(float rate, int audioMode) {
+ public void onTimeShiftSetPlaybackParams(PlaybackParams params) {
}
/**
@@ -924,7 +921,7 @@
* @see #onTimeShiftResume
* @see #onTimeShiftPause
* @see #onTimeShiftSeekTo
- * @see #onTimeShiftSetPlaybackRate
+ * @see #onTimeShiftSetPlaybackParams
* @see #onTimeShiftGetCurrentPosition
*/
public long onTimeShiftGetStartPosition() {
@@ -939,7 +936,7 @@
* @see #onTimeShiftResume
* @see #onTimeShiftPause
* @see #onTimeShiftSeekTo
- * @see #onTimeShiftSetPlaybackRate
+ * @see #onTimeShiftSetPlaybackParams
* @see #onTimeShiftGetStartPosition
*/
public long onTimeShiftGetCurrentPosition() {
@@ -1273,10 +1270,10 @@
}
/**
- * Calls {@link #onTimeShiftSetPlaybackRate}.
+ * Calls {@link #onTimeShiftSetPlaybackParams}.
*/
- void timeShiftSetPlaybackRate(float rate, int audioMode) {
- onTimeShiftSetPlaybackRate(rate, audioMode);
+ void timeShiftSetPlaybackParams(PlaybackParams params) {
+ onTimeShiftSetPlaybackParams(params);
}
/**
diff --git a/media/java/android/media/tv/TvTrackInfo.java b/media/java/android/media/tv/TvTrackInfo.java
index 2c956e9..ed432c46 100644
--- a/media/java/android/media/tv/TvTrackInfo.java
+++ b/media/java/android/media/tv/TvTrackInfo.java
@@ -45,7 +45,7 @@
private final int mType;
private final String mId;
private final String mLanguage;
- private final String mDescription;
+ private final CharSequence mDescription;
private final int mAudioChannelCount;
private final int mAudioSampleRate;
private final int mVideoWidth;
@@ -54,7 +54,7 @@
private final float mVideoPixelAspectRatio;
private final Bundle mExtra;
- private TvTrackInfo(int type, String id, String language, String description,
+ private TvTrackInfo(int type, String id, String language, CharSequence description,
int audioChannelCount, int audioSampleRate, int videoWidth, int videoHeight,
float videoFrameRate, float videoPixelAspectRatio, Bundle extra) {
mType = type;
@@ -110,7 +110,7 @@
/**
* Returns a user readable description for the current track.
*/
- public final String getDescription() {
+ public final CharSequence getDescription() {
return mDescription;
}
@@ -201,7 +201,7 @@
dest.writeInt(mType);
dest.writeString(mId);
dest.writeString(mLanguage);
- dest.writeString(mDescription);
+ dest.writeString(mDescription != null ? mDescription.toString() : null);
dest.writeInt(mAudioChannelCount);
dest.writeInt(mAudioSampleRate);
dest.writeInt(mVideoWidth);
@@ -231,7 +231,7 @@
private final String mId;
private final int mType;
private String mLanguage;
- private String mDescription;
+ private CharSequence mDescription;
private int mAudioChannelCount;
private int mAudioSampleRate;
private int mVideoWidth;
@@ -274,7 +274,7 @@
*
* @param description The user readable description.
*/
- public final Builder setDescription(String description) {
+ public final Builder setDescription(CharSequence description) {
mDescription = description;
return this;
}
diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java
index ebe281f..6169eea 100644
--- a/media/java/android/media/tv/TvView.java
+++ b/media/java/android/media/tv/TvView.java
@@ -24,9 +24,11 @@
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.Region;
+import android.media.PlaybackParams;
import android.media.tv.TvInputManager.Session;
import android.media.tv.TvInputManager.Session.FinishedInputEventCallback;
import android.media.tv.TvInputManager.SessionCallback;
+import android.media.tv.TvView.TimeShiftPositionCallback;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@@ -468,19 +470,13 @@
}
/**
- * Sets playback rate and audio mode.
+ * Sets playback rate using {@link android.media#PlaybackParams}.
*
- * @param rate The ratio between desired playback rate and normal one.
- * @param audioMode Audio playback mode. Must be one of the supported audio modes:
- * <ul>
- * <li> {@link android.media.MediaPlayer#PLAYBACK_RATE_AUDIO_MODE_DEFAULT}
- * <li> {@link android.media.MediaPlayer#PLAYBACK_RATE_AUDIO_MODE_STRETCH}
- * <li> {@link android.media.MediaPlayer#PLAYBACK_RATE_AUDIO_MODE_RESAMPLE}
- * </ul>
+ * @param params The playback params.
*/
- public void timeShiftSetPlaybackRate(float rate, int audioMode) {
+ public void timeShiftSetPlaybackParams(@NonNull PlaybackParams params) {
if (mSession != null) {
- mSession.timeShiftSetPlaybackRate(rate, audioMode);
+ mSession.timeShiftSetPlaybackRate(params.getSpeed(), params.getAudioFallbackMode());
}
}
@@ -820,6 +816,9 @@
* limitation on storage space). The application should not allow the user to seek to a
* position earlier than the start position.
*
+ * <p>Note that {@code timeMs} is not relative time in the program but wall-clock time,
+ * which is intended to avoid calling this method unnecessarily around program boundaries.
+ *
* @param inputId The ID of the TV input bound to this view.
* @param timeMs The start playback position of the time shifted program, in milliseconds
* since the epoch.
@@ -830,6 +829,9 @@
/**
* This is called when the current playback position is changed.
*
+ * <p>Note that {@code timeMs} is not relative time in the program but wall-clock time,
+ * which is intended to avoid calling this method unnecessarily around program boundaries.
+ *
* @param inputId The ID of the TV input bound to this view.
* @param timeMs The current playback position of the time shifted program, in milliseconds
* since the epoch.
diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp
index 31fb37c..93b8ec7 100644
--- a/media/jni/android_media_MediaCodec.cpp
+++ b/media/jni/android_media_MediaCodec.cpp
@@ -272,9 +272,9 @@
return mCodec->createInputSurface(bufferProducer);
}
-status_t JMediaCodec::usePersistentInputSurface(
+status_t JMediaCodec::setInputSurface(
const sp<PersistentSurface> &surface) {
- return mCodec->usePersistentInputSurface(surface);
+ return mCodec->setInputSurface(surface);
}
status_t JMediaCodec::start() {
@@ -1034,9 +1034,9 @@
// no need to release surface as it will be released by Surface's jni
}
-static void android_media_MediaCodec_usePersistentInputSurface(
+static void android_media_MediaCodec_setInputSurface(
JNIEnv* env, jobject thiz, jobject object) {
- ALOGV("android_media_MediaCodec_usePersistentInputSurface");
+ ALOGV("android_media_MediaCodec_setInputSurface");
sp<JMediaCodec> codec = getMediaCodec(env, thiz);
if (codec == NULL) {
@@ -1047,7 +1047,7 @@
sp<PersistentSurface> persistentSurface =
android_media_MediaCodec_getPersistentInputSurface(env, object);
- status_t err = codec->usePersistentInputSurface(persistentSurface);
+ status_t err = codec->setInputSurface(persistentSurface);
if (err != NO_ERROR) {
throwExceptionAsNecessary(env, err);
}
@@ -1741,8 +1741,8 @@
"()Landroid/media/MediaCodec$PersistentSurface;",
(void *)android_media_MediaCodec_createPersistentInputSurface },
- { "native_usePersistentInputSurface", "(Landroid/view/Surface;)V",
- (void *)android_media_MediaCodec_usePersistentInputSurface },
+ { "native_setInputSurface", "(Landroid/view/Surface;)V",
+ (void *)android_media_MediaCodec_setInputSurface },
{ "native_setCallback",
"(Landroid/media/MediaCodec$Callback;)V",
diff --git a/media/jni/android_media_MediaCodec.h b/media/jni/android_media_MediaCodec.h
index bf61f42..a4ed67b 100644
--- a/media/jni/android_media_MediaCodec.h
+++ b/media/jni/android_media_MediaCodec.h
@@ -58,7 +58,7 @@
const sp<IGraphicBufferProducer> &surface);
status_t createInputSurface(sp<IGraphicBufferProducer>* bufferProducer);
- status_t usePersistentInputSurface(const sp<PersistentSurface> &surface);
+ status_t setInputSurface(const sp<PersistentSurface> &surface);
status_t start();
status_t stop();
diff --git a/media/jni/android_media_MediaRecorder.cpp b/media/jni/android_media_MediaRecorder.cpp
index 0044bed..f60af63 100644
--- a/media/jni/android_media_MediaRecorder.cpp
+++ b/media/jni/android_media_MediaRecorder.cpp
@@ -496,16 +496,16 @@
android_media_MediaRecorder_release(env, thiz);
}
-void android_media_MediaRecorder_usePersistentSurface(
+void android_media_MediaRecorder_setInputSurface(
JNIEnv* env, jobject thiz, jobject object) {
- ALOGV("android_media_MediaRecorder_usePersistentSurface");
+ ALOGV("android_media_MediaRecorder_setInputSurface");
sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
sp<PersistentSurface> persistentSurface = get_persistentSurface(env, object);
- process_media_recorder_call(env, mr->usePersistentSurface(persistentSurface),
- "java/lang/IllegalArgumentException", "native_usePersistentSurface failed.");
+ process_media_recorder_call(env, mr->setInputSurface(persistentSurface),
+ "java/lang/IllegalArgumentException", "native_setInputSurface failed.");
}
// ----------------------------------------------------------------------------
@@ -534,7 +534,7 @@
{"native_setup", "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V",
(void *)android_media_MediaRecorder_native_setup},
{"native_finalize", "()V", (void *)android_media_MediaRecorder_native_finalize},
- {"native_usePersistentSurface", "(Landroid/view/Surface;)V", (void *)android_media_MediaRecorder_usePersistentSurface },
+ {"native_setInputSurface", "(Landroid/view/Surface;)V", (void *)android_media_MediaRecorder_setInputSurface },
};
// This function only registers the native methods, and is called from
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java
index 563b0f3..35540e3 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java
@@ -252,7 +252,7 @@
if (persistentSurface != null) {
Log.v(TAG, "using persistent surface");
surface = persistentSurface;
- recorder.usePersistentSurface(surface);
+ recorder.setInputSurface(surface);
}
recorder.prepare();
if (persistentSurface == null) {
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
index d13d71c..1cee642 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -24,7 +24,6 @@
import android.app.admin.DevicePolicyManager;
import android.app.trust.TrustManager;
import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -56,7 +55,6 @@
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
-import android.hardware.fingerprint.FingerprintUtils;
import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
@@ -367,14 +365,8 @@
Log.d(TAG, "Fingerprint disabled by DPM for userId: " + userId);
return;
}
- final ContentResolver res = mContext.getContentResolver();
- final int ids[] = FingerprintUtils.getFingerprintIdsForUser(res, userId);
- for (int i = 0; i < ids.length; i++) {
- // TODO: fix once HAL supports storing group id
- final boolean isCorrectUser = true || (groupId == userId);
- if (ids[i] == fingerId && isCorrectUser) {
- onFingerprintAuthenticated(userId);
- }
+ if (groupId == userId) {
+ onFingerprintAuthenticated(groupId);
}
} finally {
setFingerprintRunningDetectionRunning(false);
diff --git a/packages/SettingsLib/src/com/android/settingslib/applications/PermissionsInfo.java b/packages/SettingsLib/src/com/android/settingslib/applications/PermissionsInfo.java
index 60b5ba5..8b38a5f 100644
--- a/packages/SettingsLib/src/com/android/settingslib/applications/PermissionsInfo.java
+++ b/packages/SettingsLib/src/com/android/settingslib/applications/PermissionsInfo.java
@@ -22,7 +22,6 @@
import android.content.pm.PermissionGroupInfo;
import android.content.pm.PermissionInfo;
import android.graphics.drawable.Drawable;
-import android.graphics.drawable.ShapeDrawable;
import android.os.AsyncTask;
import android.os.Build;
import android.os.UserHandle;
@@ -80,8 +79,10 @@
if (info.protectionLevel == PermissionInfo.PROTECTION_DANGEROUS) {
group = new PermissionGroup();
// TODO: Add default permission icon.
- group.icon = info.icon != 0 ? info.loadIcon(mPm) : new ShapeDrawable();
+ group.icon = info.icon != 0 ? info.loadIcon(mPm) : mContext.getDrawable(
+ com.android.internal.R.drawable.ic_perm_device_info);
group.name = info.name;
+ group.packageName = info.packageName;
group.label = info.loadLabel(mPm).toString();
mGroups.add(group);
mGroupLookup.put(permission, group);
@@ -103,8 +104,10 @@
for (PermissionGroupInfo groupInfo : groups) {
PermissionGroup group = new PermissionGroup();
// TODO: Add default permission icon.
- group.icon = groupInfo.icon != 0 ? groupInfo.loadIcon(mPm) : new ShapeDrawable();
+ group.icon = groupInfo.icon != 0 ? groupInfo.loadIcon(mPm) : mContext.getDrawable(
+ com.android.internal.R.drawable.ic_perm_device_info);
group.name = groupInfo.name;
+ group.packageName = groupInfo.packageName;
group.label = groupInfo.loadLabel(mPm).toString();
synchronized (mGroups) {
mGroups.add(group);
@@ -172,6 +175,7 @@
public final List<String> possibleApps = new ArrayList<>();
public final List<String> grantedApps = new ArrayList<>();
public String name;
+ public String packageName;
public String label;
public Drawable icon;
diff --git a/packages/SystemUI/res/layout/volume_zen_footer.xml b/packages/SystemUI/res/layout/volume_zen_footer.xml
index 998741c..eede804 100644
--- a/packages/SystemUI/res/layout/volume_zen_footer.xml
+++ b/packages/SystemUI/res/layout/volume_zen_footer.xml
@@ -26,7 +26,7 @@
android:layout_height="1dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
- android:background="#4dffffff" />
+ android:background="@color/qs_tile_divider" />
<LinearLayout
android:layout_width="match_parent"
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 6e79423..354e99d 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -69,9 +69,6 @@
<!-- Show rotation lock toggle in System UI-->
<bool name="config_showRotationLock">true</bool>
- <!-- Amount of time to hold off before showing the search panel when the user presses home -->
- <integer name="config_show_search_delay">200</integer>
-
<!-- Vibration duration for GlowPadView used in SearchPanelView -->
<integer translatable="false" name="config_vibration_duration">0</integer>
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 6479dc5..74962ec 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -1335,7 +1335,7 @@
// Don't actually hide the Keyguard at the moment, wait for window
// manager until it tells us it's safe to do so with
// startKeyguardExitAnimation.
- mWM.keyguardGoingAway(
+ ActivityManagerNative.getDefault().keyguardGoingAway(
mStatusBarKeyguardViewManager.shouldDisableWindowAnimationsForUnlock(),
mStatusBarKeyguardViewManager.isGoingToNotificationShade());
} catch (RemoteException e) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 588ec26..2913c7d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -395,11 +395,6 @@
Toast.LENGTH_SHORT).show();
}
}
- } else if (DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED.equals(
- action)) {
- mUsersAllowingPrivateNotifications.clear();
- updateLockscreenNotificationSetting();
- updateNotifications();
} else if (BANNER_ACTION_CANCEL.equals(action) || BANNER_ACTION_SETUP.equals(action)) {
NotificationManager noMan = (NotificationManager)
mContext.getSystemService(Context.NOTIFICATION_SERVICE);
@@ -419,6 +414,19 @@
}
};
+ private final BroadcastReceiver mAllUsersReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ if (DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED.equals(action) &&
+ isCurrentProfile(getSendingUserId())) {
+ mUsersAllowingPrivateNotifications.clear();
+ updateLockscreenNotificationSetting();
+ updateNotifications();
+ }
+ }
+ };
+
private final NotificationListenerService mNotificationListener =
new NotificationListenerService() {
@Override
@@ -631,9 +639,13 @@
filter.addAction(Intent.ACTION_USER_PRESENT);
filter.addAction(BANNER_ACTION_CANCEL);
filter.addAction(BANNER_ACTION_SETUP);
- filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
mContext.registerReceiver(mBroadcastReceiver, filter);
+ IntentFilter allUsersFilter = new IntentFilter();
+ allUsersFilter.addAction(
+ DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
+ mContext.registerReceiverAsUser(mAllUsersReceiver, UserHandle.ALL, allUsersFilter,
+ null, null);
updateCurrentProfilesCache();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index f983f58..887b8f4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -79,6 +79,7 @@
import android.view.ThreadedRenderer;
import android.view.VelocityTracker;
import android.view.View;
+import android.view.ViewConfiguration;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewStub;
import android.view.WindowManager;
@@ -1197,8 +1198,7 @@
}
private void updateShowSearchHoldoff() {
- mShowSearchHoldoff = mContext.getResources().getInteger(
- R.integer.config_show_search_delay);
+ mShowSearchHoldoff = ViewConfiguration.getLongPressTimeout();
}
private void updateNotificationShade() {
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
index e6c95b5..23813d1 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
@@ -176,7 +176,7 @@
final CharSequence text = mContext.getString(R.string.ext_media_missing_message);
final Notification notif = new Notification.Builder(mContext)
- .setSmallIcon(R.drawable.stat_notify_sdcard)
+ .setSmallIcon(R.drawable.ic_sd_card_48dp)
.setColor(mContext.getColor(R.color.system_notification_accent_color))
.setContentTitle(title)
.setContentText(text)
@@ -313,9 +313,10 @@
final PendingIntent initIntent = buildInitPendingIntent(vol);
return buildNotificationBuilder(vol, title, text)
- .addAction(new Action(0, mContext.getString(R.string.ext_media_init_action),
- initIntent))
- .addAction(new Action(0, mContext.getString(R.string.ext_media_unmount_action),
+ .addAction(new Action(R.drawable.ic_settings_24dp,
+ mContext.getString(R.string.ext_media_init_action), initIntent))
+ .addAction(new Action(R.drawable.ic_eject_24dp,
+ mContext.getString(R.string.ext_media_unmount_action),
buildUnmountPendingIntent(vol)))
.setContentIntent(initIntent)
.setDeleteIntent(buildSnoozeIntent(vol))
@@ -329,9 +330,11 @@
final PendingIntent browseIntent = buildBrowsePendingIntent(vol);
return buildNotificationBuilder(vol, title, text)
- .addAction(new Action(0, mContext.getString(R.string.ext_media_browse_action),
+ .addAction(new Action(R.drawable.ic_folder_24dp,
+ mContext.getString(R.string.ext_media_browse_action),
browseIntent))
- .addAction(new Action(0, mContext.getString(R.string.ext_media_unmount_action),
+ .addAction(new Action(R.drawable.ic_eject_24dp,
+ mContext.getString(R.string.ext_media_unmount_action),
buildUnmountPendingIntent(vol)))
.setContentIntent(browseIntent)
.setDeleteIntent(buildSnoozeIntent(vol))
@@ -430,7 +433,7 @@
}
final Notification notif = new Notification.Builder(mContext)
- .setSmallIcon(R.drawable.stat_notify_sdcard)
+ .setSmallIcon(R.drawable.ic_sd_card_48dp)
.setColor(mContext.getColor(R.color.system_notification_accent_color))
.setContentTitle(title)
.setContentText(text)
@@ -477,7 +480,7 @@
}
final Notification notif = new Notification.Builder(mContext)
- .setSmallIcon(R.drawable.stat_notify_sdcard)
+ .setSmallIcon(R.drawable.ic_sd_card_48dp)
.setColor(mContext.getColor(R.color.system_notification_accent_color))
.setContentTitle(title)
.setContentText(text)
@@ -498,14 +501,14 @@
switch (state) {
case VolumeInfo.STATE_CHECKING:
case VolumeInfo.STATE_EJECTING:
- return R.drawable.stat_notify_sdcard_prepare;
+ return R.drawable.ic_sd_card_48dp;
default:
- return R.drawable.stat_notify_sdcard;
+ return R.drawable.ic_sd_card_48dp;
}
} else if (disk.isUsb()) {
- return R.drawable.stat_sys_data_usb;
+ return R.drawable.ic_usb_48dp;
} else {
- return R.drawable.stat_notify_sdcard;
+ return R.drawable.ic_sd_card_48dp;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
index 4bc45df..6e0ca3c 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
@@ -533,8 +533,7 @@
}
Util.setVisOrInvis(row.settingsButton, false);
row.header.setAlpha(mExpanded && isActive ? 1 : 0.5f);
- row.slider.setProgressTintList(isActive ? mActiveSliderTint : mInactiveSliderTint);
- row.slider.setThumbTintList(isActive ? mActiveSliderTint : mInactiveSliderTint);
+ updateVolumeRowSliderTintH(row, isActive);
}
}
@@ -666,8 +665,18 @@
updateVolumeRowSliderH(row, zenMuted);
}
+ private void updateVolumeRowSliderTintH(VolumeRow row, boolean isActive) {
+ final ColorStateList tint = isActive && row.slider.isEnabled() ? mActiveSliderTint
+ : mInactiveSliderTint;
+ if (tint == row.cachedSliderTint) return;
+ row.cachedSliderTint = tint;
+ row.slider.setProgressTintList(tint);
+ row.slider.setThumbTintList(tint);
+ }
+
private void updateVolumeRowSliderH(VolumeRow row, boolean zenMuted) {
row.slider.setEnabled(!zenMuted);
+ updateVolumeRowSliderTintH(row, row.stream == mActiveStream);
if (row.tracking) {
return; // don't update if user is sliding
}
@@ -1027,6 +1036,7 @@
private int iconMuteRes;
private boolean important;
private int cachedIconRes;
+ private ColorStateList cachedSliderTint;
private int iconState; // from Events
private boolean cachedShowHeaders = VolumePrefs.DEFAULT_SHOW_HEADERS;
private int cachedExpandButtonRes;
diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java b/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java
index 66c4993..6d67d11 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java
@@ -127,7 +127,7 @@
Util.setText(mSummaryLine1, line1);
final String line2 = ZenModeConfig.getConditionSummary(mContext, mConfig,
- mController.getCurrentUser());
+ mController.getCurrentUser(), true /*shortVersion*/);
Util.setText(mSummaryLine2, line2);
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
index b3b6725..8dfa9b0 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
@@ -438,7 +438,8 @@
final long span = time - now;
if (span <= 0 || span > MAX_BUCKET_MINUTES * MINUTES_MS) return null;
return ZenModeConfig.toTimeCondition(context,
- time, Math.round(span / (float) MINUTES_MS), now, ActivityManager.getCurrentUser());
+ time, Math.round(span / (float) MINUTES_MS), now, ActivityManager.getCurrentUser(),
+ false /*shortVersion*/);
}
private void handleUpdateConditions(Condition[] conditions) {
@@ -717,7 +718,8 @@
if (up && bucketTime > time || !up && bucketTime < time) {
mBucketIndex = j;
newCondition = ZenModeConfig.toTimeCondition(mContext,
- bucketTime, bucketMinutes, now, ActivityManager.getCurrentUser());
+ bucketTime, bucketMinutes, now, ActivityManager.getCurrentUser(),
+ false /*shortVersion*/);
break;
}
}
diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java
index ed2de4a..2df7f79 100644
--- a/services/core/java/com/android/server/LockSettingsService.java
+++ b/services/core/java/com/android/server/LockSettingsService.java
@@ -106,20 +106,13 @@
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_USER_ADDED.equals(intent.getAction())) {
+ // Notify keystore that a new user was added.
final int userHandle = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0);
- final int userSysUid = UserHandle.getUid(userHandle, Process.SYSTEM_UID);
final KeyStore ks = KeyStore.getInstance();
-
- // Clear up keystore in case anything was left behind by previous users
- ks.resetUid(userSysUid);
-
- // If this user has a parent, sync with its keystore password
final UserManager um = (UserManager) mContext.getSystemService(USER_SERVICE);
final UserInfo parentInfo = um.getProfileParent(userHandle);
- if (parentInfo != null) {
- final int parentSysUid = UserHandle.getUid(parentInfo.id, Process.SYSTEM_UID);
- ks.syncUid(parentSysUid, userSysUid);
- }
+ final int parentHandle = parentInfo != null ? parentInfo.id : -1;
+ ks.onUserAdded(userHandle, parentHandle);
} else if (Intent.ACTION_USER_STARTING.equals(intent.getAction())) {
final int userHandle = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0);
mStorage.prefetchUser(userHandle);
@@ -674,8 +667,7 @@
mStorage.removeUser(userId);
final KeyStore ks = KeyStore.getInstance();
- final int userUid = UserHandle.getUid(userId, Process.SYSTEM_UID);
- ks.resetUid(userUid);
+ ks.onUserRemoved(userId);
}
private static final String[] VALID_SETTINGS = new String[] {
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index f4671a9..0ee1ae4 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -2573,7 +2573,7 @@
if (mFocusedActivity.userId != mLastFocusedUserId) {
mHandler.removeMessages(FOREGROUND_PROFILE_CHANGED_MSG);
mHandler.sendMessage(mHandler.obtainMessage(FOREGROUND_PROFILE_CHANGED_MSG,
- mFocusedActivity.userId, 0));
+ mFocusedActivity.userId, 0));
mLastFocusedUserId = mFocusedActivity.userId;
}
}
@@ -5962,7 +5962,7 @@
void postFinishBooting(boolean finishBooting, boolean enableScreen) {
mHandler.sendMessage(mHandler.obtainMessage(FINISH_BOOTING_MSG,
- finishBooting? 1 : 0, enableScreen ? 1 : 0));
+ finishBooting ? 1 : 0, enableScreen ? 1 : 0));
}
void enableScreenAfterBoot() {
@@ -6002,6 +6002,26 @@
}
}
+ @Override
+ public void keyguardGoingAway(boolean disableWindowAnimations,
+ boolean keyguardGoingToNotificationShade) {
+ enforceNotIsolatedCaller("keyguardGoingAway");
+ final long token = Binder.clearCallingIdentity();
+ try {
+ synchronized (this) {
+ if (DEBUG_LOCKSCREEN) logLockScreen("");
+ mWindowManager.keyguardGoingAway(disableWindowAnimations,
+ keyguardGoingToNotificationShade);
+ if (mLockScreenShown == LOCK_SCREEN_SHOWN) {
+ mLockScreenShown = LOCK_SCREEN_HIDDEN;
+ updateSleepIfNeededLocked();
+ }
+ }
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
final void finishBooting() {
synchronized (this) {
if (!mBootAnimationComplete) {
diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java
index 4c08960..bb4ff1e 100644
--- a/services/core/java/com/android/server/connectivity/Tethering.java
+++ b/services/core/java/com/android/server/connectivity/Tethering.java
@@ -608,12 +608,12 @@
tetherUsb(true);
} else {
mUsbTetherRequested = true;
- usbManager.setCurrentFunction(UsbManager.USB_FUNCTION_RNDIS, false);
+ usbManager.setCurrentFunction(UsbManager.USB_FUNCTION_RNDIS);
}
} else {
tetherUsb(false);
if (mRndisEnabled) {
- usbManager.setCurrentFunction(null, false);
+ usbManager.setCurrentFunction(null);
}
mUsbTetherRequested = false;
}
diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java
index 0faccc6..aa143e4 100644
--- a/services/core/java/com/android/server/fingerprint/FingerprintService.java
+++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java
@@ -31,7 +31,6 @@
import com.android.server.SystemService;
-import android.hardware.fingerprint.FingerprintUtils;
import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.IFingerprintService;
@@ -93,6 +92,7 @@
private Context mContext;
private int mHalDeviceId;
private int mFailedAttempts;
+ private final FingerprintUtils mFingerprintUtils = FingerprintUtils.getInstance();
private final Runnable mLockoutReset = new Runnable() {
@Override
public void run() {
@@ -172,7 +172,6 @@
* @return true if the operation is done, i.e. authentication completed
*/
boolean dispatchNotify(ClientMonitor clientMonitor, int type, int arg1, int arg2, int arg3) {
- ContentResolver contentResolver = mContext.getContentResolver();
boolean operationCompleted = false;
int fpId;
int groupId;
@@ -198,7 +197,7 @@
remaining = arg3;
operationCompleted = clientMonitor.sendEnrollResult(fpId, groupId, remaining);
if (remaining == 0) {
- addTemplateForUser(clientMonitor, contentResolver, fpId);
+ addTemplateForUser(clientMonitor, fpId);
operationCompleted = true; // enroll completed
}
break;
@@ -207,7 +206,7 @@
groupId = arg2;
operationCompleted = clientMonitor.sendRemoved(fpId, groupId);
if (fpId != 0) {
- removeTemplateForUser(clientMonitor, contentResolver, fpId);
+ removeTemplateForUser(clientMonitor, fpId);
}
break;
}
@@ -252,16 +251,12 @@
return false;
}
- private void removeTemplateForUser(ClientMonitor clientMonitor, ContentResolver contentResolver,
- final int fingerId) {
- FingerprintUtils.removeFingerprintIdForUser(fingerId, contentResolver,
- clientMonitor.userId);
+ private void removeTemplateForUser(ClientMonitor clientMonitor, int fingerId) {
+ mFingerprintUtils.removeFingerprintIdForUser(mContext, fingerId, clientMonitor.userId);
}
- private void addTemplateForUser(ClientMonitor clientMonitor, ContentResolver contentResolver,
- final int fingerId) {
- FingerprintUtils.addFingerprintIdForUser(contentResolver, fingerId,
- clientMonitor.userId);
+ private void addTemplateForUser(ClientMonitor clientMonitor, int fingerId) {
+ mFingerprintUtils.addFingerprintForUser(mContext, fingerId, clientMonitor.userId);
}
void startEnrollment(IBinder token, byte[] cryptoToken, int groupId,
@@ -345,24 +340,11 @@
}
public List<Fingerprint> getEnrolledFingerprints(int groupId) {
- ContentResolver resolver = mContext.getContentResolver();
- int[] ids = FingerprintUtils.getFingerprintIdsForUser(resolver, groupId);
- List<Fingerprint> result = new ArrayList<Fingerprint>();
- for (int i = 0; i < ids.length; i++) {
- // TODO: persist names in Settings
- CharSequence name = "Finger" + ids[i];
- final int group = 0; // TODO
- final int fingerId = ids[i];
- final long deviceId = 0; // TODO
- Fingerprint item = new Fingerprint(name, 0, ids[i], 0);
- result.add(item);
- }
- return result;
+ return mFingerprintUtils.getFingerprintsForUser(mContext, groupId);
}
public boolean hasEnrolledFingerprints(int groupId) {
- ContentResolver resolver = mContext.getContentResolver();
- return FingerprintUtils.getFingerprintIdsForUser(resolver, groupId).length > 0;
+ return mFingerprintUtils.getFingerprintsForUser(mContext, groupId).size() > 0;
}
void checkPermission(String permission) {
@@ -596,7 +578,7 @@
mHandler.post(new Runnable() {
@Override
public void run() {
- Slog.w(TAG, "rename id=" + fingerId + ",gid=" + groupId + ",name=" + name);
+ mFingerprintUtils.renameFingerprintForUser(mContext, fingerId, groupId, name);
}
});
}
diff --git a/services/core/java/com/android/server/fingerprint/FingerprintUtils.java b/services/core/java/com/android/server/fingerprint/FingerprintUtils.java
new file mode 100644
index 0000000..1e6e105
--- /dev/null
+++ b/services/core/java/com/android/server/fingerprint/FingerprintUtils.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.fingerprint;
+
+import android.content.Context;
+import android.hardware.fingerprint.Fingerprint;
+import android.os.Vibrator;
+import android.util.SparseArray;
+
+import com.android.internal.annotations.GuardedBy;
+
+import java.util.List;
+
+/**
+ * Utility class for dealing with fingerprints and fingerprint settings.
+ */
+public class FingerprintUtils {
+
+ private static final long[] FP_ERROR_VIBRATE_PATTERN = new long[] {0, 30, 100, 30};
+ private static final long[] FP_SUCCESS_VIBRATE_PATTERN = new long[] {0, 30};
+
+ private static final Object sInstanceLock = new Object();
+ private static FingerprintUtils sInstance;
+
+ @GuardedBy("this")
+ private final SparseArray<FingerprintsUserState> mUsers = new SparseArray<>();
+
+ public static FingerprintUtils getInstance() {
+ synchronized (sInstanceLock) {
+ if (sInstance == null) {
+ sInstance = new FingerprintUtils();
+ }
+ }
+ return sInstance;
+ }
+
+ private FingerprintUtils() {
+ }
+
+ public List<Fingerprint> getFingerprintsForUser(Context ctx, int userId) {
+ return getStateForUser(ctx, userId).getFingerprints();
+ }
+
+ public void addFingerprintForUser(Context ctx, int fingerId, int userId) {
+ getStateForUser(ctx, userId).addFingerprint(fingerId);
+ }
+
+ public void removeFingerprintIdForUser(Context ctx, int fingerId, int userId) {
+ getStateForUser(ctx, userId).removeFingerprint(fingerId);
+ }
+
+ public void renameFingerprintForUser(Context ctx, int fingerId, int userId, CharSequence name) {
+ getStateForUser(ctx, userId).renameFingerprint(fingerId, name);
+ }
+
+ public static void vibrateFingerprintError(Context context) {
+ Vibrator vibrator = context.getSystemService(Vibrator.class);
+ if (vibrator != null) {
+ vibrator.vibrate(FP_ERROR_VIBRATE_PATTERN, -1);
+ }
+ }
+
+ public static void vibrateFingerprintSuccess(Context context) {
+ Vibrator vibrator = context.getSystemService(Vibrator.class);
+ if (vibrator != null) {
+ vibrator.vibrate(FP_SUCCESS_VIBRATE_PATTERN, -1);
+ }
+ }
+
+ private FingerprintsUserState getStateForUser(Context ctx, int userId) {
+ synchronized (this) {
+ FingerprintsUserState state = mUsers.get(userId);
+ if (state == null) {
+ state = new FingerprintsUserState(ctx, userId);
+ mUsers.put(userId, state);
+ }
+ return state;
+ }
+ }
+}
+
diff --git a/services/core/java/com/android/server/fingerprint/FingerprintsUserState.java b/services/core/java/com/android/server/fingerprint/FingerprintsUserState.java
new file mode 100644
index 0000000..33177b4
--- /dev/null
+++ b/services/core/java/com/android/server/fingerprint/FingerprintsUserState.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.server.fingerprint;
+
+import android.content.Context;
+import android.hardware.fingerprint.Fingerprint;
+import android.os.AsyncTask;
+import android.os.Environment;
+import android.util.AtomicFile;
+import android.util.Slog;
+import android.util.Xml;
+
+import com.android.internal.annotations.GuardedBy;
+
+import libcore.io.IoUtils;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlSerializer;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Class managing the set of fingerprint per user across device reboots.
+ */
+class FingerprintsUserState {
+
+ private static final String TAG = "FingerprintState";
+ private static final String FINGERPRINT_FILE = "settings_fingerprint.xml";
+
+ private static final String TAG_FINGERPRINTS = "fingerprints";
+ private static final String TAG_FINGERPRINT = "fingerprint";
+ private static final String ATTR_NAME = "name";
+ private static final String ATTR_GROUP_ID = "groupId";
+ private static final String ATTR_FINGER_ID = "fingerId";
+ private static final String ATTR_DEVICE_ID = "deviceId";
+
+ private final File mFile;
+
+ @GuardedBy("this")
+ private final ArrayList<Fingerprint> mFingerprints = new ArrayList<>();
+ private final Context mCtx;
+
+ public FingerprintsUserState(Context ctx, int userId) {
+ mFile = getFileForUser(userId);
+ mCtx = ctx;
+ synchronized (this) {
+ readStateSyncLocked();
+ }
+ }
+
+ public void addFingerprint(int fingerId) {
+ synchronized (this) {
+ mFingerprints.add(new Fingerprint(getDefaultFingerprintName(fingerId), 0, fingerId, 0));
+ scheduleWriteStateLocked();
+ }
+ }
+
+ public void removeFingerprint(int fingerId) {
+ synchronized (this) {
+ for (int i = 0; i < mFingerprints.size(); i++) {
+ if (mFingerprints.get(i).getFingerId() == fingerId) {
+ mFingerprints.remove(i);
+ scheduleWriteStateLocked();
+ break;
+ }
+ }
+ }
+ }
+
+ public void renameFingerprint(int fingerId, CharSequence name) {
+ synchronized (this) {
+ for (int i = 0; i < mFingerprints.size(); i++) {
+ if (mFingerprints.get(i).getFingerId() == fingerId) {
+ Fingerprint old = mFingerprints.get(i);
+ mFingerprints.set(i, new Fingerprint(name, old.getGroupId(), old.getFingerId(),
+ old.getDeviceId()));
+ scheduleWriteStateLocked();
+ break;
+ }
+ }
+ }
+ }
+
+ public List<Fingerprint> getFingerprints() {
+ synchronized (this) {
+ return getCopy(mFingerprints);
+ }
+ }
+
+ private String getDefaultFingerprintName(int fingerId) {
+ return mCtx.getString(com.android.internal.R.string.fingerprint_name_template, fingerId);
+ }
+
+ private static File getFileForUser(int userId) {
+ return new File(Environment.getUserSystemDirectory(userId), FINGERPRINT_FILE);
+ }
+
+ private final Runnable mWriteStateRunnable = new Runnable() {
+ @Override
+ public void run() {
+ doWriteState();
+ }
+ };
+
+ private void scheduleWriteStateLocked() {
+ AsyncTask.execute(mWriteStateRunnable);
+ }
+
+ private ArrayList<Fingerprint> getCopy(ArrayList<Fingerprint> array) {
+ ArrayList<Fingerprint> result = new ArrayList<>(array.size());
+ for (int i = 0; i < array.size(); i++) {
+ Fingerprint fp = array.get(i);
+ result.add(new Fingerprint(fp.getName(), fp.getGroupId(), fp.getFingerId(),
+ fp.getDeviceId()));
+ }
+ return result;
+ }
+
+ private void doWriteState() {
+ AtomicFile destination = new AtomicFile(mFile);
+
+ ArrayList<Fingerprint> fingerprints;
+
+ synchronized (this) {
+ fingerprints = getCopy(mFingerprints);
+ }
+
+ FileOutputStream out = null;
+ try {
+ out = destination.startWrite();
+
+ XmlSerializer serializer = Xml.newSerializer();
+ serializer.setOutput(out, "utf-8");
+ serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
+ serializer.startDocument(null, true);
+ serializer.startTag(null, TAG_FINGERPRINTS);
+
+ final int count = fingerprints.size();
+ for (int i = 0; i < count; i++) {
+ Fingerprint fp = fingerprints.get(i);
+ serializer.startTag(null, TAG_FINGERPRINT);
+ serializer.attribute(null, ATTR_FINGER_ID, Integer.toString(fp.getFingerId()));
+ serializer.attribute(null, ATTR_NAME, fp.getName().toString());
+ serializer.attribute(null, ATTR_GROUP_ID, Integer.toString(fp.getGroupId()));
+ serializer.attribute(null, ATTR_DEVICE_ID, Long.toString(fp.getDeviceId()));
+ serializer.endTag(null, TAG_FINGERPRINT);
+ }
+
+ serializer.endTag(null, TAG_FINGERPRINTS);
+ serializer.endDocument();
+ destination.finishWrite(out);
+
+ // Any error while writing is fatal.
+ } catch (Throwable t) {
+ Slog.wtf(TAG, "Failed to write settings, restoring backup", t);
+ destination.failWrite(out);
+ throw new IllegalStateException("Failed to write fingerprints", t);
+ } finally {
+ IoUtils.closeQuietly(out);
+ }
+ }
+
+ private void readStateSyncLocked() {
+ FileInputStream in;
+ if (!mFile.exists()) {
+ return;
+ }
+ try {
+ in = new FileInputStream(mFile);
+ } catch (FileNotFoundException fnfe) {
+ Slog.i(TAG, "No fingerprint state");
+ return;
+ }
+ try {
+ XmlPullParser parser = Xml.newPullParser();
+ parser.setInput(in, null);
+ parseStateLocked(parser);
+
+ } catch (XmlPullParserException | IOException e) {
+ throw new IllegalStateException("Failed parsing settings file: "
+ + mFile , e);
+ } finally {
+ IoUtils.closeQuietly(in);
+ }
+ }
+
+ private void parseStateLocked(XmlPullParser parser)
+ throws IOException, XmlPullParserException {
+ final int outerDepth = parser.getDepth();
+ int type;
+ while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
+ && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
+ if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
+ continue;
+ }
+
+ String tagName = parser.getName();
+ if (tagName.equals(TAG_FINGERPRINTS)) {
+ parseFingerprintsLocked(parser);
+ }
+ }
+ }
+
+ private void parseFingerprintsLocked(XmlPullParser parser)
+ throws IOException, XmlPullParserException {
+
+ final int outerDepth = parser.getDepth();
+ int type;
+ while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
+ && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
+ if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
+ continue;
+ }
+
+ String tagName = parser.getName();
+ if (tagName.equals(TAG_FINGERPRINT)) {
+ String name = parser.getAttributeValue(null, ATTR_NAME);
+ String groupId = parser.getAttributeValue(null, ATTR_GROUP_ID);
+ String fingerId = parser.getAttributeValue(null, ATTR_FINGER_ID);
+ String deviceId = parser.getAttributeValue(null, ATTR_DEVICE_ID);
+ mFingerprints.add(new Fingerprint(name, Integer.parseInt(groupId),
+ Integer.parseInt(fingerId), Integer.parseInt(deviceId)));
+ }
+ }
+ }
+
+}
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 5d91fb4..290fb657 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -1622,16 +1622,16 @@
}
@Override
- public void notifyConditions(String pkg, IConditionProvider provider,
- Condition[] conditions) {
+ public void notifyConditions(final String pkg, IConditionProvider provider,
+ final Condition[] conditions) {
final ManagedServiceInfo info = mConditionProviders.checkServiceToken(provider);
checkCallerIsSystemOrSameApp(pkg);
- final long identity = Binder.clearCallingIdentity();
- try {
- mConditionProviders.notifyConditions(pkg, info, conditions);
- } finally {
- Binder.restoreCallingIdentity(identity);
- }
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ mConditionProviders.notifyConditions(pkg, info, conditions);
+ }
+ });
}
@Override
diff --git a/services/core/java/com/android/server/notification/ScheduleConditionProvider.java b/services/core/java/com/android/server/notification/ScheduleConditionProvider.java
index bca13c2..f06f54c 100644
--- a/services/core/java/com/android/server/notification/ScheduleConditionProvider.java
+++ b/services/core/java/com/android/server/notification/ScheduleConditionProvider.java
@@ -57,6 +57,7 @@
private boolean mConnected;
private boolean mRegistered;
+ private long mNextAlarmTime;
public ScheduleConditionProvider() {
if (DEBUG) Slog.d(TAG, "new " + SIMPLE_NAME + "()");
@@ -84,6 +85,12 @@
pw.print(meetsSchedule(conditionId, now) ? "* " : " ");
pw.println(conditionId);
}
+ pw.print(" mNextAlarmTime="); pw.print(mNextAlarmTime);
+ if (mNextAlarmTime > 0) {
+ pw.printf(" (%s, in %s, now=%s)", ts(mNextAlarmTime),
+ formatDuration(mNextAlarmTime - now), ts(now));
+ }
+ pw.println();
}
@Override
@@ -141,7 +148,7 @@
private void evaluateSubscriptions() {
setRegistered(!mSubscriptions.isEmpty());
final long now = System.currentTimeMillis();
- long nextAlarmTime = 0;
+ mNextAlarmTime = 0;
for (Uri conditionId : mSubscriptions) {
final ScheduleCalendar cal = toScheduleCalendar(conditionId);
if (cal != null && cal.isInSchedule(now)) {
@@ -152,13 +159,13 @@
if (cal != null) {
final long nextChangeTime = cal.getNextChangeTime(now);
if (nextChangeTime > 0 && nextChangeTime > now) {
- if (nextAlarmTime == 0 || nextChangeTime < nextAlarmTime) {
- nextAlarmTime = nextChangeTime;
+ if (mNextAlarmTime == 0 || nextChangeTime < mNextAlarmTime) {
+ mNextAlarmTime = nextChangeTime;
}
}
}
}
- updateAlarm(now, nextAlarmTime);
+ updateAlarm(now, mNextAlarmTime);
}
private void updateAlarm(long now, long time) {
@@ -209,7 +216,8 @@
}
private void notifyCondition(Uri conditionId, int state, String reason) {
- if (DEBUG) Slog.d(TAG, "notifyCondition " + Condition.stateToString(state)
+ if (DEBUG) Slog.d(TAG, "notifyCondition " + conditionId
+ + " " + Condition.stateToString(state)
+ " reason=" + reason);
notifyCondition(createCondition(conditionId, state));
}
diff --git a/services/core/java/com/android/server/notification/ZenModeConditions.java b/services/core/java/com/android/server/notification/ZenModeConditions.java
index fa314de..f1c58bd 100644
--- a/services/core/java/com/android/server/notification/ZenModeConditions.java
+++ b/services/core/java/com/android/server/notification/ZenModeConditions.java
@@ -63,7 +63,7 @@
mConditionProviders.requestConditions(callback, relevance);
}
- public void evaluateConfig(ZenModeConfig config) {
+ public void evaluateConfig(ZenModeConfig config, boolean processSubscriptione) {
if (config == null) return;
if (config.manualRule != null && config.manualRule.condition != null
&& !config.manualRule.isTrueOrUnknown()) {
@@ -71,18 +71,20 @@
config.manualRule = null;
}
final ArraySet<Uri> current = new ArraySet<>();
- evaluateRule(config.manualRule, current);
+ evaluateRule(config.manualRule, current, processSubscriptione);
for (ZenRule automaticRule : config.automaticRules.values()) {
- evaluateRule(automaticRule, current);
+ evaluateRule(automaticRule, current, processSubscriptione);
updateSnoozing(automaticRule);
}
final int N = mSubscriptions.size();
for (int i = N - 1; i >= 0; i--) {
final Uri id = mSubscriptions.keyAt(i);
final ComponentName component = mSubscriptions.valueAt(i);
- if (!current.contains(id)) {
- mConditionProviders.unsubscribeIfNecessary(component, id);
- mSubscriptions.removeAt(i);
+ if (processSubscriptione) {
+ if (!current.contains(id)) {
+ mConditionProviders.unsubscribeIfNecessary(component, id);
+ mSubscriptions.removeAt(i);
+ }
}
}
mFirstEvaluation = false;
@@ -122,7 +124,7 @@
}
}
- private void evaluateRule(ZenRule rule, ArraySet<Uri> current) {
+ private void evaluateRule(ZenRule rule, ArraySet<Uri> current, boolean processSubscriptions) {
if (rule == null || rule.conditionId == null) return;
final Uri id = rule.conditionId;
boolean isSystemCondition = false;
@@ -148,10 +150,12 @@
if (current != null) {
current.add(id);
}
- if (mConditionProviders.subscribeIfNecessary(rule.component, rule.conditionId)) {
- mSubscriptions.put(rule.conditionId, rule.component);
- } else {
- if (DEBUG) Log.d(TAG, "zmc failed to subscribe");
+ if (processSubscriptions) {
+ if (mConditionProviders.subscribeIfNecessary(rule.component, rule.conditionId)) {
+ mSubscriptions.put(rule.conditionId, rule.component);
+ } else {
+ if (DEBUG) Log.d(TAG, "zmc failed to subscribe");
+ }
}
}
diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java
index ce7ea5e..a3c36ed 100644
--- a/services/core/java/com/android/server/notification/ZenModeHelper.java
+++ b/services/core/java/com/android/server/notification/ZenModeHelper.java
@@ -264,7 +264,7 @@
Log.w(TAG, "Invalid config in setConfig; " + config);
return false;
}
- mConditions.evaluateConfig(config); // may modify config
+ mConditions.evaluateConfig(config, false /*processSubscriptions*/); // may modify config
if (config.equals(mConfig)) return true;
if (DEBUG) Log.d(TAG, "setConfig reason=" + reason, new Throwable());
ZenLog.traceConfig(reason, config);
@@ -280,6 +280,7 @@
if (!evaluateZenMode(reason, setRingerMode)) {
applyRestrictions(); // evaluateZenMode will also apply restrictions if changed
}
+ mConditions.evaluateConfig(config, true /*processSubscriptions*/);
return true;
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 6f48209..19210c9 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -4161,7 +4161,7 @@
}
// If there is nothing selected, add all candidates and remove the ones that the User
// has explicitely put into the INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER state and
- // also remove any Browser Apps ones.
+ // also remove any undefined ones and Browser Apps ones.
// If there is still none after this pass, add all undefined one and Browser Apps and
// let the User decide with the Disambiguation dialog if there are several ones.
if (result.size() == 0) {
@@ -4169,6 +4169,7 @@
}
result.removeAll(neverList);
result.removeAll(matchAllList);
+ result.removeAll(undefinedList);
if (result.size() == 0) {
result.addAll(undefinedList);
if ((flags & MATCH_ALL) != 0) {
diff --git a/services/core/java/com/android/server/wm/AppWindowAnimator.java b/services/core/java/com/android/server/wm/AppWindowAnimator.java
index 55ec9fc..21011e8 100644
--- a/services/core/java/com/android/server/wm/AppWindowAnimator.java
+++ b/services/core/java/com/android/server/wm/AppWindowAnimator.java
@@ -36,6 +36,7 @@
final WindowAnimator mAnimator;
boolean animating;
+ boolean wasAnimating;
Animation animation;
boolean hasTransformation;
final Transformation transformation = new Transformation();
diff --git a/services/core/java/com/android/server/wm/WindowAnimator.java b/services/core/java/com/android/server/wm/WindowAnimator.java
index 52071cc..9169351 100644
--- a/services/core/java/com/android/server/wm/WindowAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowAnimator.java
@@ -30,9 +30,9 @@
import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_ACTION_PENDING;
import android.content.Context;
+import android.os.RemoteException;
import android.util.Slog;
import android.util.SparseArray;
-import android.util.SparseIntArray;
import android.util.TimeUtils;
import android.view.Display;
import android.view.SurfaceControl;
@@ -98,15 +98,13 @@
// forceHiding states.
static final int KEYGUARD_NOT_SHOWN = 0;
- static final int KEYGUARD_ANIMATING_IN = 1;
- static final int KEYGUARD_SHOWN = 2;
- static final int KEYGUARD_ANIMATING_OUT = 3;
+ static final int KEYGUARD_SHOWN = 1;
+ static final int KEYGUARD_ANIMATING_OUT = 2;
int mForceHiding = KEYGUARD_NOT_SHOWN;
private String forceHidingToString() {
switch (mForceHiding) {
case KEYGUARD_NOT_SHOWN: return "KEYGUARD_NOT_SHOWN";
- case KEYGUARD_ANIMATING_IN: return "KEYGUARD_ANIMATING_IN";
case KEYGUARD_SHOWN: return "KEYGUARD_SHOWN";
case KEYGUARD_ANIMATING_OUT:return "KEYGUARD_ANIMATING_OUT";
default: return "KEYGUARD STATE UNKNOWN " + mForceHiding;
@@ -157,11 +155,11 @@
final AppTokenList tokens = tasks.get(taskNdx).mAppTokens;
for (int tokenNdx = tokens.size() - 1; tokenNdx >= 0; --tokenNdx) {
final AppWindowAnimator appAnimator = tokens.get(tokenNdx).mAppAnimator;
- final boolean wasAnimating = appAnimator.animation != null
- && appAnimator.animation != AppWindowAnimator.sDummyAnimation;
+ appAnimator.wasAnimating = appAnimator.animating;
if (appAnimator.stepAnimationLocked(mCurrentTime, displayId)) {
+ appAnimator.animating = true;
mAnimating = mAppWindowAnimating = true;
- } else if (wasAnimating) {
+ } else if (appAnimator.wasAnimating) {
// stopped animating, do one more pass through the layout
setAppLayoutChanges(appAnimator,
WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER,
@@ -173,14 +171,13 @@
}
final AppTokenList exitingAppTokens = stack.mExitingAppTokens;
- final int NEAT = exitingAppTokens.size();
- for (int i = 0; i < NEAT; i++) {
+ final int exitingCount = exitingAppTokens.size();
+ for (int i = 0; i < exitingCount; i++) {
final AppWindowAnimator appAnimator = exitingAppTokens.get(i).mAppAnimator;
- final boolean wasAnimating = appAnimator.animation != null
- && appAnimator.animation != AppWindowAnimator.sDummyAnimation;
+ appAnimator.wasAnimating = appAnimator.animating;
if (appAnimator.stepAnimationLocked(mCurrentTime, displayId)) {
mAnimating = mAppWindowAnimating = true;
- } else if (wasAnimating) {
+ } else if (appAnimator.wasAnimating) {
// stopped animating, do one more pass through the layout
setAppLayoutChanges(appAnimator, WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER,
"exiting appToken " + appAnimator.mAppToken + " done", displayId);
@@ -206,9 +203,7 @@
|| (win.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0 && win.isAnimatingLw()
// Show error dialogs over apps that dismiss keyguard.
|| (win.mAttrs.privateFlags & PRIVATE_FLAG_SYSTEM_ERROR) != 0)));
- return ((mForceHiding == KEYGUARD_ANIMATING_IN)
- && (!win.mWinAnimator.isAnimating() || hideWhenLocked))
- || ((mForceHiding == KEYGUARD_SHOWN) && hideWhenLocked);
+ return (mForceHiding == KEYGUARD_SHOWN) && hideWhenLocked;
}
private void updateWindowsLocked(final int displayId) {
@@ -259,8 +254,27 @@
if (winAnimator.mSurfaceControl != null) {
final boolean wasAnimating = winAnimator.mWasAnimating;
final boolean nowAnimating = winAnimator.stepAnimationLocked(mCurrentTime);
+ winAnimator.mWasAnimating = nowAnimating;
mAnimating |= nowAnimating;
+ boolean appWindowAnimating = winAnimator.mAppAnimator != null
+ && winAnimator.mAppAnimator.animating;
+ boolean wasAppWindowAnimating = winAnimator.mAppAnimator != null
+ && winAnimator.mAppAnimator.wasAnimating;
+ boolean anyAnimating = appWindowAnimating || nowAnimating;
+ boolean anyWasAnimating = wasAppWindowAnimating || wasAnimating;
+
+ try {
+ if (anyAnimating && !anyWasAnimating) {
+ win.mClient.onAnimationStarted(
+ winAnimator.mKeyguardGoingAwayAnimation ? 1 : 0);
+ } else if (!anyAnimating && anyWasAnimating) {
+ win.mClient.onAnimationStopped();
+ }
+ } catch (RemoteException e) {
+ Slog.w(TAG, "Failed to dispatch window animation state change.", e);
+ }
+
if (WindowManagerService.DEBUG_WALLPAPER) {
Slog.v(TAG, win + ": wasAnimating=" + wasAnimating +
", nowAnimating=" + nowAnimating);
@@ -297,11 +311,7 @@
}
if (win.isReadyForDisplay()) {
if (nowAnimating) {
- if (winAnimator.mAnimationIsEntrance) {
- mForceHiding = KEYGUARD_ANIMATING_IN;
- } else {
- mForceHiding = KEYGUARD_ANIMATING_OUT;
- }
+ mForceHiding = KEYGUARD_ANIMATING_OUT;
} else {
mForceHiding = win.isDrawnLw() ? KEYGUARD_SHOWN : KEYGUARD_NOT_SHOWN;
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 57bad51..77694b6 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -16,44 +16,13 @@
package com.android.server.wm;
-import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID;
-import static android.view.WindowManager.LayoutParams.*;
-
-import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
-import android.app.AppOpsManager;
-import android.os.Build;
-import android.os.SystemService;
-import android.util.ArraySet;
-import android.util.TimeUtils;
-import android.view.IWindowId;
-
-import android.view.IWindowSessionCallback;
-import android.view.WindowContentFrameStats;
-import com.android.internal.app.IAssistScreenshotReceiver;
-import com.android.internal.app.IBatteryStats;
-import com.android.internal.util.FastPrintWriter;
-import com.android.internal.view.IInputContext;
-import com.android.internal.view.IInputMethodClient;
-import com.android.internal.view.IInputMethodManager;
-import com.android.internal.view.WindowManagerPolicyThread;
-import com.android.server.AttributeCache;
-import com.android.server.DisplayThread;
-import com.android.server.EventLogTags;
-import com.android.server.FgThread;
-import com.android.server.LocalServices;
-import com.android.server.UiThread;
-import com.android.server.Watchdog;
-import com.android.server.am.BatteryStatsService;
-import com.android.server.input.InputManagerService;
-import com.android.server.power.ShutdownThread;
-import com.android.server.policy.PhoneWindowManager;
-
import android.Manifest;
+import android.animation.ValueAnimator;
import android.app.ActivityManagerNative;
+import android.app.AppOpsManager;
import android.app.IActivityManager;
import android.app.StatusBarManager;
import android.app.admin.DevicePolicyManager;
-import android.animation.ValueAnimator;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
@@ -75,6 +44,7 @@
import android.hardware.display.DisplayManagerInternal;
import android.net.Uri;
import android.os.Binder;
+import android.os.Build;
import android.os.Bundle;
import android.os.Debug;
import android.os.Handler;
@@ -92,17 +62,20 @@
import android.os.StrictMode;
import android.os.SystemClock;
import android.os.SystemProperties;
+import android.os.SystemService;
import android.os.Trace;
import android.os.UserHandle;
import android.os.WorkSource;
import android.provider.Settings;
+import android.util.ArraySet;
import android.util.DisplayMetrics;
import android.util.EventLog;
import android.util.Log;
-import android.util.SparseArray;
import android.util.Pair;
import android.util.Slog;
+import android.util.SparseArray;
import android.util.SparseIntArray;
+import android.util.TimeUtils;
import android.util.TypedValue;
import android.view.Choreographer;
import android.view.Display;
@@ -113,8 +86,10 @@
import android.view.IOnKeyguardExitResult;
import android.view.IRotationWatcher;
import android.view.IWindow;
+import android.view.IWindowId;
import android.view.IWindowManager;
import android.view.IWindowSession;
+import android.view.IWindowSessionCallback;
import android.view.InputChannel;
import android.view.InputDevice;
import android.view.InputEvent;
@@ -122,21 +97,41 @@
import android.view.KeyEvent;
import android.view.MagnificationSpec;
import android.view.MotionEvent;
-import android.view.WindowManagerInternal;
-import android.view.Surface.OutOfResourcesException;
import android.view.Surface;
+import android.view.Surface.OutOfResourcesException;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
import android.view.View;
+import android.view.WindowContentFrameStats;
import android.view.WindowManager;
-import android.view.WindowManagerGlobal;
-import android.view.WindowManagerPolicy;
import android.view.WindowManager.LayoutParams;
+import android.view.WindowManagerGlobal;
+import android.view.WindowManagerInternal;
+import android.view.WindowManagerPolicy;
import android.view.WindowManagerPolicy.FakeWindow;
import android.view.WindowManagerPolicy.PointerEventListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
+import com.android.internal.app.IAssistScreenshotReceiver;
+import com.android.internal.app.IBatteryStats;
+import com.android.internal.util.FastPrintWriter;
+import com.android.internal.view.IInputContext;
+import com.android.internal.view.IInputMethodClient;
+import com.android.internal.view.IInputMethodManager;
+import com.android.internal.view.WindowManagerPolicyThread;
+import com.android.server.AttributeCache;
+import com.android.server.DisplayThread;
+import com.android.server.EventLogTags;
+import com.android.server.FgThread;
+import com.android.server.LocalServices;
+import com.android.server.UiThread;
+import com.android.server.Watchdog;
+import com.android.server.am.BatteryStatsService;
+import com.android.server.input.InputManagerService;
+import com.android.server.policy.PhoneWindowManager;
+import com.android.server.power.ShutdownThread;
+
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.File;
@@ -157,6 +152,41 @@
import java.util.Iterator;
import java.util.List;
+import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW;
+import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
+import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+import static android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND;
+import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
+import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
+import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
+import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
+import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
+import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
+import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
+import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
+import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
+import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
+import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
+import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
+import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
+import static android.view.WindowManager.LayoutParams.TYPE_BOOT_PROGRESS;
+import static android.view.WindowManager.LayoutParams.TYPE_DREAM;
+import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
+import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
+import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG;
+import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_SCRIM;
+import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;
+import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
+import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG;
+import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
+import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION;
+import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
+import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
+import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID;
+
/** {@hide} */
public class WindowManagerService extends IWindowManager.Stub
implements Watchdog.Monitor, WindowManagerPolicy.WindowManagerFuncs {
@@ -426,12 +456,6 @@
Runnable mWaitingForDrawnCallback;
/**
- * Windows that have called relayout() while we were running animations,
- * so we need to tell when the animation is done.
- */
- final ArrayList<WindowState> mRelayoutWhileAnimating = new ArrayList<WindowState>();
-
- /**
* Used when rebuilding window list to keep track of windows that have
* been removed.
*/
@@ -3340,10 +3364,6 @@
TAG, "Relayout of " + win + ": focusMayChange=" + focusMayChange);
inTouchMode = mInTouchMode;
- animating = mAnimator.mAnimating && win.mWinAnimator.isAnimating();
- if (animating && !mRelayoutWhileAnimating.contains(win)) {
- mRelayoutWhileAnimating.add(win);
- }
mInputMonitor.updateInputWindowsLw(true /*force*/);
@@ -3360,8 +3380,7 @@
return (inTouchMode ? WindowManagerGlobal.RELAYOUT_RES_IN_TOUCH_MODE : 0)
| (toBeDisplayed ? WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME : 0)
- | (surfaceChanged ? WindowManagerGlobal.RELAYOUT_RES_SURFACE_CHANGED : 0)
- | (animating ? WindowManagerGlobal.RELAYOUT_RES_ANIMATING : 0);
+ | (surfaceChanged ? WindowManagerGlobal.RELAYOUT_RES_SURFACE_CHANGED : 0);
}
public void performDeferredDestroyWindow(Session session, IWindow client) {
@@ -10239,16 +10258,6 @@
}
}
- if (!mAnimator.mAnimating && mRelayoutWhileAnimating.size() > 0) {
- for (int j=mRelayoutWhileAnimating.size()-1; j>=0; j--) {
- try {
- mRelayoutWhileAnimating.get(j).mClient.doneAnimating();
- } catch (RemoteException e) {
- }
- }
- mRelayoutWhileAnimating.clear();
- }
-
if (wallpaperDestroyed) {
defaultDisplay.pendingLayoutChanges |=
WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index cdd9503..ec89b37 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -276,9 +276,6 @@
// This must be called while inside a transaction. Returns true if
// there is more animation to run.
boolean stepAnimationLocked(long currentTime) {
- // Save the animation state as it was before this step so WindowManagerService can tell if
- // we just started or just stopped animating by comparing mWasAnimating with isAnimating().
- mWasAnimating = mAnimating;
final DisplayContent displayContent = mWin.getDisplayContent();
if (displayContent != null && mService.okToDisplay()) {
// We will run animations as long as the display isn't frozen.
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java b/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java
index 88bf54e..d5b0804 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java
@@ -116,9 +116,9 @@
/**
* Creates an instance of the device owner object with the device initializer set.
*/
- static DeviceOwner createWithDeviceInitializer(ComponentName admin, String ownerName) {
+ static DeviceOwner createWithDeviceInitializer(ComponentName admin) {
DeviceOwner owner = new DeviceOwner();
- owner.mDeviceInitializer = new OwnerInfo(ownerName, admin);
+ owner.mDeviceInitializer = new OwnerInfo(null, admin);
return owner;
}
@@ -155,12 +155,8 @@
return mDeviceInitializer != null ? mDeviceInitializer.packageName : null;
}
- String getDeviceInitializerName() {
- return mDeviceInitializer != null ? mDeviceInitializer.name : null;
- }
-
- void setDeviceInitializer(ComponentName admin, String ownerName) {
- mDeviceInitializer = new OwnerInfo(ownerName, admin);
+ void setDeviceInitializer(ComponentName admin) {
+ mDeviceInitializer = new OwnerInfo(null, admin);
}
void clearDeviceInitializer() {
@@ -255,16 +251,15 @@
String packageName = parser.getAttributeValue(null, ATTR_PACKAGE);
mDeviceOwner = new OwnerInfo(name, packageName);
} else if (tag.equals(TAG_DEVICE_INITIALIZER)) {
- String name = parser.getAttributeValue(null, ATTR_NAME);
String packageName = parser.getAttributeValue(null, ATTR_PACKAGE);
String initializerComponentStr =
parser.getAttributeValue(null, ATTR_COMPONENT_NAME);
ComponentName admin =
ComponentName.unflattenFromString(initializerComponentStr);
if (admin != null) {
- mDeviceInitializer = new OwnerInfo(name, admin);
+ mDeviceInitializer = new OwnerInfo(null, admin);
} else {
- mDeviceInitializer = new OwnerInfo(name, packageName);
+ mDeviceInitializer = new OwnerInfo(null, packageName);
Slog.e(TAG, "Error parsing device-owner file. Bad component name " +
initializerComponentStr);
}
@@ -334,9 +329,6 @@
if (mDeviceInitializer != null) {
out.startTag(null, TAG_DEVICE_INITIALIZER);
out.attribute(null, ATTR_PACKAGE, mDeviceInitializer.packageName);
- if (mDeviceInitializer.name != null) {
- out.attribute(null, ATTR_NAME, mDeviceInitializer.name);
- }
if (mDeviceInitializer.admin != null) {
out.attribute(
null, ATTR_COMPONENT_NAME, mDeviceInitializer.admin.flattenToString());
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index ba5d666..8e4bc50 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -246,6 +246,17 @@
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN);
}
+ // Keyguard features that when set of a profile will affect the profiles
+ // parent user.
+ private static final int PROFILE_KEYGUARD_FEATURES_AFFECT_OWNER =
+ DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS
+ | DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT;
+
+ // Keyguard features that are allowed to be set on a managed profile
+ private static final int PROFILE_KEYGUARD_FEATURES =
+ PROFILE_KEYGUARD_FEATURES_AFFECT_OWNER
+ | DevicePolicyManager.KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS;
+
final Context mContext;
final UserManager mUserManager;
final PowerManager.WakeLock mWakeLock;
@@ -3957,7 +3968,9 @@
}
Preconditions.checkNotNull(who, "ComponentName is null");
final int userHandle = UserHandle.getCallingUserId();
- enforceNotManagedProfile(userHandle, "disable keyguard features");
+ if (isManagedProfile(userHandle)) {
+ which = which & PROFILE_KEYGUARD_FEATURES;
+ }
synchronized (this) {
ActiveAdmin ap = getActiveAdminForCallerLocked(who,
DeviceAdminInfo.USES_POLICY_DISABLE_KEYGUARD_FEATURES);
@@ -3978,21 +3991,50 @@
return 0;
}
enforceCrossUserPermission(userHandle);
- synchronized (this) {
- if (who != null) {
- ActiveAdmin admin = getActiveAdminUncheckedLocked(who, userHandle);
- return (admin != null) ? admin.disabledKeyguardFeatures : 0;
- }
+ long ident = Binder.clearCallingIdentity();
+ try {
+ synchronized (this) {
+ if (who != null) {
+ ActiveAdmin admin = getActiveAdminUncheckedLocked(who, userHandle);
+ return (admin != null) ? admin.disabledKeyguardFeatures : 0;
+ }
- // Determine which keyguard features are disabled for any active admins.
- DevicePolicyData policy = getUserData(userHandle);
- final int N = policy.mAdminList.size();
- int which = 0;
- for (int i = 0; i < N; i++) {
- ActiveAdmin admin = policy.mAdminList.get(i);
- which |= admin.disabledKeyguardFeatures;
+ UserInfo user = mUserManager.getUserInfo(userHandle);
+ final List<UserInfo> profiles;
+ if (user.isManagedProfile()) {
+ // If we are being asked about a managed profile just return
+ // keyguard features disabled by admins in the profile.
+ profiles = new ArrayList<UserInfo>(1);
+ profiles.add(user);
+ } else {
+ // Otherwise return those set by admins in the user
+ // and its profiles.
+ profiles = mUserManager.getProfiles(userHandle);
+ }
+
+ // Determine which keyguard features are disabled by any active admin.
+ int which = 0;
+ for (UserInfo userInfo : profiles) {
+ DevicePolicyData policy = getUserData(userInfo.id);
+ final int N = policy.mAdminList.size();
+ for (int i = 0; i < N; i++) {
+ ActiveAdmin admin = policy.mAdminList.get(i);
+ if (userInfo.id == userHandle || !userInfo.isManagedProfile()) {
+ // If we are being asked explictly about this user
+ // return all disabled features even if its a managed profile.
+ which |= admin.disabledKeyguardFeatures;
+ } else {
+ // Otherwise a managed profile is only allowed to disable
+ // some features on the parent user.
+ which |= (admin.disabledKeyguardFeatures
+ & PROFILE_KEYGUARD_FEATURES_AFFECT_OWNER);
+ }
+ }
+ }
+ return which;
}
- return which;
+ } finally {
+ Binder.restoreCallingIdentity(ident);
}
}
@@ -4122,8 +4164,7 @@
}
@Override
- public boolean setDeviceInitializer(ComponentName who, ComponentName initializer,
- String ownerName) {
+ public boolean setDeviceInitializer(ComponentName who, ComponentName initializer) {
if (!mHasFeature) {
return false;
}
@@ -4142,10 +4183,10 @@
if (mDeviceOwner == null) {
// Device owner state does not exist, create it.
- mDeviceOwner = DeviceOwner.createWithDeviceInitializer(initializer, ownerName);
+ mDeviceOwner = DeviceOwner.createWithDeviceInitializer(initializer);
} else {
// Device owner already exists, update it.
- mDeviceOwner.setDeviceInitializer(initializer, ownerName);
+ mDeviceOwner.setDeviceInitializer(initializer);
}
addDeviceInitializerToLockTaskPackagesLocked(UserHandle.USER_OWNER);
@@ -5362,7 +5403,7 @@
} else if (UserManager.DISALLOW_USB_FILE_TRANSFER.equals(key)) {
UsbManager manager =
(UsbManager) mContext.getSystemService(Context.USB_SERVICE);
- manager.setCurrentFunction("none", false);
+ manager.setCurrentFunction("none");
} else if (UserManager.DISALLOW_SHARE_LOCATION.equals(key)) {
Settings.Secure.putIntForUser(mContext.getContentResolver(),
Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF,
diff --git a/services/usage/java/com/android/server/usage/AppIdleHistory.java b/services/usage/java/com/android/server/usage/AppIdleHistory.java
new file mode 100644
index 0000000..9d3db16
--- /dev/null
+++ b/services/usage/java/com/android/server/usage/AppIdleHistory.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.android.server.usage;
+
+import android.util.ArrayMap;
+import android.util.SparseArray;
+
+import com.android.internal.util.IndentingPrintWriter;
+
+/**
+ * Keeps track of recent active state changes in apps.
+ * Access should be guarded by a lock by the caller.
+ */
+public class AppIdleHistory {
+
+ private SparseArray<ArrayMap<String,byte[]>> idleHistory = new SparseArray<>();
+ private long lastPeriod = 0;
+ private static final long ONE_MINUTE = 60 * 1000;
+ private static final int HISTORY_SIZE = 100;
+ private static final int FLAG_LAST_STATE = 2;
+ private static final int FLAG_PARTIAL_ACTIVE = 1;
+ private static final long PERIOD_DURATION = UsageStatsService.DEBUG ? ONE_MINUTE
+ : 60 * ONE_MINUTE;
+
+ public void addEntry(String packageName, int userId, boolean idle, long timeNow) {
+ ArrayMap<String, byte[]> userHistory = idleHistory.get(userId);
+ if (userHistory == null) {
+ userHistory = new ArrayMap<>();
+ idleHistory.put(userId, userHistory);
+ }
+ byte[] packageHistory = userHistory.get(packageName);
+ if (packageHistory == null) {
+ packageHistory = new byte[HISTORY_SIZE];
+ userHistory.put(packageName, packageHistory);
+ }
+ long thisPeriod = timeNow / PERIOD_DURATION;
+ // Has the period switched over? Slide all users' package histories
+ if (lastPeriod != 0 && lastPeriod < thisPeriod
+ && (thisPeriod - lastPeriod) < HISTORY_SIZE - 1) {
+ int diff = (int) (thisPeriod - lastPeriod);
+ final int NUSERS = idleHistory.size();
+ for (int u = 0; u < NUSERS; u++) {
+ userHistory = idleHistory.valueAt(u);
+ for (byte[] history : userHistory.values()) {
+ // Shift left
+ System.arraycopy(history, diff, history, 0, HISTORY_SIZE - diff);
+ // Replicate last state across the diff
+ for (int i = 0; i < diff; i++) {
+ history[HISTORY_SIZE - i - 1] =
+ (byte) (history[HISTORY_SIZE - diff - 1] & FLAG_LAST_STATE);
+ }
+ }
+ }
+ }
+ lastPeriod = thisPeriod;
+ if (!idle) {
+ packageHistory[HISTORY_SIZE - 1] = FLAG_LAST_STATE | FLAG_PARTIAL_ACTIVE;
+ } else {
+ packageHistory[HISTORY_SIZE - 1] &= ~FLAG_LAST_STATE;
+ }
+ }
+
+ public void removeUser(int userId) {
+ idleHistory.remove(userId);
+ }
+
+ public void dump(IndentingPrintWriter idpw, int userId) {
+ ArrayMap<String, byte[]> userHistory = idleHistory.get(userId);
+ if (userHistory == null) return;
+ final int P = userHistory.size();
+ for (int p = 0; p < P; p++) {
+ final String packageName = userHistory.keyAt(p);
+ final byte[] history = userHistory.valueAt(p);
+ for (int i = 0; i < HISTORY_SIZE; i++) {
+ idpw.print(history[i] == 0 ? '.' : 'A');
+ }
+ idpw.print(" " + packageName);
+ idpw.println();
+ }
+ }
+}
\ No newline at end of file
diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java
index d18f7c2..bfd6cc0 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsService.java
@@ -64,6 +64,7 @@
import android.util.SparseArray;
import android.view.Display;
+import com.android.internal.annotations.GuardedBy;
import com.android.internal.os.BackgroundThread;
import com.android.internal.util.IndentingPrintWriter;
import com.android.server.DeviceIdleController;
@@ -90,20 +91,21 @@
static final String TAG = "UsageStatsService";
static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
+
private static final long TEN_SECONDS = 10 * 1000;
private static final long ONE_MINUTE = 60 * 1000;
private static final long TWENTY_MINUTES = 20 * 60 * 1000;
private static final long FLUSH_INTERVAL = DEBUG ? TEN_SECONDS : TWENTY_MINUTES;
private static final long TIME_CHANGE_THRESHOLD_MILLIS = 2 * 1000; // Two seconds.
- static final long DEFAULT_APP_IDLE_THRESHOLD_MILLIS = DEBUG ? ONE_MINUTE * 4
- : 1L * 24 * 60 * 60 * 1000; // 1 day
- static final long DEFAULT_CHECK_IDLE_INTERVAL = DEBUG ? ONE_MINUTE
- : 8 * 3600 * 1000; // 8 hours
+ static final long DEFAULT_APP_IDLE_THRESHOLD_MILLIS = DEBUG ? ONE_MINUTE * 4
+ : 1L * 24 * 60 * ONE_MINUTE; // 1 day
+ static final long DEFAULT_CHECK_IDLE_INTERVAL = DEBUG ? ONE_MINUTE / 4
+ : 8 * 60 * ONE_MINUTE; // 8 hours
static final long DEFAULT_PAROLE_INTERVAL = DEBUG ? ONE_MINUTE * 10
- : 24 * 60 * 60 * 1000L; // 24 hours between paroles
- static final long DEFAULT_PAROLE_DURATION = DEBUG ? ONE_MINUTE * 2
- : 10 * 60 * 1000L; // 10 minutes
+ : 24 * 60 * ONE_MINUTE; // 24 hours between paroles
+ static final long DEFAULT_PAROLE_DURATION = DEBUG ? ONE_MINUTE
+ : 10 * ONE_MINUTE; // 10 minutes
// Handler message types.
static final int MSG_REPORT_EVENT = 0;
@@ -137,6 +139,9 @@
long mScreenOnTime;
long mScreenOnSystemTimeSnapshot;
+ @GuardedBy("mLock")
+ private AppIdleHistory mAppIdleHistory = new AppIdleHistory();
+
private ArrayList<UsageStatsManagerInternal.AppIdleStateChangeListener>
mPackageAccessListeners = new ArrayList<>();
@@ -346,12 +351,14 @@
| PackageManager.GET_UNINSTALLED_PACKAGES,
userId);
synchronized (mLock) {
+ final long timeNow = checkAndGetTimeLocked();
final int packageCount = packages.size();
for (int p = 0; p < packageCount; p++) {
final String packageName = packages.get(p).packageName;
final boolean isIdle = isAppIdleFiltered(packageName, userId);
mHandler.sendMessage(mHandler.obtainMessage(MSG_INFORM_LISTENERS,
userId, isIdle ? 1 : 0, packageName));
+ mAppIdleHistory.addEntry(packageName, userId, isIdle, timeNow);
}
}
}
@@ -541,6 +548,7 @@
// Slog.d(TAG, "Informing listeners of out-of-idle " + event.mPackage);
mHandler.sendMessage(mHandler.obtainMessage(MSG_INFORM_LISTENERS, userId,
/* idle = */ 0, event.mPackage));
+ mAppIdleHistory.addEntry(event.mPackage, userId, false, timeNow);
}
}
}
@@ -567,6 +575,7 @@
// Slog.d(TAG, "Informing listeners of out-of-idle " + event.mPackage);
mHandler.sendMessage(mHandler.obtainMessage(MSG_INFORM_LISTENERS, userId,
/* idle = */ idle ? 1 : 0, packageName));
+ mAppIdleHistory.addEntry(packageName, userId, idle, timeNow);
}
}
}
@@ -768,10 +777,14 @@
mUserState.valueAt(i).checkin(idpw, screenOnTime);
} else {
mUserState.valueAt(i).dump(idpw, screenOnTime);
+ idpw.println();
+ if (args.length > 0 && "history".equals(args[0])) {
+ mAppIdleHistory.dump(idpw, mUserState.keyAt(i));
+ }
}
idpw.decreaseIndent();
}
- pw.write("Screen On Timestamp:" + mScreenOnTime + "\n");
+ pw.write("Screen On Timebase:" + mScreenOnTime + "\n");
}
}
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
index f84beb6..cb8f938 100644
--- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -92,7 +92,6 @@
private static final int MSG_BOOT_COMPLETED = 4;
private static final int MSG_USER_SWITCHED = 5;
- private static final int AUDIO_MODE_NONE = 0;
private static final int AUDIO_MODE_SOURCE = 1;
// Delay for debouncing USB disconnects.
@@ -107,8 +106,6 @@
// Request is cancelled if host does not configure device within 10 seconds.
private static final int ACCESSORY_REQUEST_TIMEOUT = 10 * 1000;
- private static final String BOOT_MODE_PROPERTY = "ro.bootmode";
-
private UsbHandler mHandler;
private boolean mBootCompleted;
@@ -245,7 +242,7 @@
if (functions != null) {
mAccessoryModeRequestTime = SystemClock.elapsedRealtime();
- setCurrentFunctions(functions, false);
+ setCurrentFunctions(functions);
}
}
@@ -318,7 +315,6 @@
private boolean mConnected;
private boolean mConfigured;
private String mCurrentFunctions;
- private String mDefaultFunctions;
private UsbAccessory mCurrentAccessory;
private int mUsbNotificationId;
private boolean mAdbNotificationShown;
@@ -343,25 +339,20 @@
public UsbHandler(Looper looper) {
super(looper);
try {
+ // Special note about persist.sys.usb.config: We only ever look at the adb value
+ // from that property. Other values are ignored. persist.sys.usb.config is now
+ // only used to determine if adb is enabled or not.
+ // TODO: rename persist.sys.usb.config to something more descriptive.
// persist.sys.usb.config should never be unset. But if it is, set it to "adb"
// so we have a chance of debugging what happened.
- mDefaultFunctions = SystemProperties.get("persist.sys.usb.config", "adb");
- // Check if USB mode needs to be overridden depending on OEM specific bootmode.
- mDefaultFunctions = processOemUsbOverride(mDefaultFunctions);
+ mAdbEnabled = containsFunction(
+ SystemProperties.get(UsbManager.ADB_PERSISTENT_PROPERTY, "adb"),
+ UsbManager.USB_FUNCTION_ADB);
- // sanity check the sys.usb.config system property
- // this may be necessary if we crashed while switching USB configurations
- String config = SystemProperties.get("sys.usb.config", "none");
- if (!config.equals(mDefaultFunctions)) {
- Slog.w(TAG, "resetting config to persistent property: " + mDefaultFunctions);
- SystemProperties.set("sys.usb.config", mDefaultFunctions);
- }
-
- mCurrentFunctions = getDefaultFunctions();
+ mCurrentFunctions = mAdbEnabled ? "adb" : "none";
String state = FileUtils.readTextFile(new File(STATE_PATH), 0, null).trim();
updateState(state);
- mAdbEnabled = containsFunction(mCurrentFunctions, UsbManager.USB_FUNCTION_ADB);
// register observer to listen for settings changes
mContentResolver.registerContentObserver(
@@ -396,14 +387,6 @@
sendMessage(m);
}
- public void sendMessage(int what, Object arg0, boolean arg1) {
- removeMessages(what);
- Message m = Message.obtain(this, what);
- m.obj = arg0;
- m.arg1 = (arg1 ? 1 : 0);
- sendMessage(m);
- }
-
public void updateState(String state) {
int connected, configured;
@@ -443,7 +426,7 @@
private boolean setUsbConfig(String config) {
if (DEBUG) Slog.d(TAG, "setUsbConfig(" + config + ")");
// set the new configuration
- SystemProperties.set("sys.usb.config", config);
+ SystemProperties.set(UsbManager.USB_SETTINGS_PROPERTY, config);
return waitForState(config);
}
@@ -453,9 +436,9 @@
mAdbEnabled = enable;
// Due to the persist.sys.usb.config property trigger, changing adb state requires
// persisting default function
- setEnabledFunctions(mDefaultFunctions, true);
+ SystemProperties.set(UsbManager.ADB_PERSISTENT_PROPERTY, mAdbEnabled ? "adb" : "none");
// After persisting them use the lock-down aware function set
- setEnabledFunctions(getDefaultFunctions(), false);
+ setEnabledFunctions(getDefaultFunctions());
updateAdbNotification();
}
if (mDebuggingManager != null) {
@@ -463,65 +446,31 @@
}
}
- private void setEnabledFunctions(String functions, boolean makeDefault) {
- if (DEBUG) Slog.d(TAG, "setEnabledFunctions " + functions
- + " makeDefault: " + makeDefault);
+ private void setEnabledFunctions(String functions) {
+ if (DEBUG) Slog.d(TAG, "setEnabledFunctions " + functions);
- // Do not update persystent.sys.usb.config if the device is booted up
- // with OEM specific mode.
- if (functions != null && makeDefault && !needsOemUsbOverride()) {
+ if (functions == null) {
+ functions = "none";
+ }
- if (mAdbEnabled) {
- functions = addFunction(functions, UsbManager.USB_FUNCTION_ADB);
- } else {
- functions = removeFunction(functions, UsbManager.USB_FUNCTION_ADB);
- }
- if (!mDefaultFunctions.equals(functions)) {
- if (!setUsbConfig("none")) {
- Slog.e(TAG, "Failed to disable USB");
- // revert to previous configuration if we fail
- setUsbConfig(mCurrentFunctions);
- return;
- }
- // setting this property will also change the current USB state
- // via a property trigger
- SystemProperties.set("persist.sys.usb.config", functions);
- if (waitForState(functions)) {
- mCurrentFunctions = functions;
- mDefaultFunctions = functions;
- } else {
- Slog.e(TAG, "Failed to switch persistent USB config to " + functions);
- // revert to previous configuration if we fail
- SystemProperties.set("persist.sys.usb.config", mDefaultFunctions);
- }
- }
+ if (mAdbEnabled) {
+ functions = addFunction(functions, UsbManager.USB_FUNCTION_ADB);
} else {
- if (functions == null) {
- functions = mDefaultFunctions;
+ functions = removeFunction(functions, UsbManager.USB_FUNCTION_ADB);
+ }
+ if (!mCurrentFunctions.equals(functions)) {
+ if (!setUsbConfig("none")) {
+ Slog.e(TAG, "Failed to disable USB");
+ // revert to previous configuration if we fail
+ setUsbConfig(mCurrentFunctions);
+ return;
}
-
- // Override with bootmode specific usb mode if needed
- functions = processOemUsbOverride(functions);
-
- if (mAdbEnabled) {
- functions = addFunction(functions, UsbManager.USB_FUNCTION_ADB);
+ if (setUsbConfig(functions)) {
+ mCurrentFunctions = functions;
} else {
- functions = removeFunction(functions, UsbManager.USB_FUNCTION_ADB);
- }
- if (!mCurrentFunctions.equals(functions)) {
- if (!setUsbConfig("none")) {
- Slog.e(TAG, "Failed to disable USB");
- // revert to previous configuration if we fail
- setUsbConfig(mCurrentFunctions);
- return;
- }
- if (setUsbConfig(functions)) {
- mCurrentFunctions = functions;
- } else {
- Slog.e(TAG, "Failed to switch USB config to " + functions);
- // revert to previous configuration if we fail
- setUsbConfig(mCurrentFunctions);
- }
+ Slog.e(TAG, "Failed to switch USB config to " + functions);
+ // revert to previous configuration if we fail
+ setUsbConfig(mCurrentFunctions);
}
}
}
@@ -551,7 +500,7 @@
// make sure accessory mode is off
// and restore default functions
Slog.d(TAG, "exited USB accessory mode");
- setEnabledFunctions(getDefaultFunctions(), false);
+ setEnabledFunctions(getDefaultFunctions());
if (mCurrentAccessory != null) {
if (mBootCompleted) {
@@ -644,7 +593,7 @@
updateCurrentAccessory();
} else if (!mConnected) {
// restore defaults when USB is disconnected
- setEnabledFunctions(getDefaultFunctions(), false);
+ setEnabledFunctions(getDefaultFunctions());
}
if (mBootCompleted) {
updateUsbState();
@@ -657,10 +606,11 @@
break;
case MSG_SET_CURRENT_FUNCTIONS:
String functions = (String)msg.obj;
- boolean makeDefault = (msg.arg1 == 1);
- setEnabledFunctions(functions, makeDefault);
+ setEnabledFunctions(functions);
break;
case MSG_SYSTEM_READY:
+ setUsbConfig(mCurrentFunctions);
+ SystemProperties.set(UsbManager.ADB_PERSISTENT_PROPERTY, mAdbEnabled ? "adb" : "none");
updateUsbNotification();
updateAdbNotification();
updateUsbState();
@@ -669,6 +619,7 @@
break;
case MSG_BOOT_COMPLETED:
mBootCompleted = true;
+ setUsbConfig(mCurrentFunctions);
if (mCurrentAccessory != null) {
getCurrentSettings().accessoryAttached(mCurrentAccessory);
}
@@ -724,10 +675,7 @@
} else if (containsFunction(mCurrentFunctions, UsbManager.USB_FUNCTION_ACCESSORY)) {
id = com.android.internal.R.string.usb_accessory_notification_title;
} else {
- // There is a different notification for USB tethering so we don't need one here
- //if (!containsFunction(mCurrentFunctions, UsbManager.USB_FUNCTION_RNDIS)) {
- // Slog.e(TAG, "No known USB function in updateUsbNotification");
- //}
+ id = com.android.internal.R.string.usb_charging_notification_title;
}
}
if (id != mUsbNotificationId) {
@@ -754,7 +702,7 @@
Intent intent = Intent.makeRestartActivityTask(
new ComponentName("com.android.settings",
- "com.android.settings.UsbSettings"));
+ "com.android.settings.deviceinfo.UsbModeChooserActivity"));
PendingIntent pi = PendingIntent.getActivityAsUser(mContext, 0,
intent, 0, null, UserHandle.CURRENT);
notification.color = mContext.getColor(
@@ -810,18 +758,12 @@
}
private String getDefaultFunctions() {
- UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
- if (userManager.hasUserRestriction(UserManager.DISALLOW_USB_FILE_TRANSFER,
- new UserHandle(mCurrentUser))) {
- return "none";
- }
- return mDefaultFunctions;
+ return "none";
}
public void dump(FileDescriptor fd, PrintWriter pw) {
pw.println(" USB Device State:");
pw.println(" Current Functions: " + mCurrentFunctions);
- pw.println(" Default Functions: " + mDefaultFunctions);
pw.println(" mConnected: " + mConnected);
pw.println(" mConfigured: " + mConfigured);
pw.println(" mCurrentAccessory: " + mCurrentAccessory);
@@ -857,9 +799,9 @@
return nativeOpenAccessory();
}
- public void setCurrentFunctions(String functions, boolean makeDefault) {
- if (DEBUG) Slog.d(TAG, "setCurrentFunctions(" + functions + ") default: " + makeDefault);
- mHandler.sendMessage(MSG_SET_CURRENT_FUNCTIONS, functions, makeDefault);
+ public void setCurrentFunctions(String functions) {
+ if (DEBUG) Slog.d(TAG, "setCurrentFunctions(" + functions + ")");
+ mHandler.sendMessage(MSG_SET_CURRENT_FUNCTIONS, functions);
}
private void readOemUsbOverrideConfig() {
@@ -884,31 +826,6 @@
}
}
- private boolean needsOemUsbOverride() {
- if (mOemModeMap == null) return false;
-
- String bootMode = SystemProperties.get(BOOT_MODE_PROPERTY, "unknown");
- return (mOemModeMap.get(bootMode) != null) ? true : false;
- }
-
- private String processOemUsbOverride(String usbFunctions) {
- if ((usbFunctions == null) || (mOemModeMap == null)) return usbFunctions;
-
- String bootMode = SystemProperties.get(BOOT_MODE_PROPERTY, "unknown");
-
- List<Pair<String, String>> overrides = mOemModeMap.get(bootMode);
- if (overrides != null) {
- for (Pair<String, String> pair: overrides) {
- if (pair.first.equals(usbFunctions)) {
- Slog.d(TAG, "OEM USB override: " + pair.first + " ==> " + pair.second);
- return pair.second;
- }
- }
- }
- // return passed in functions as is.
- return usbFunctions;
- }
-
public void allowUsbDebugging(boolean alwaysAllow, String publicKey) {
if (mDebuggingManager != null) {
mDebuggingManager.allowUsbDebugging(alwaysAllow, publicKey);
diff --git a/services/usb/java/com/android/server/usb/UsbService.java b/services/usb/java/com/android/server/usb/UsbService.java
index e03884f..51281a2 100644
--- a/services/usb/java/com/android/server/usb/UsbService.java
+++ b/services/usb/java/com/android/server/usb/UsbService.java
@@ -252,19 +252,19 @@
}
@Override
- public void setCurrentFunction(String function, boolean makeDefault) {
+ public void setCurrentFunction(String function) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
// If attempt to change USB function while file transfer is restricted, ensure that
// the current function is set to "none", and return.
UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
if (userManager.hasUserRestriction(UserManager.DISALLOW_USB_FILE_TRANSFER)) {
- if (mDeviceManager != null) mDeviceManager.setCurrentFunctions("none", false);
+ if (mDeviceManager != null) mDeviceManager.setCurrentFunctions("none");
return;
}
if (mDeviceManager != null) {
- mDeviceManager.setCurrentFunctions(function, makeDefault);
+ mDeviceManager.setCurrentFunctions(function);
} else {
throw new IllegalStateException("USB device mode not supported");
}
diff --git a/telecomm/java/android/telecom/Voicemail.java b/telecomm/java/android/telecom/Voicemail.java
index f5b8052..151917e 100644
--- a/telecomm/java/android/telecom/Voicemail.java
+++ b/telecomm/java/android/telecom/Voicemail.java
@@ -28,6 +28,7 @@
public class Voicemail implements Parcelable {
private final Long mTimestamp;
private final String mNumber;
+ private final PhoneAccountHandle mPhoneAccount;
private final Long mId;
private final Long mDuration;
private final String mSource;
@@ -36,10 +37,12 @@
private final Boolean mIsRead;
private final Boolean mHasContent;
- private Voicemail(Long timestamp, String number, Long id, Long duration, String source,
- String providerData, Uri uri, Boolean isRead, Boolean hasContent) {
+ private Voicemail(Long timestamp, String number, PhoneAccountHandle phoneAccountHandle, Long id,
+ Long duration, String source, String providerData, Uri uri, Boolean isRead,
+ Boolean hasContent) {
mTimestamp = timestamp;
mNumber = number;
+ mPhoneAccount = phoneAccountHandle;
mId = id;
mDuration = duration;
mSource = source;
@@ -77,6 +80,7 @@
public static class Builder {
private Long mBuilderTimestamp;
private String mBuilderNumber;
+ private PhoneAccountHandle mBuilderPhoneAccount;
private Long mBuilderId;
private Long mBuilderDuration;
private String mBuilderSourcePackage;
@@ -99,6 +103,11 @@
return this;
}
+ public Builder setPhoneAccount(PhoneAccountHandle phoneAccount) {
+ mBuilderPhoneAccount = phoneAccount;
+ return this;
+ }
+
public Builder setId(long id) {
mBuilderId = id;
return this;
@@ -139,9 +148,9 @@
mBuilderTimestamp = mBuilderTimestamp == null ? 0 : mBuilderTimestamp;
mBuilderDuration = mBuilderDuration == null ? 0: mBuilderDuration;
mBuilderIsRead = mBuilderIsRead == null ? false : mBuilderIsRead;
- return new Voicemail(mBuilderTimestamp, mBuilderNumber, mBuilderId, mBuilderDuration,
- mBuilderSourcePackage, mBuilderSourceData, mBuilderUri, mBuilderIsRead,
- mBuilderHasContent);
+ return new Voicemail(mBuilderTimestamp, mBuilderNumber, mBuilderPhoneAccount,
+ mBuilderId, mBuilderDuration, mBuilderSourcePackage, mBuilderSourceData,
+ mBuilderUri, mBuilderIsRead, mBuilderHasContent);
}
}
@@ -161,6 +170,11 @@
return mNumber;
}
+ /** The phone account associated with the voicemail, null if not set. */
+ public PhoneAccountHandle getPhoneAccount() {
+ return mPhoneAccount;
+ }
+
/** The timestamp the voicemail was received, in millis since the epoch, zero if not set. */
public long getTimestampMillis() {
return mTimestamp;
@@ -225,6 +239,12 @@
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(mTimestamp);
dest.writeCharSequence(mNumber);
+ if (mPhoneAccount == null) {
+ dest.writeInt(0);
+ } else {
+ dest.writeInt(1);
+ mPhoneAccount.writeToParcel(dest, flags);
+ }
dest.writeLong(mId);
dest.writeLong(mDuration);
dest.writeCharSequence(mSource);
@@ -263,6 +283,11 @@
private Voicemail(Parcel in) {
mTimestamp = in.readLong();
mNumber = (String) in.readCharSequence();
+ if (in.readInt() > 0) {
+ mPhoneAccount = PhoneAccountHandle.CREATOR.createFromParcel(in);
+ } else {
+ mPhoneAccount = null;
+ }
mId = in.readLong();
mDuration = in.readLong();
mSource = (String) in.readCharSequence();
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 2caa83c..b3beaf9 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -18,6 +18,8 @@
import com.android.internal.telephony.ICarrierConfigLoader;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.content.Context;
import android.os.PersistableBundle;
@@ -131,8 +133,8 @@
/** Used in Cellular Network Settings for preferred network type. */
public static final String BOOL_PREFER_2G = "bool_prefer_2g";
- /** Show cdma auto network mode in (glabal) roaming */
- public static final String BOOL_SHOW_CDMA = "bool_show_cdma";
+ /** Show cdma network mode choices 1x, 3G, global etc. */
+ public static final String BOOL_SHOW_CDMA_CHOICES = "bool_show_cdma_choices";
/** CDMA activation goes through HFA */
public static final String BOOL_USE_HFA_FOR_PROVISIONING = "bool_use_hfa_for_provisioning";
@@ -254,7 +256,7 @@
sDefaults.putBoolean(BOOL_OPERATOR_SELECTION_EXPAND, true);
sDefaults.putBoolean(BOOL_PREFER_2G, true);
sDefaults.putBoolean(BOOL_SHOW_APN_SETTING_CDMA, false);
- sDefaults.putBoolean(BOOL_SHOW_CDMA, false);
+ sDefaults.putBoolean(BOOL_SHOW_CDMA_CHOICES, false);
sDefaults.putBoolean(BOOL_SHOW_ONSCREEN_DIAL_BUTTON, true);
sDefaults.putBoolean(BOOL_SIM_NETWORK_UNLOCK_ALLOW_DISMISS, true);
sDefaults.putBoolean(BOOL_SUPPORT_PAUSE_IMS_VIDEO_CALLS, true);
@@ -279,6 +281,7 @@
* @return A {@link PersistableBundle} containing the config for the given subId, or default
* values for an invalid subId.
*/
+ @Nullable
public PersistableBundle getConfigForSubId(int subId) {
try {
return getICarrierConfigLoader().getConfigForSubId(subId);
@@ -297,6 +300,7 @@
*
* @see #getConfigForSubId
*/
+ @Nullable
public PersistableBundle getConfig() {
return getConfigForSubId(SubscriptionManager.getDefaultSubId());
}
@@ -348,6 +352,7 @@
*
* @hide
*/
+ @NonNull
@SystemApi
public static PersistableBundle getDefaultConfig() {
return new PersistableBundle(sDefaults);
diff --git a/tools/aapt2/Android.mk b/tools/aapt2/Android.mk
index 5ef4311..23d679d 100644
--- a/tools/aapt2/Android.mk
+++ b/tools/aapt2/Android.mk
@@ -30,6 +30,7 @@
BinaryXmlPullParser.cpp \
BindingXmlPullParser.cpp \
ConfigDescription.cpp \
+ Debug.cpp \
Files.cpp \
Flag.cpp \
JavaClassGenerator.cpp \
diff --git a/tools/aapt2/BinaryResourceParser.cpp b/tools/aapt2/BinaryResourceParser.cpp
index d16f63b..3559f43 100644
--- a/tools/aapt2/BinaryResourceParser.cpp
+++ b/tools/aapt2/BinaryResourceParser.cpp
@@ -475,10 +475,17 @@
source.line = entry->sourceLine;
}
- if (!mTable->markPublic(name, resId, source)) {
+ if (!mTable->markPublicAllowMangled(name, resId, source)) {
return false;
}
+ // Add this resource name->id mapping to the index so
+ // that we can resolve all ID references to name references.
+ auto cacheIter = mIdIndex.find(resId);
+ if (cacheIter == mIdIndex.end()) {
+ mIdIndex.insert({ resId, name });
+ }
+
entry++;
}
return true;
@@ -611,12 +618,12 @@
source.line = sourceBlock->line;
}
- if (!mTable->addResource(name, config, source, std::move(resourceValue))) {
+ if (!mTable->addResourceAllowMangled(name, config, source, std::move(resourceValue))) {
return false;
}
if ((entry->flags & ResTable_entry::FLAG_PUBLIC) != 0) {
- if (!mTable->markPublic(name, resId, mSource.line(0))) {
+ if (!mTable->markPublicAllowMangled(name, resId, mSource.line(0))) {
return false;
}
}
@@ -635,6 +642,10 @@
const ConfigDescription& config,
const Res_value* value,
uint16_t flags) {
+ if (name.type == ResourceType::kId) {
+ return util::make_unique<Id>();
+ }
+
if (value->dataType == Res_value::TYPE_STRING) {
StringPiece16 str = util::getString(mValuePool, value->data);
@@ -686,8 +697,7 @@
// This is not an unresolved symbol, so it must be the magic @null reference.
Res_value nullType = {};
- nullType.dataType = Res_value::TYPE_NULL;
- nullType.data = Res_value::DATA_NULL_UNDEFINED;
+ nullType.dataType = Res_value::TYPE_REFERENCE;
return util::make_unique<BinaryPrimitive>(nullType);
}
@@ -697,13 +707,6 @@
StringPool::Context{ 1, config }));
}
- if (name.type == ResourceType::kId ||
- (value->dataType == Res_value::TYPE_NULL &&
- value->data == Res_value::DATA_NULL_UNDEFINED &&
- (flags & ResTable_entry::FLAG_WEAK) != 0)) {
- return util::make_unique<Id>();
- }
-
// Treat this as a raw binary primitive.
return util::make_unique<BinaryPrimitive>(*value);
}
@@ -731,8 +734,7 @@
std::unique_ptr<Style> BinaryResourceParser::parseStyle(const ResourceNameRef& name,
const ConfigDescription& config,
const ResTable_map_entry* map) {
- const bool isWeak = (map->flags & ResTable_entry::FLAG_WEAK) != 0;
- std::unique_ptr<Style> style = util::make_unique<Style>(isWeak);
+ std::unique_ptr<Style> style = util::make_unique<Style>();
if (map->parent.ident == 0) {
// The parent is either not set or it is an unresolved symbol.
// Check to see if it is a symbol.
@@ -789,10 +791,21 @@
continue;
}
- attr->symbols.push_back(Attribute::Symbol{
- Reference(mapEntry.name.ident),
- mapEntry.value.data
- });
+ Attribute::Symbol symbol;
+ symbol.value = mapEntry.value.data;
+ if (mapEntry.name.ident == 0) {
+ // The map entry's key (id) is not set. This must be
+ // a symbol reference, so resolve it.
+ ResourceNameRef symbolName;
+ bool result = getSymbol(&mapEntry.name.ident, &symbolName);
+ assert(result);
+ symbol.symbol.name = symbolName.toResourceName();
+ } else {
+ // The map entry's key (id) is a regular reference.
+ symbol.symbol.id = mapEntry.name.ident;
+ }
+
+ attr->symbols.push_back(std::move(symbol));
}
}
diff --git a/tools/aapt2/Debug.cpp b/tools/aapt2/Debug.cpp
new file mode 100644
index 0000000..cf222c6
--- /dev/null
+++ b/tools/aapt2/Debug.cpp
@@ -0,0 +1,192 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Debug.h"
+#include "ResourceTable.h"
+#include "ResourceValues.h"
+#include "Util.h"
+
+#include <algorithm>
+#include <iostream>
+#include <map>
+#include <memory>
+#include <queue>
+#include <set>
+#include <vector>
+
+namespace aapt {
+
+struct PrintVisitor : ConstValueVisitor {
+ void visit(const Attribute& attr, ValueVisitorArgs&) override {
+ std::cout << "(attr) type=";
+ attr.printMask(std::cout);
+ static constexpr uint32_t kMask = android::ResTable_map::TYPE_ENUM |
+ android::ResTable_map::TYPE_FLAGS;
+ if (attr.typeMask & kMask) {
+ for (const auto& symbol : attr.symbols) {
+ std::cout << "\n "
+ << symbol.symbol.name.entry << " (" << symbol.symbol.id << ") = "
+ << symbol.value;
+ }
+ }
+ }
+
+ void visit(const Style& style, ValueVisitorArgs&) override {
+ std::cout << "(style)";
+ if (style.parent.name.isValid() || style.parent.id.isValid()) {
+ std::cout << " parent=";
+ if (style.parent.name.isValid()) {
+ std::cout << style.parent.name << " ";
+ }
+
+ if (style.parent.id.isValid()) {
+ std::cout << style.parent.id;
+ }
+ }
+
+ for (const auto& entry : style.entries) {
+ std::cout << "\n ";
+ if (entry.key.name.isValid()) {
+ std::cout << entry.key.name.package << ":" << entry.key.name.entry;
+ }
+
+ if (entry.key.id.isValid()) {
+ std::cout << "(" << entry.key.id << ")";
+ }
+
+ std::cout << "=" << *entry.value;
+ }
+ }
+
+ void visit(const Array& array, ValueVisitorArgs&) override {
+ array.print(std::cout);
+ }
+
+ void visit(const Plural& plural, ValueVisitorArgs&) override {
+ plural.print(std::cout);
+ }
+
+ void visit(const Styleable& styleable, ValueVisitorArgs&) override {
+ styleable.print(std::cout);
+ }
+
+ void visitItem(const Item& item, ValueVisitorArgs& args) override {
+ item.print(std::cout);
+ }
+};
+
+void Debug::printTable(const std::shared_ptr<ResourceTable>& table) {
+ std::cout << "Package name=" << table->getPackage();
+ if (table->getPackageId() != ResourceTable::kUnsetPackageId) {
+ std::cout << " id=" << std::hex << table->getPackageId() << std::dec;
+ }
+ std::cout << std::endl;
+
+ for (const auto& type : *table) {
+ std::cout << " type " << type->type;
+ if (type->typeId != ResourceTableType::kUnsetTypeId) {
+ std::cout << " id=" << std::hex << type->typeId << std::dec;
+ }
+ std::cout << " entryCount=" << type->entries.size() << std::endl;
+
+ std::vector<const ResourceEntry*> sortedEntries;
+ for (const auto& entry : type->entries) {
+ auto iter = std::lower_bound(sortedEntries.begin(), sortedEntries.end(), entry.get(),
+ [](const ResourceEntry* a, const ResourceEntry* b) -> bool {
+ return a->entryId < b->entryId;
+ });
+ sortedEntries.insert(iter, entry.get());
+ }
+
+ for (const ResourceEntry* entry : sortedEntries) {
+ ResourceId id = { table->getPackageId(), type->typeId, entry->entryId };
+ ResourceName name = { table->getPackage(), type->type, entry->name };
+ std::cout << " spec resource " << id << " " << name;
+ if (entry->publicStatus.isPublic) {
+ std::cout << " PUBLIC";
+ }
+ std::cout << std::endl;
+
+ PrintVisitor visitor;
+ for (const auto& value : entry->values) {
+ std::cout << " (" << value.config << ") ";
+ value.value->accept(visitor, {});
+ std::cout << std::endl;
+ }
+ }
+ }
+}
+
+static size_t getNodeIndex(const std::vector<ResourceName>& names, const ResourceName& name) {
+ auto iter = std::lower_bound(names.begin(), names.end(), name);
+ assert(iter != names.end() && *iter == name);
+ return std::distance(names.begin(), iter);
+}
+
+void Debug::printStyleGraph(const std::shared_ptr<ResourceTable>& table,
+ const ResourceName& targetStyle) {
+ std::map<ResourceName, std::set<ResourceName>> graph;
+
+ std::queue<ResourceName> stylesToVisit;
+ stylesToVisit.push(targetStyle);
+ for (; !stylesToVisit.empty(); stylesToVisit.pop()) {
+ const ResourceName& styleName = stylesToVisit.front();
+ std::set<ResourceName>& parents = graph[styleName];
+ if (!parents.empty()) {
+ // We've already visited this style.
+ continue;
+ }
+
+ const ResourceTableType* type;
+ const ResourceEntry* entry;
+ std::tie(type, entry) = table->findResource(styleName);
+ if (entry) {
+ for (const auto& value : entry->values) {
+ visitFunc<Style>(*value.value, [&](const Style& style) {
+ if (style.parent.name.isValid()) {
+ parents.insert(style.parent.name);
+ stylesToVisit.push(style.parent.name);
+ }
+ });
+ }
+ }
+ }
+
+ std::vector<ResourceName> names;
+ for (const auto& entry : graph) {
+ names.push_back(entry.first);
+ }
+
+ std::cout << "digraph styles {\n";
+ for (const auto& name : names) {
+ std::cout << " node_" << getNodeIndex(names, name)
+ << " [label=\"" << name << "\"];\n";
+ }
+
+ for (const auto& entry : graph) {
+ const ResourceName& styleName = entry.first;
+ size_t styleNodeIndex = getNodeIndex(names, styleName);
+
+ for (const auto& parentName : entry.second) {
+ std::cout << " node_" << styleNodeIndex << " -> "
+ << "node_" << getNodeIndex(names, parentName) << ";\n";
+ }
+ }
+
+ std::cout << "}" << std::endl;
+}
+
+} // namespace aapt
diff --git a/tools/aapt2/Debug.h b/tools/aapt2/Debug.h
new file mode 100644
index 0000000..cdb3dcb
--- /dev/null
+++ b/tools/aapt2/Debug.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AAPT_DEBUG_H
+#define AAPT_DEBUG_H
+
+#include "Resource.h"
+#include "ResourceTable.h"
+
+#include <memory>
+
+namespace aapt {
+
+struct Debug {
+ static void printTable(const std::shared_ptr<ResourceTable>& table);
+ static void printStyleGraph(const std::shared_ptr<ResourceTable>& table,
+ const ResourceName& targetStyle);
+};
+
+} // namespace aapt
+
+#endif // AAPT_DEBUG_H
diff --git a/tools/aapt2/Flag.cpp b/tools/aapt2/Flag.cpp
index 0f63c2c..76985da 100644
--- a/tools/aapt2/Flag.cpp
+++ b/tools/aapt2/Flag.cpp
@@ -13,7 +13,7 @@
struct Flag {
std::string name;
std::string description;
- std::function<void(const StringPiece&)> action;
+ std::function<bool(const StringPiece&, std::string*)> action;
bool required;
bool* flagResult;
bool flagValueWhenSet;
@@ -23,22 +23,38 @@
static std::vector<Flag> sFlags;
static std::vector<std::string> sArgs;
+static std::function<bool(const StringPiece&, std::string*)> wrap(
+ const std::function<void(const StringPiece&)>& action) {
+ return [action](const StringPiece& arg, std::string*) -> bool {
+ action(arg);
+ return true;
+ };
+}
+
void optionalFlag(const StringPiece& name, const StringPiece& description,
std::function<void(const StringPiece&)> action) {
- sFlags.push_back(
- Flag{ name.toString(), description.toString(), action, false, nullptr, false, false });
+ sFlags.push_back(Flag{
+ name.toString(), description.toString(), wrap(action),
+ false, nullptr, false, false });
}
void requiredFlag(const StringPiece& name, const StringPiece& description,
std::function<void(const StringPiece&)> action) {
- sFlags.push_back(
- Flag{ name.toString(), description.toString(), action, true, nullptr, false, false });
+ sFlags.push_back(Flag{ name.toString(), description.toString(), wrap(action),
+ true, nullptr, false, false });
+}
+
+void requiredFlag(const StringPiece& name, const StringPiece& description,
+ std::function<bool(const StringPiece&, std::string*)> action) {
+ sFlags.push_back(Flag{ name.toString(), description.toString(), action,
+ true, nullptr, false, false });
}
void optionalSwitch(const StringPiece& name, const StringPiece& description, bool resultWhenSet,
bool* result) {
sFlags.push_back(Flag{
- name.toString(), description.toString(), {}, false, result, resultWhenSet, false });
+ name.toString(), description.toString(), {},
+ false, result, resultWhenSet, false });
}
void usageAndDie(const StringPiece& command) {
@@ -62,6 +78,7 @@
}
void parse(int argc, char** argv, const StringPiece& command) {
+ std::string errorStr;
for (int i = 0; i < argc; i++) {
const StringPiece arg(argv[i]);
if (*arg.data() != '-') {
@@ -83,7 +100,11 @@
<< std::endl;
usageAndDie(command);
}
- flag.action(argv[i]);
+
+ if (!flag.action(argv[i], &errorStr)) {
+ std::cerr << errorStr << "." << std::endl << std::endl;
+ usageAndDie(command);
+ }
}
break;
}
diff --git a/tools/aapt2/Flag.h b/tools/aapt2/Flag.h
index 4745c35..e863742 100644
--- a/tools/aapt2/Flag.h
+++ b/tools/aapt2/Flag.h
@@ -13,6 +13,9 @@
void requiredFlag(const StringPiece& name, const StringPiece& description,
std::function<void(const StringPiece&)> action);
+void requiredFlag(const StringPiece& name, const StringPiece& description,
+ std::function<bool(const StringPiece&, std::string*)> action);
+
void optionalFlag(const StringPiece& name, const StringPiece& description,
std::function<void(const StringPiece&)> action);
diff --git a/tools/aapt2/JavaClassGenerator.cpp b/tools/aapt2/JavaClassGenerator.cpp
index 2bb0e65..e2ffe79 100644
--- a/tools/aapt2/JavaClassGenerator.cpp
+++ b/tools/aapt2/JavaClassGenerator.cpp
@@ -81,23 +81,28 @@
}
struct GenArgs : ValueVisitorArgs {
- GenArgs(std::ostream* o, std::u16string* e) : out(o), entryName(e) {
+ GenArgs(std::ostream* o, const std::u16string* p, std::u16string* e) :
+ out(o), package(p), entryName(e) {
}
std::ostream* out;
+ const std::u16string* package;
std::u16string* entryName;
};
void JavaClassGenerator::visit(const Styleable& styleable, ValueVisitorArgs& a) {
const StringPiece finalModifier = mOptions.useFinal ? " final" : "";
std::ostream* out = static_cast<GenArgs&>(a).out;
+ const std::u16string* package = static_cast<GenArgs&>(a).package;
std::u16string* entryName = static_cast<GenArgs&>(a).entryName;
// This must be sorted by resource ID.
std::vector<std::pair<ResourceId, ResourceNameRef>> sortedAttributes;
sortedAttributes.reserve(styleable.entries.size());
for (const auto& attr : styleable.entries) {
- assert(attr.id.isValid() && "no ID set for Styleable entry");
+ // If we are not encoding final attributes, the styleable entry may have no ID
+ // if we are building a static library.
+ assert((!mOptions.useFinal || attr.id.isValid()) && "no ID set for Styleable entry");
assert(attr.name.isValid() && "no name set for Styleable entry");
sortedAttributes.emplace_back(attr.id, attr.name);
}
@@ -129,7 +134,7 @@
// We may reference IDs from other packages, so prefix the entry name with
// the package.
const ResourceNameRef& itemName = sortedAttributes[i].second;
- if (itemName.package != mTable->getPackage()) {
+ if (itemName.package != *package) {
*out << "_" << transform(itemName.package);
}
*out << "_" << transform(itemName.entry) << " = " << i << ";" << std::endl;
@@ -172,7 +177,7 @@
if (type.type == ResourceType::kStyleable) {
assert(!entry->values.empty());
- entry->values.front().value->accept(*this, GenArgs{ &out, &unmangledName });
+ entry->values.front().value->accept(*this, GenArgs{ &out, &package, &unmangledName });
} else {
out << " " << "public static" << finalModifier
<< " int " << transform(unmangledName) << " = " << id << ";" << std::endl;
diff --git a/tools/aapt2/JavaClassGenerator_test.cpp b/tools/aapt2/JavaClassGenerator_test.cpp
index d4341b6..b385ff4 100644
--- a/tools/aapt2/JavaClassGenerator_test.cpp
+++ b/tools/aapt2/JavaClassGenerator_test.cpp
@@ -95,8 +95,9 @@
SourceLine{ "lib.xml", 33 }, util::make_unique<Id>()));
ASSERT_TRUE(mTable->merge(std::move(table)));
- Linker linker(mTable, std::make_shared<MockResolver>(mTable,
- std::map<ResourceName, ResourceId>()));
+ Linker linker(mTable,
+ std::make_shared<MockResolver>(mTable, std::map<ResourceName, ResourceId>()),
+ {});
ASSERT_TRUE(linker.linkAndValidate());
JavaClassGenerator generator(mTable, {});
@@ -130,7 +131,7 @@
{ ResourceName{ u"com.lib", ResourceType::kAttr, u"bar" },
ResourceId{ 0x02, 0x01, 0x0000 } }}));
- Linker linker(mTable, resolver);
+ Linker linker(mTable, resolver, {});
ASSERT_TRUE(linker.linkAndValidate());
JavaClassGenerator generator(mTable, {});
diff --git a/tools/aapt2/Linker.cpp b/tools/aapt2/Linker.cpp
index a8b7a14..f3f04a5 100644
--- a/tools/aapt2/Linker.cpp
+++ b/tools/aapt2/Linker.cpp
@@ -40,8 +40,9 @@
Linker::Args::Args(const ResourceNameRef& r, const SourceLine& s) : referrer(r), source(s) {
}
-Linker::Linker(std::shared_ptr<ResourceTable> table, std::shared_ptr<IResolver> resolver) :
- mTable(table), mResolver(resolver), mError(false) {
+Linker::Linker(const std::shared_ptr<ResourceTable>& table,
+ const std::shared_ptr<IResolver>& resolver, const Options& options) :
+ mResolver(resolver), mTable(table), mOptions(options), mError(false) {
}
bool Linker::linkAndValidate() {
@@ -49,7 +50,7 @@
std::array<std::set<uint16_t>, 256> usedIds;
usedTypeIds.set(0);
- // First build the graph of references.
+ // Collect which resource IDs are already taken.
for (auto& type : *mTable) {
if (type->typeId != ResourceTableType::kUnsetTypeId) {
// The ID for this type has already been set. We
@@ -66,29 +67,10 @@
// later.
usedIds[type->typeId].insert(entry->entryId);
}
-
- if (entry->publicStatus.isPublic && entry->values.empty()) {
- // A public resource has no values. It will not be encoded
- // properly without a symbol table. This is a unresolved symbol.
- addUnresolvedSymbol(ResourceNameRef{
- mTable->getPackage(), type->type, entry->name },
- entry->publicStatus.source);
- } else {
- for (auto& valueConfig : entry->values) {
- // Dispatch to the right method of this linker
- // based on the value's type.
- valueConfig.value->accept(*this, Args{
- ResourceNameRef{ mTable->getPackage(), type->type, entry->name },
- valueConfig.source
- });
- }
- }
}
}
- /*
- * Assign resource IDs that are available.
- */
+ // Assign resource IDs that are available.
size_t nextTypeIndex = 0;
for (auto& type : *mTable) {
if (type->typeId == ResourceTableType::kUnsetTypeId) {
@@ -109,29 +91,32 @@
++nextEntryIter;
}
entry->entryId = nextIndex++;
-
- std::u16string unmangledPackage = mTable->getPackage();
- std::u16string unmangledName = entry->name;
- NameMangler::unmangle(&unmangledName, &unmangledPackage);
-
- // Update callers of this resource with the right ID.
- auto callersIter = mGraph.find(ResourceNameRef{
- unmangledPackage,
- type->type,
- unmangledName
- });
-
- if (callersIter != std::end(mGraph)) {
- for (Node& caller : callersIter->second) {
- caller.reference->id = ResourceId(mTable->getPackageId(),
- type->typeId,
- entry->entryId);
- }
- }
}
}
}
+ // Now do reference linking.
+ for (auto& type : *mTable) {
+ for (auto& entry : type->entries) {
+ if (entry->publicStatus.isPublic && entry->values.empty()) {
+ // A public resource has no values. It will not be encoded
+ // properly without a symbol table. This is a unresolved symbol.
+ addUnresolvedSymbol(ResourceNameRef{
+ mTable->getPackage(), type->type, entry->name },
+ entry->publicStatus.source);
+ continue;
+ }
+
+ for (auto& valueConfig : entry->values) {
+ // Dispatch to the right method of this linker
+ // based on the value's type.
+ valueConfig.value->accept(*this, Args{
+ ResourceNameRef{ mTable->getPackage(), type->type, entry->name },
+ valueConfig.source
+ });
+ }
+ }
+ }
return !mError;
}
@@ -139,12 +124,48 @@
return mUnresolvedSymbols;
}
+void Linker::doResolveReference(Reference& reference, const SourceLine& source) {
+ Maybe<ResourceId> result = mResolver->findId(reference.name);
+ if (!result) {
+ addUnresolvedSymbol(reference.name, source);
+ return;
+ }
+ assert(result.value().isValid());
+
+ if (mOptions.linkResourceIds) {
+ reference.id = result.value();
+ } else {
+ reference.id = 0;
+ }
+}
+
+const Attribute* Linker::doResolveAttribute(Reference& attribute, const SourceLine& source) {
+ Maybe<IResolver::Entry> result = mResolver->findAttribute(attribute.name);
+ if (!result || !result.value().attr) {
+ addUnresolvedSymbol(attribute.name, source);
+ return nullptr;
+ }
+
+ const IResolver::Entry& entry = result.value();
+ assert(entry.id.isValid());
+
+ if (mOptions.linkResourceIds) {
+ attribute.id = entry.id;
+ } else {
+ attribute.id = 0;
+ }
+ return entry.attr;
+}
+
void Linker::visit(Reference& reference, ValueVisitorArgs& a) {
Args& args = static_cast<Args&>(a);
if (!reference.name.isValid()) {
// We can't have a completely bad reference.
- assert(reference.id.isValid());
+ if (!reference.id.isValid()) {
+ Logger::error() << "srsly? " << args.referrer << std::endl;
+ assert(reference.id.isValid());
+ }
// This reference has no name but has an ID.
// It is a really bad error to have no name and have the same
@@ -156,25 +177,7 @@
return;
}
- Maybe<ResourceId> result = mResolver->findId(reference.name);
- if (!result) {
- addUnresolvedSymbol(reference.name, args.source);
- return;
- }
-
- const ResourceId& id = result.value();
- if (id.isValid()) {
- reference.id = id;
- } else {
- // We need to update the ID when it is set, so add it
- // to the graph.
- mGraph[reference.name].push_back(Node{
- args.referrer,
- args.source.path,
- args.source.line,
- &reference
- });
- }
+ doResolveReference(reference, args.source);
// TODO(adamlesinski): Verify the referencedType is another reference
// or a compatible primitive.
@@ -192,7 +195,6 @@
// We should never get here. All references would have been
// parsed in the parser phase.
assert(false);
- //mTable->addResource(name, ConfigDescription{}, source, util::make_unique<Id>());
};
convertedValue = ResourceParser::parseItemForAttribute(*str.value, attr,
@@ -240,25 +242,10 @@
}
for (Style::Entry& styleEntry : style.entries) {
- Maybe<IResolver::Entry> result = mResolver->findAttribute(styleEntry.key.name);
- if (!result || !result.value().attr) {
- addUnresolvedSymbol(styleEntry.key.name, args.source);
- continue;
+ const Attribute* attr = doResolveAttribute(styleEntry.key, args.source);
+ if (attr) {
+ processAttributeValue(args.referrer, args.source, *attr, styleEntry.value);
}
-
- const IResolver::Entry& entry = result.value();
- if (entry.id.isValid()) {
- styleEntry.key.id = entry.id;
- } else {
- // Create a dependency for the style on this attribute.
- mGraph[styleEntry.key.name].push_back(Node{
- args.referrer,
- args.source.path,
- args.source.line,
- &styleEntry.key
- });
- }
- processAttributeValue(args.referrer, args.source, *entry.attr, styleEntry.value);
}
}
@@ -300,8 +287,4 @@
mUnresolvedSymbols[name.toResourceName()].push_back(source);
}
-::std::ostream& operator<<(::std::ostream& out, const Linker::Node& node) {
- return out << node.name << "(" << node.source << ":" << node.line << ")";
-}
-
} // namespace aapt
diff --git a/tools/aapt2/Linker.h b/tools/aapt2/Linker.h
index 9db64ab..6f03515 100644
--- a/tools/aapt2/Linker.h
+++ b/tools/aapt2/Linker.h
@@ -50,14 +50,25 @@
*/
class Linker : ValueVisitor {
public:
+ struct Options {
+ /**
+ * Assign resource Ids to references when linking.
+ * When building a static library, set this to false.
+ */
+ bool linkResourceIds = true;
+ };
+
/**
* Create a Linker for the given resource table with the sources available in
* IResolver. IResolver should contain the ResourceTable as a source too.
*/
- Linker(std::shared_ptr<ResourceTable> table, std::shared_ptr<IResolver> resolver);
+ Linker(const std::shared_ptr<ResourceTable>& table,
+ const std::shared_ptr<IResolver>& resolver, const Options& options);
Linker(const Linker&) = delete;
+ virtual ~Linker() = default;
+
/**
* Entry point to the linker. Assigns resource IDs, follows references,
* and validates types. Returns true if all references to defined values
@@ -73,6 +84,12 @@
using ResourceNameToSourceMap = std::map<ResourceName, std::vector<SourceLine>>;
const ResourceNameToSourceMap& getUnresolvedReferences() const;
+protected:
+ virtual void doResolveReference(Reference& reference, const SourceLine& source);
+ virtual const Attribute* doResolveAttribute(Reference& attribute, const SourceLine& source);
+
+ std::shared_ptr<IResolver> mResolver;
+
private:
struct Args : public ValueVisitorArgs {
Args(const ResourceNameRef& r, const SourceLine& s);
@@ -92,33 +109,13 @@
void visit(Plural& plural, ValueVisitorArgs& args) override;
void processAttributeValue(const ResourceNameRef& name, const SourceLine& source,
- const Attribute& attr, std::unique_ptr<Item>& value);
+ const Attribute& attr, std::unique_ptr<Item>& value);
void addUnresolvedSymbol(const ResourceNameRef& name, const SourceLine& source);
- /**
- * Node of the resource table graph.
- */
- struct Node {
- // We use ResourceNameRef and StringPiece, which are safe so long as the ResourceTable
- // that defines the data isn't modified.
- ResourceNameRef name;
- StringPiece source;
- size_t line;
-
- // The reference object that points to name.
- Reference* reference;
-
- bool operator<(const Node& rhs) const;
- bool operator==(const Node& rhs) const;
- bool operator!=(const Node& rhs) const;
- };
- friend ::std::ostream& operator<<(::std::ostream&, const Node&);
-
std::shared_ptr<ResourceTable> mTable;
- std::shared_ptr<IResolver> mResolver;
- std::map<ResourceNameRef, std::vector<Node>> mGraph;
std::map<ResourceName, std::vector<SourceLine>> mUnresolvedSymbols;
+ Options mOptions;
bool mError;
};
diff --git a/tools/aapt2/Linker_test.cpp b/tools/aapt2/Linker_test.cpp
index 3c5b8b4..d897f98 100644
--- a/tools/aapt2/Linker_test.cpp
+++ b/tools/aapt2/Linker_test.cpp
@@ -32,7 +32,8 @@
mTable->setPackage(u"android");
mTable->setPackageId(0x01);
mLinker = std::make_shared<Linker>(mTable, std::make_shared<ResourceTableResolver>(
- mTable, std::make_shared<android::AssetManager>()));
+ mTable, std::vector<std::shared_ptr<const android::AssetManager>>()),
+ Linker::Options{});
// Create a few attributes for use in the tests.
@@ -76,7 +77,7 @@
}
TEST_F(LinkerTest, EscapeAndConvertRawString) {
- std::unique_ptr<Style> style = util::make_unique<Style>(false);
+ std::unique_ptr<Style> style = util::make_unique<Style>();
style->entries.push_back(Style::Entry{
ResourceNameRef{ u"android", ResourceType::kAttr, u"integer" },
util::make_unique<RawString>(mTable->getValueStringPool().makeRef(u" 123"))
@@ -92,7 +93,7 @@
}
TEST_F(LinkerTest, FailToConvertRawString) {
- std::unique_ptr<Style> style = util::make_unique<Style>(false);
+ std::unique_ptr<Style> style = util::make_unique<Style>();
style->entries.push_back(Style::Entry{
ResourceNameRef{ u"android", ResourceType::kAttr, u"integer" },
util::make_unique<RawString>(mTable->getValueStringPool().makeRef(u"yo what is up?"))
@@ -104,7 +105,7 @@
}
TEST_F(LinkerTest, ConvertRawStringToString) {
- std::unique_ptr<Style> style = util::make_unique<Style>(false);
+ std::unique_ptr<Style> style = util::make_unique<Style>();
style->entries.push_back(Style::Entry{
ResourceNameRef{ u"android", ResourceType::kAttr, u"string" },
util::make_unique<RawString>(
@@ -123,7 +124,7 @@
}
TEST_F(LinkerTest, ConvertRawStringToFlags) {
- std::unique_ptr<Style> style = util::make_unique<Style>(false);
+ std::unique_ptr<Style> style = util::make_unique<Style>();
style->entries.push_back(Style::Entry{
ResourceNameRef{ u"android", ResourceType::kAttr, u"flags" },
util::make_unique<RawString>(mTable->getValueStringPool().makeRef(u"banana | apple"))
diff --git a/tools/aapt2/Main.cpp b/tools/aapt2/Main.cpp
index 3377f07..025ede5 100644
--- a/tools/aapt2/Main.cpp
+++ b/tools/aapt2/Main.cpp
@@ -19,6 +19,7 @@
#include "BinaryResourceParser.h"
#include "BinaryXmlPullParser.h"
#include "BindingXmlPullParser.h"
+#include "Debug.h"
#include "Files.h"
#include "Flag.h"
#include "JavaClassGenerator.h"
@@ -55,54 +56,6 @@
using namespace aapt;
-void printTable(const ResourceTable& table) {
- std::cout << "ResourceTable package=" << table.getPackage();
- if (table.getPackageId() != ResourceTable::kUnsetPackageId) {
- std::cout << " id=" << std::hex << table.getPackageId() << std::dec;
- }
- std::cout << std::endl
- << "---------------------------------------------------------" << std::endl;
-
- for (const auto& type : table) {
- std::cout << "Type " << type->type;
- if (type->typeId != ResourceTableType::kUnsetTypeId) {
- std::cout << " [" << type->typeId << "]";
- }
- std::cout << " (" << type->entries.size() << " entries)" << std::endl;
- for (const auto& entry : type->entries) {
- std::cout << " " << entry->name;
- if (entry->entryId != ResourceEntry::kUnsetEntryId) {
- std::cout << " [" << entry->entryId << "]";
- }
- std::cout << " (" << entry->values.size() << " configurations)";
- if (entry->publicStatus.isPublic) {
- std::cout << " PUBLIC";
- }
- std::cout << std::endl;
- for (const auto& value : entry->values) {
- std::cout << " " << value.config << " (" << value.source << ") : ";
- value.value->print(std::cout);
- std::cout << std::endl;
- }
- }
- }
-}
-
-void printStringPool(const StringPool& pool) {
- std::cout << "String pool of length " << pool.size() << std::endl
- << "---------------------------------------------------------" << std::endl;
-
- size_t i = 0;
- for (const auto& entry : pool) {
- std::cout << "[" << i << "]: "
- << entry->value
- << " (Priority " << entry->context.priority
- << ", Config '" << entry->context.config << "')"
- << std::endl;
- i++;
- }
-}
-
/**
* Collect files from 'root', filtering out any files that do not
* match the FileFilter 'filter'.
@@ -144,29 +97,6 @@
return !error;
}
-bool loadResTable(android::ResTable* table, const Source& source) {
- std::ifstream ifs(source.path, std::ifstream::in | std::ifstream::binary);
- if (!ifs) {
- Logger::error(source) << strerror(errno) << std::endl;
- return false;
- }
-
- std::streampos fsize = ifs.tellg();
- ifs.seekg(0, std::ios::end);
- fsize = ifs.tellg() - fsize;
- ifs.seekg(0, std::ios::beg);
-
- assert(fsize >= 0);
- size_t dataSize = static_cast<size_t>(fsize);
- char* buf = new char[dataSize];
- ifs.read(buf, dataSize);
-
- bool result = table->add(buf, dataSize, -1, true) == android::NO_ERROR;
-
- delete [] buf;
- return result;
-}
-
void versionStylesForCompat(const std::shared_ptr<ResourceTable>& table) {
for (auto& type : *table) {
if (type->type != ResourceType::kStyle) {
@@ -228,7 +158,6 @@
};
Style& newStyle = static_cast<Style&>(*value.value);
- newStyle.weak = true;
// Move the recorded stripped attributes into this new style.
std::move(stripped.begin(), stripped.end(),
@@ -285,8 +214,6 @@
return str.substr(offset, str.size() - offset);
}
-
-
std::string buildFileReference(const ResourceNameRef& name, const ConfigDescription& config,
const StringPiece& extension) {
std::stringstream path;
@@ -321,6 +248,8 @@
enum class Phase {
Link,
Compile,
+ Dump,
+ DumpStyleGraph,
};
enum class PackageType {
@@ -364,11 +293,14 @@
// referencing attributes defined in a newer SDK
// level than the style or layout is defined for.
bool versionStylesAndLayouts = true;
+
+ // The target style that will have it's style hierarchy dumped
+ // when the phase is DumpStyleGraph.
+ ResourceName dumpStyleTarget;
};
-
bool compileXml(const AaptOptions& options, const std::shared_ptr<ResourceTable>& table,
- const CompileItem& item, std::queue<CompileItem>* outQueue, ZipFile* outApk) {
+ const CompileItem& item, ZipFile* outApk) {
std::ifstream in(item.source.path, std::ifstream::binary);
if (!in) {
Logger::error(item.source) << strerror(errno) << std::endl;
@@ -382,6 +314,45 @@
XmlFlattener::Options xmlOptions;
xmlOptions.defaultPackage = table->getPackage();
+ xmlOptions.keepRawValues = true;
+
+ std::shared_ptr<XmlPullParser> parser = std::make_shared<SourceXmlPullParser>(in);
+
+ Maybe<size_t> minStrippedSdk = flattener.flatten(item.source, parser, &outBuffer,
+ xmlOptions);
+ if (!minStrippedSdk) {
+ return false;
+ }
+
+ // Write the resulting compiled XML file to the output APK.
+ if (outApk->add(outBuffer, buildFileReference(item).data(), ZipEntry::kCompressStored,
+ nullptr) != android::NO_ERROR) {
+ Logger::error(options.output) << "failed to write compiled '" << item.source
+ << "' to apk." << std::endl;
+ return false;
+ }
+ return true;
+}
+
+bool linkXml(const AaptOptions& options, const std::shared_ptr<IResolver>& resolver,
+ const LinkItem& item, const void* data, size_t dataLen, ZipFile* outApk,
+ std::queue<LinkItem>* outQueue) {
+ std::shared_ptr<android::ResXMLTree> tree = std::make_shared<android::ResXMLTree>();
+ if (tree->setTo(data, dataLen, false) != android::NO_ERROR) {
+ return false;
+ }
+
+ std::shared_ptr<XmlPullParser> parser = std::make_shared<BinaryXmlPullParser>(tree);
+
+ BigBuffer outBuffer(1024);
+ XmlFlattener flattener({}, resolver);
+
+ XmlFlattener::Options xmlOptions;
+ xmlOptions.defaultPackage = item.originalPackage;
+
+ if (options.packageType == AaptOptions::PackageType::StaticLibrary) {
+ xmlOptions.keepRawValues = true;
+ }
if (options.versionStylesAndLayouts) {
// We strip attributes that do not belong in this version of the resource.
@@ -390,14 +361,14 @@
}
std::shared_ptr<BindingXmlPullParser> binding;
- std::shared_ptr<XmlPullParser> parser = std::make_shared<SourceXmlPullParser>(in);
if (item.name.type == ResourceType::kLayout) {
// Layouts may have defined bindings, so we need to make sure they get processed.
binding = std::make_shared<BindingXmlPullParser>(parser);
parser = binding;
}
- Maybe<size_t> minStrippedSdk = flattener.flatten(item.source, parser, &outBuffer, xmlOptions);
+ Maybe<size_t> minStrippedSdk = flattener.flatten(item.source, parser, &outBuffer,
+ xmlOptions);
if (!minStrippedSdk) {
return false;
}
@@ -405,16 +376,15 @@
if (minStrippedSdk.value() > 0) {
// Something was stripped, so let's generate a new file
// with the version of the smallest SDK version stripped.
- CompileItem newWork = item;
+ LinkItem newWork = item;
newWork.config.sdkVersion = minStrippedSdk.value();
outQueue->push(newWork);
}
- // Write the resulting compiled XML file to the output APK.
- if (outApk->add(outBuffer, buildFileReference(item).data(), ZipEntry::kCompressStored,
+ if (outApk->add(outBuffer, buildFileReference(item).data(), ZipEntry::kCompressDeflated,
nullptr) != android::NO_ERROR) {
- Logger::error(options.output) << "failed to write compiled '" << item.source << "' to apk."
- << std::endl;
+ Logger::error(options.output) << "failed to write linked file '"
+ << buildFileReference(item) << "' to apk." << std::endl;
return false;
}
@@ -444,33 +414,6 @@
return true;
}
-bool linkXml(const AaptOptions& options, const std::shared_ptr<IResolver>& resolver,
- const LinkItem& item, const void* data, size_t dataLen, ZipFile* outApk) {
- std::shared_ptr<android::ResXMLTree> tree = std::make_shared<android::ResXMLTree>();
- if (tree->setTo(data, dataLen, false) != android::NO_ERROR) {
- return false;
- }
-
- std::shared_ptr<XmlPullParser> xmlParser = std::make_shared<BinaryXmlPullParser>(tree);
-
- BigBuffer outBuffer(1024);
- XmlFlattener flattener({}, resolver);
-
- XmlFlattener::Options xmlOptions;
- xmlOptions.defaultPackage = item.originalPackage;
- if (!flattener.flatten(item.source, xmlParser, &outBuffer, xmlOptions)) {
- return false;
- }
-
- if (outApk->add(outBuffer, buildFileReference(item).data(), ZipEntry::kCompressDeflated,
- nullptr) != android::NO_ERROR) {
- Logger::error(options.output) << "failed to write linked file '" << item.source
- << "' to apk." << std::endl;
- return false;
- }
- return true;
-}
-
bool compilePng(const AaptOptions& options, const CompileItem& item, ZipFile* outApk) {
std::ifstream in(item.source.path, std::ifstream::binary);
if (!in) {
@@ -505,8 +448,8 @@
return true;
}
-bool compileManifest(const AaptOptions& options,
- const std::shared_ptr<ResourceTableResolver>& resolver, ZipFile* outApk) {
+bool compileManifest(const AaptOptions& options, const std::shared_ptr<IResolver>& resolver,
+ const android::ResTable& table, ZipFile* outApk) {
if (options.verbose) {
Logger::note(options.manifest) << "compiling AndroidManifest.xml." << std::endl;
}
@@ -534,7 +477,7 @@
return false;
}
- ManifestValidator validator(resolver->getResTable());
+ ManifestValidator validator(table);
if (!validator.validate(options.manifest, &tree)) {
return false;
}
@@ -690,7 +633,7 @@
};
bool link(const AaptOptions& options, const std::shared_ptr<ResourceTable>& outTable,
- const std::shared_ptr<ResourceTableResolver>& resolver) {
+ const std::shared_ptr<IResolver>& resolver) {
std::map<std::shared_ptr<ResourceTable>, StaticLibraryData> apkFiles;
std::unordered_set<std::u16string> linkedPackages;
@@ -744,9 +687,18 @@
}
}
+ // Version all styles referencing attributes outside of their specified SDK version.
+ if (options.versionStylesAndLayouts) {
+ versionStylesForCompat(outTable);
+ }
+
{
// Now that everything is merged, let's link it.
- Linker linker(outTable, resolver);
+ Linker::Options linkerOptions;
+ if (options.packageType == AaptOptions::PackageType::StaticLibrary) {
+ linkerOptions.linkResourceIds = false;
+ }
+ Linker linker(outTable, resolver, linkerOptions);
if (!linker.linkAndValidate()) {
return false;
}
@@ -771,7 +723,8 @@
return false;
}
- if (!compileManifest(options, resolver, &outApk)) {
+ android::ResTable binTable;
+ if (!compileManifest(options, resolver, binTable, &outApk)) {
return false;
}
@@ -791,7 +744,7 @@
assert(uncompressedData);
if (!linkXml(options, resolver, item, uncompressedData, entry->getUncompressedLen(),
- &outApk)) {
+ &outApk, &linkQueue)) {
Logger::error(options.output) << "failed to link '" << item.originalPath << "'."
<< std::endl;
return false;
@@ -864,8 +817,8 @@
// Flatten the resource table.
TableFlattener::Options flattenerOptions;
- if (options.packageType == AaptOptions::PackageType::StaticLibrary) {
- flattenerOptions.useExtendedChunks = true;
+ if (options.packageType != AaptOptions::PackageType::StaticLibrary) {
+ flattenerOptions.useExtendedChunks = false;
}
if (!writeResourceTable(options, outTable, flattenerOptions, &outApk)) {
@@ -920,12 +873,6 @@
if (error) {
return false;
}
-
- // Version all styles referencing attributes outside of their specified SDK version.
- if (options.versionStylesAndLayouts) {
- versionStylesForCompat(table);
- }
-
// Open the output APK file for writing.
ZipFile outApk;
if (outApk.open(options.output.path.data(), kOpenFlags) != android::NO_ERROR) {
@@ -941,7 +888,7 @@
error |= !addFileReference(table, item);
if (item.extension == "xml") {
- error |= !compileXml(options, table, item, &compileQueue, &outApk);
+ error |= !compileXml(options, table, item, &outApk);
} else if (item.extension == "png" || item.extension == "9.png") {
error |= !compilePng(options, item, &outApk);
} else {
@@ -954,7 +901,7 @@
}
// Link and assign resource IDs.
- Linker linker(table, resolver);
+ Linker linker(table, resolver, {});
if (!linker.linkAndValidate()) {
return false;
}
@@ -984,6 +931,7 @@
std::cerr << "The following commands are supported:" << std::endl << std::endl;
std::cerr << "compile compiles a subset of resources" << std::endl;
std::cerr << "link links together compiled resources and libraries" << std::endl;
+ std::cerr << "dump dumps resource contents to to standard out" << std::endl;
std::cerr << std::endl;
std::cerr << "run aapt2 with one of the commands and the -h flag for extra details."
<< std::endl;
@@ -1009,48 +957,67 @@
options.phase = AaptOptions::Phase::Link;
} else if (command == "compile") {
options.phase = AaptOptions::Phase::Compile;
+ } else if (command == "dump") {
+ options.phase = AaptOptions::Phase::Dump;
+ } else if (command == "dump-style-graph") {
+ options.phase = AaptOptions::Phase::DumpStyleGraph;
} else {
std::cerr << "invalid command '" << command << "'." << std::endl << std::endl;
printCommandsAndDie();
}
bool isStaticLib = false;
- if (options.phase == AaptOptions::Phase::Compile) {
- flag::requiredFlag("--package", "Android package name",
- [&options](const StringPiece& arg) {
- options.appInfo.package = util::utf8ToUtf16(arg);
- });
- flag::optionalFlag("--binding", "Output directory for binding XML files",
- [&options](const StringPiece& arg) {
- options.bindingOutput = Source{ arg.toString() };
- });
- flag::optionalSwitch("--no-version", "Disables automatic style and layout versioning",
- false, &options.versionStylesAndLayouts);
+ if (options.phase == AaptOptions::Phase::Compile ||
+ options.phase == AaptOptions::Phase::Link) {
+ if (options.phase == AaptOptions::Phase::Compile) {
+ flag::requiredFlag("--package", "Android package name",
+ [&options](const StringPiece& arg) {
+ options.appInfo.package = util::utf8ToUtf16(arg);
+ });
+ } else if (options.phase == AaptOptions::Phase::Link) {
+ flag::requiredFlag("--manifest", "AndroidManifest.xml of your app",
+ [&options](const StringPiece& arg) {
+ options.manifest = Source{ arg.toString() };
+ });
- } else if (options.phase == AaptOptions::Phase::Link) {
- flag::requiredFlag("--manifest", "AndroidManifest.xml of your app",
- [&options](const StringPiece& arg) {
- options.manifest = Source{ arg.toString() };
- });
+ flag::optionalFlag("-I", "add an Android APK to link against",
+ [&options](const StringPiece& arg) {
+ options.libraries.push_back(Source{ arg.toString() });
+ });
- flag::optionalFlag("-I", "add an Android APK to link against",
- [&options](const StringPiece& arg) {
- options.libraries.push_back(Source{ arg.toString() });
- });
+ flag::optionalFlag("--java", "directory in which to generate R.java",
+ [&options](const StringPiece& arg) {
+ options.generateJavaClass = Source{ arg.toString() };
+ });
- flag::optionalFlag("--java", "directory in which to generate R.java",
- [&options](const StringPiece& arg) {
- options.generateJavaClass = Source{ arg.toString() };
+ flag::optionalSwitch("--static-lib", "generate a static Android library", true,
+ &isStaticLib);
+
+ flag::optionalFlag("--binding", "Output directory for binding XML files",
+ [&options](const StringPiece& arg) {
+ options.bindingOutput = Source{ arg.toString() };
+ });
+ flag::optionalSwitch("--no-version", "Disables automatic style and layout versioning",
+ false, &options.versionStylesAndLayouts);
+ }
+
+ // Common flags for all steps.
+ flag::requiredFlag("-o", "Output path", [&options](const StringPiece& arg) {
+ options.output = Source{ arg.toString() };
+ });
+ } else if (options.phase == AaptOptions::Phase::DumpStyleGraph) {
+ flag::requiredFlag("--style", "Name of the style to dump",
+ [&options](const StringPiece& arg, std::string* outError) -> bool {
+ Reference styleReference;
+ if (!ResourceParser::parseStyleParentReference(util::utf8ToUtf16(arg),
+ &styleReference, outError)) {
+ return false;
+ }
+ options.dumpStyleTarget = styleReference.name;
+ return true;
});
- flag::optionalSwitch("--static-lib", "generate a static Android library", true,
- &isStaticLib);
}
- // Common flags for all steps.
- flag::requiredFlag("-o", "Output path", [&options](const StringPiece& arg) {
- options.output = Source{ arg.toString() };
- });
-
bool help = false;
flag::optionalSwitch("-v", "enables verbose logging", true, &options.verbose);
flag::optionalSwitch("-h", "displays this help menu", true, &help);
@@ -1078,10 +1045,56 @@
return options;
}
+static bool doDump(const AaptOptions& options) {
+ for (const Source& source : options.input) {
+ std::unique_ptr<ZipFile> zipFile = util::make_unique<ZipFile>();
+ if (zipFile->open(source.path.data(), ZipFile::kOpenReadOnly) != android::NO_ERROR) {
+ Logger::error(source) << "failed to open: " << strerror(errno) << std::endl;
+ return false;
+ }
+
+ std::shared_ptr<ResourceTable> table = std::make_shared<ResourceTable>();
+ std::shared_ptr<ResourceTableResolver> resolver =
+ std::make_shared<ResourceTableResolver>(
+ table, std::vector<std::shared_ptr<const android::AssetManager>>());
+
+ ZipEntry* entry = zipFile->getEntryByName("resources.arsc");
+ if (!entry) {
+ Logger::error(source) << "missing 'resources.arsc'." << std::endl;
+ return false;
+ }
+
+ std::unique_ptr<void, DeleteMalloc> uncompressedData = std::unique_ptr<void, DeleteMalloc>(
+ zipFile->uncompress(entry));
+ assert(uncompressedData);
+
+ BinaryResourceParser parser(table, resolver, source, uncompressedData.get(),
+ entry->getUncompressedLen());
+ if (!parser.parse()) {
+ return false;
+ }
+
+ if (options.phase == AaptOptions::Phase::Dump) {
+ Debug::printTable(table);
+ } else if (options.phase == AaptOptions::Phase::DumpStyleGraph) {
+ Debug::printStyleGraph(table, options.dumpStyleTarget);
+ }
+ }
+ return true;
+}
+
int main(int argc, char** argv) {
Logger::setLog(std::make_shared<Log>(std::cerr, std::cerr));
AaptOptions options = prepareArgs(argc, argv);
+ if (options.phase == AaptOptions::Phase::Dump ||
+ options.phase == AaptOptions::Phase::DumpStyleGraph) {
+ if (!doDump(options)) {
+ return 1;
+ }
+ return 0;
+ }
+
// If we specified a manifest, go ahead and load the package name from the manifest.
if (!options.manifest.path.empty()) {
if (!loadAppInfo(options.manifest, &options.appInfo)) {
@@ -1105,37 +1118,26 @@
}
// Load the included libraries.
- std::shared_ptr<android::AssetManager> libraries = std::make_shared<android::AssetManager>();
+ std::vector<std::shared_ptr<const android::AssetManager>> sources;
for (const Source& source : options.libraries) {
- if (util::stringEndsWith<char>(source.path, ".arsc")) {
- // We'll process these last so as to avoid a cookie issue.
- continue;
- }
-
+ std::shared_ptr<android::AssetManager> assetManager =
+ std::make_shared<android::AssetManager>();
int32_t cookie;
- if (!libraries->addAssetPath(android::String8(source.path.data()), &cookie)) {
+ if (!assetManager->addAssetPath(android::String8(source.path.data()), &cookie)) {
Logger::error(source) << "failed to load library." << std::endl;
return false;
}
- }
- for (const Source& source : options.libraries) {
- if (!util::stringEndsWith<char>(source.path, ".arsc")) {
- // We've already processed this.
- continue;
- }
-
- // Dirty hack but there is no other way to get a
- // writeable ResTable.
- if (!loadResTable(const_cast<android::ResTable*>(&libraries->getResources(false)),
- source)) {
+ if (cookie == 0) {
+ Logger::error(source) << "failed to load library." << std::endl;
return false;
}
+ sources.push_back(assetManager);
}
// Make the resolver that will cache IDs for us.
std::shared_ptr<ResourceTableResolver> resolver = std::make_shared<ResourceTableResolver>(
- table, libraries);
+ table, sources);
if (options.phase == AaptOptions::Phase::Compile) {
if (!compile(options, table, resolver)) {
diff --git a/tools/aapt2/MockResolver.h b/tools/aapt2/MockResolver.h
index 48ff6a6..0c9b954 100644
--- a/tools/aapt2/MockResolver.h
+++ b/tools/aapt2/MockResolver.h
@@ -34,7 +34,7 @@
MockResolver(const std::shared_ptr<ResourceTable>& table,
const std::map<ResourceName, ResourceId>& items) :
mResolver(std::make_shared<ResourceTableResolver>(
- table, std::make_shared<const android::AssetManager>())),
+ table, std::vector<std::shared_ptr<const android::AssetManager>>())),
mAttr(false, android::ResTable_map::TYPE_ANY), mItems(items) {
}
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp
index e7e824c..13f916b 100644
--- a/tools/aapt2/ResourceParser.cpp
+++ b/tools/aapt2/ResourceParser.cpp
@@ -193,18 +193,18 @@
std::unique_ptr<BinaryPrimitive> ResourceParser::tryParseNullOrEmpty(const StringPiece16& str) {
StringPiece16 trimmedStr(util::trimWhitespace(str));
- uint32_t data = 0;
+ android::Res_value value = {};
if (trimmedStr == u"@null") {
- data = android::Res_value::DATA_NULL_UNDEFINED;
+ // TYPE_NULL with data set to 0 is interpreted by the runtime as an error.
+ // Instead we set the data type to TYPE_REFERENCE with a value of 0.
+ value.dataType = android::Res_value::TYPE_REFERENCE;
} else if (trimmedStr == u"@empty") {
- data = android::Res_value::DATA_NULL_EMPTY;
+ // TYPE_NULL with value of DATA_NULL_EMPTY is handled fine by the runtime.
+ value.dataType = android::Res_value::TYPE_NULL;
+ value.data = android::Res_value::DATA_NULL_EMPTY;
} else {
return {};
}
-
- android::Res_value value = {};
- value.dataType = android::Res_value::TYPE_NULL;
- value.data = data;
return util::make_unique<BinaryPrimitive>(value);
}
@@ -1163,7 +1163,7 @@
bool ResourceParser::parseStyle(XmlPullParser* parser, const ResourceNameRef& resourceName) {
const SourceLine source = mSource.line(parser->getLineNumber());
- std::unique_ptr<Style> style = util::make_unique<Style>(false);
+ std::unique_ptr<Style> style = util::make_unique<Style>();
const auto endAttrIter = parser->endAttributes();
const auto parentAttrIter = parser->findAttribute(u"", u"parent");
@@ -1181,6 +1181,16 @@
// If no package is specified, this can not be an alias and is the local package.
style->parent.name.package = mTable->getPackage();
}
+ } else {
+ // No parent was specified, so try inferring it from the style name.
+ std::u16string styleName = resourceName.entry.toString();
+ size_t pos = styleName.find_last_of(u'.');
+ if (pos != std::string::npos) {
+ style->parentInferred = true;
+ style->parent.name.package = mTable->getPackage();
+ style->parent.name.type = ResourceType::kStyle;
+ style->parent.name.entry = styleName.substr(0, pos);
+ }
}
bool success = true;
diff --git a/tools/aapt2/ResourceParser_test.cpp b/tools/aapt2/ResourceParser_test.cpp
index 00be3bd..a93d0ff 100644
--- a/tools/aapt2/ResourceParser_test.cpp
+++ b/tools/aapt2/ResourceParser_test.cpp
@@ -191,6 +191,32 @@
EXPECT_EQ(std::u16string(u"?123"), *str->value);
}
+TEST_F(ResourceParserTest, ParseNull) {
+ std::string input = "<integer name=\"foo\">@null</integer>";
+ ASSERT_TRUE(testParse(input));
+
+ // The Android runtime treats a value of android::Res_value::TYPE_NULL as
+ // a non-existing value, and this causes problems in styles when trying to resolve
+ // an attribute. Null values must be encoded as android::Res_value::TYPE_REFERENCE
+ // with a data value of 0.
+ const BinaryPrimitive* integer = findResource<BinaryPrimitive>(ResourceName{
+ u"android", ResourceType::kInteger, u"foo" });
+ ASSERT_NE(nullptr, integer);
+ EXPECT_EQ(uint16_t(android::Res_value::TYPE_REFERENCE), integer->value.dataType);
+ EXPECT_EQ(0u, integer->value.data);
+}
+
+TEST_F(ResourceParserTest, ParseEmpty) {
+ std::string input = "<integer name=\"foo\">@empty</integer>";
+ ASSERT_TRUE(testParse(input));
+
+ const BinaryPrimitive* integer = findResource<BinaryPrimitive>(ResourceName{
+ u"android", ResourceType::kInteger, u"foo" });
+ ASSERT_NE(nullptr, integer);
+ EXPECT_EQ(uint16_t(android::Res_value::TYPE_NULL), integer->value.dataType);
+ EXPECT_EQ(uint32_t(android::Res_value::DATA_NULL_EMPTY), integer->value.data);
+}
+
TEST_F(ResourceParserTest, ParseAttr) {
std::string input = "<attr name=\"foo\" format=\"string\"/>\n"
"<attr name=\"bar\"/>";
@@ -355,6 +381,28 @@
style->entries[0].key.name);
}
+TEST_F(ResourceParserTest, ParseStyleWithInferredParent) {
+ std::string input = "<style name=\"foo.bar\"/>";
+ ASSERT_TRUE(testParse(input));
+
+ const Style* style = findResource<Style>(ResourceName{
+ u"android", ResourceType::kStyle, u"foo.bar" });
+ ASSERT_NE(style, nullptr);
+ EXPECT_EQ(style->parent.name, (ResourceName{ u"android", ResourceType::kStyle, u"foo" }));
+ EXPECT_TRUE(style->parentInferred);
+}
+
+TEST_F(ResourceParserTest, ParseStyleWithInferredParentOverridenByEmptyParentAttribute) {
+ std::string input = "<style name=\"foo.bar\" parent=\"\"/>";
+ ASSERT_TRUE(testParse(input));
+
+ const Style* style = findResource<Style>(ResourceName{
+ u"android", ResourceType::kStyle, u"foo.bar" });
+ ASSERT_NE(style, nullptr);
+ EXPECT_FALSE(style->parent.name.isValid());
+ EXPECT_FALSE(style->parentInferred);
+}
+
TEST_F(ResourceParserTest, ParseAutoGeneratedIdReference) {
std::string input = "<string name=\"foo\">@+id/bar</string>";
ASSERT_TRUE(testParse(input));
diff --git a/tools/aapt2/ResourceTable.cpp b/tools/aapt2/ResourceTable.cpp
index 9468860..c93ecc7 100644
--- a/tools/aapt2/ResourceTable.cpp
+++ b/tools/aapt2/ResourceTable.cpp
@@ -42,6 +42,8 @@
}
ResourceTable::ResourceTable() : mPackageId(kUnsetPackageId) {
+ // Make sure attrs always have type ID 1.
+ findOrCreateType(ResourceType::kAttr)->typeId = 1;
}
std::unique_ptr<ResourceTableType>& ResourceTable::findOrCreateType(ResourceType type) {
@@ -142,10 +144,30 @@
}
static constexpr const char16_t* kValidNameChars = u"._-";
+static constexpr const char16_t* kValidNameMangledChars = u"._-$";
+
+bool ResourceTable::addResource(const ResourceNameRef& name, const ConfigDescription& config,
+ const SourceLine& source, std::unique_ptr<Value> value) {
+ return addResourceImpl(name, ResourceId{}, config, source, std::move(value), kValidNameChars);
+}
bool ResourceTable::addResource(const ResourceNameRef& name, const ResourceId resId,
- const ConfigDescription& config, const SourceLine& source,
- std::unique_ptr<Value> value) {
+ const ConfigDescription& config, const SourceLine& source,
+ std::unique_ptr<Value> value) {
+ return addResourceImpl(name, resId, config, source, std::move(value), kValidNameChars);
+}
+
+bool ResourceTable::addResourceAllowMangled(const ResourceNameRef& name,
+ const ConfigDescription& config,
+ const SourceLine& source,
+ std::unique_ptr<Value> value) {
+ return addResourceImpl(name, ResourceId{}, config, source, std::move(value),
+ kValidNameMangledChars);
+}
+
+bool ResourceTable::addResourceImpl(const ResourceNameRef& name, const ResourceId resId,
+ const ConfigDescription& config, const SourceLine& source,
+ std::unique_ptr<Value> value, const char16_t* validChars) {
if (!name.package.empty() && name.package != mPackage) {
Logger::error(source)
<< "resource '"
@@ -157,7 +179,7 @@
return false;
}
- auto badCharIter = util::findNonAlphaNumericAndNotInSet(name.entry, kValidNameChars);
+ auto badCharIter = util::findNonAlphaNumericAndNotInSet(name.entry, validChars);
if (badCharIter != name.entry.end()) {
Logger::error(source)
<< "resource '"
@@ -233,13 +255,18 @@
return true;
}
-bool ResourceTable::addResource(const ResourceNameRef& name, const ConfigDescription& config,
- const SourceLine& source, std::unique_ptr<Value> value) {
- return addResource(name, ResourceId{}, config, source, std::move(value));
-}
-
bool ResourceTable::markPublic(const ResourceNameRef& name, const ResourceId resId,
const SourceLine& source) {
+ return markPublicImpl(name, resId, source, kValidNameChars);
+}
+
+bool ResourceTable::markPublicAllowMangled(const ResourceNameRef& name, const ResourceId resId,
+ const SourceLine& source) {
+ return markPublicImpl(name, resId, source, kValidNameMangledChars);
+}
+
+bool ResourceTable::markPublicImpl(const ResourceNameRef& name, const ResourceId resId,
+ const SourceLine& source, const char16_t* validChars) {
if (!name.package.empty() && name.package != mPackage) {
Logger::error(source)
<< "resource '"
@@ -251,7 +278,7 @@
return false;
}
- auto badCharIter = util::findNonAlphaNumericAndNotInSet(name.entry, kValidNameChars);
+ auto badCharIter = util::findNonAlphaNumericAndNotInSet(name.entry, validChars);
if (badCharIter != name.entry.end()) {
Logger::error(source)
<< "resource '"
diff --git a/tools/aapt2/ResourceTable.h b/tools/aapt2/ResourceTable.h
index 94bacd8..706f56a 100644
--- a/tools/aapt2/ResourceTable.h
+++ b/tools/aapt2/ResourceTable.h
@@ -143,11 +143,21 @@
bool addResource(const ResourceNameRef& name, const ConfigDescription& config,
const SourceLine& source, std::unique_ptr<Value> value);
+ /**
+ * Same as addResource, but doesn't verify the validity of the name. This is used
+ * when loading resources from an existing binary resource table that may have mangled
+ * names.
+ */
+ bool addResourceAllowMangled(const ResourceNameRef& name, const ConfigDescription& config,
+ const SourceLine& source, std::unique_ptr<Value> value);
+
bool addResource(const ResourceNameRef& name, const ResourceId resId,
const ConfigDescription& config, const SourceLine& source,
std::unique_ptr<Value> value);
bool markPublic(const ResourceNameRef& name, const ResourceId resId, const SourceLine& source);
+ bool markPublicAllowMangled(const ResourceNameRef& name, const ResourceId resId,
+ const SourceLine& source);
/*
* Merges the resources from `other` into this table, mangling the names of the resources
@@ -176,6 +186,12 @@
std::unique_ptr<ResourceEntry>& findOrCreateEntry(std::unique_ptr<ResourceTableType>& type,
const StringPiece16& name);
+ bool addResourceImpl(const ResourceNameRef& name, const ResourceId resId,
+ const ConfigDescription& config, const SourceLine& source,
+ std::unique_ptr<Value> value, const char16_t* validChars);
+ bool markPublicImpl(const ResourceNameRef& name, const ResourceId resId,
+ const SourceLine& source, const char16_t* validChars);
+
std::u16string mPackage;
size_t mPackageId;
diff --git a/tools/aapt2/ResourceTableResolver.cpp b/tools/aapt2/ResourceTableResolver.cpp
index 0a9f521..910c2c0 100644
--- a/tools/aapt2/ResourceTableResolver.cpp
+++ b/tools/aapt2/ResourceTableResolver.cpp
@@ -31,13 +31,15 @@
ResourceTableResolver::ResourceTableResolver(
std::shared_ptr<const ResourceTable> table,
- std::shared_ptr<const android::AssetManager> sources) :
+ const std::vector<std::shared_ptr<const android::AssetManager>>& sources) :
mTable(table), mSources(sources) {
- const android::ResTable& resTable = mSources->getResources(false);
- const size_t packageCount = resTable.getBasePackageCount();
- for (size_t i = 0; i < packageCount; i++) {
- std::u16string packageName = resTable.getBasePackageName(i).string();
- mIncludedPackages.insert(std::move(packageName));
+ for (const auto& assetManager : mSources) {
+ const android::ResTable& resTable = assetManager->getResources(false);
+ const size_t packageCount = resTable.getBasePackageCount();
+ for (size_t i = 0; i < packageCount; i++) {
+ std::u16string packageName = resTable.getBasePackageName(i).string();
+ mIncludedPackages.insert(std::move(packageName));
+ }
}
}
@@ -99,20 +101,23 @@
}
Maybe<ResourceName> ResourceTableResolver::findName(ResourceId resId) {
- const android::ResTable& table = mSources->getResources(false);
+ for (const auto& assetManager : mSources) {
+ const android::ResTable& table = assetManager->getResources(false);
- android::ResTable::resource_name resourceName;
- if (!table.getResourceName(resId.id, false, &resourceName)) {
- return {};
+ android::ResTable::resource_name resourceName;
+ if (!table.getResourceName(resId.id, false, &resourceName)) {
+ continue;
+ }
+
+ const ResourceType* type = parseResourceType(StringPiece16(resourceName.type,
+ resourceName.typeLen));
+ assert(type);
+ return ResourceName{
+ { resourceName.package, resourceName.packageLen },
+ *type,
+ { resourceName.name, resourceName.nameLen } };
}
-
- const ResourceType* type = parseResourceType(StringPiece16(resourceName.type,
- resourceName.typeLen));
- assert(type);
- return ResourceName{
- { resourceName.package, resourceName.packageLen },
- *type,
- { resourceName.name, resourceName.nameLen } };
+ return {};
}
/**
@@ -122,73 +127,76 @@
*/
const ResourceTableResolver::CacheEntry* ResourceTableResolver::buildCacheEntry(
const ResourceName& name) {
- const android::ResTable& table = mSources->getResources(false);
+ for (const auto& assetManager : mSources) {
+ const android::ResTable& table = assetManager->getResources(false);
- const StringPiece16 type16 = toString(name.type);
- ResourceId resId {
- table.identifierForName(
- name.entry.data(), name.entry.size(),
- type16.data(), type16.size(),
- name.package.data(), name.package.size())
- };
+ const StringPiece16 type16 = toString(name.type);
+ ResourceId resId {
+ table.identifierForName(
+ name.entry.data(), name.entry.size(),
+ type16.data(), type16.size(),
+ name.package.data(), name.package.size())
+ };
- if (!resId.isValid()) {
- return nullptr;
- }
+ if (!resId.isValid()) {
+ continue;
+ }
- CacheEntry& entry = mCache[name];
- entry.id = resId;
+ CacheEntry& entry = mCache[name];
+ entry.id = resId;
- //
- // Now check to see if this resource is an Attribute.
- //
+ //
+ // Now check to see if this resource is an Attribute.
+ //
- const android::ResTable::bag_entry* bagBegin;
- ssize_t bags = table.lockBag(resId.id, &bagBegin);
- if (bags < 1) {
+ const android::ResTable::bag_entry* bagBegin;
+ ssize_t bags = table.lockBag(resId.id, &bagBegin);
+ if (bags < 1) {
+ table.unlockBag(bagBegin);
+ return &entry;
+ }
+
+ // Look for the ATTR_TYPE key in the bag and check the types it supports.
+ uint32_t attrTypeMask = 0;
+ for (ssize_t i = 0; i < bags; i++) {
+ if (bagBegin[i].map.name.ident == android::ResTable_map::ATTR_TYPE) {
+ attrTypeMask = bagBegin[i].map.value.data;
+ }
+ }
+
+ entry.attr = util::make_unique<Attribute>(false);
+
+ if (attrTypeMask & android::ResTable_map::TYPE_ENUM ||
+ attrTypeMask & android::ResTable_map::TYPE_FLAGS) {
+ for (ssize_t i = 0; i < bags; i++) {
+ if (Res_INTERNALID(bagBegin[i].map.name.ident)) {
+ // Internal IDs are special keys, which are not enum/flag symbols, so skip.
+ continue;
+ }
+
+ android::ResTable::resource_name symbolName;
+ bool result = table.getResourceName(bagBegin[i].map.name.ident, false,
+ &symbolName);
+ assert(result);
+ const ResourceType* type = parseResourceType(
+ StringPiece16(symbolName.type, symbolName.typeLen));
+ assert(type);
+
+ entry.attr->symbols.push_back(Attribute::Symbol{
+ Reference(ResourceNameRef(
+ StringPiece16(symbolName.package, symbolName.packageLen),
+ *type,
+ StringPiece16(symbolName.name, symbolName.nameLen))),
+ bagBegin[i].map.value.data
+ });
+ }
+ }
+
+ entry.attr->typeMask |= attrTypeMask;
table.unlockBag(bagBegin);
return &entry;
}
-
- // Look for the ATTR_TYPE key in the bag and check the types it supports.
- uint32_t attrTypeMask = 0;
- for (ssize_t i = 0; i < bags; i++) {
- if (bagBegin[i].map.name.ident == android::ResTable_map::ATTR_TYPE) {
- attrTypeMask = bagBegin[i].map.value.data;
- }
- }
-
- entry.attr = util::make_unique<Attribute>(false);
-
- if (attrTypeMask & android::ResTable_map::TYPE_ENUM ||
- attrTypeMask & android::ResTable_map::TYPE_FLAGS) {
- for (ssize_t i = 0; i < bags; i++) {
- if (Res_INTERNALID(bagBegin[i].map.name.ident)) {
- // Internal IDs are special keys, which are not enum/flag symbols, so skip.
- continue;
- }
-
- android::ResTable::resource_name symbolName;
- bool result = table.getResourceName(bagBegin[i].map.name.ident, false,
- &symbolName);
- assert(result);
- const ResourceType* type = parseResourceType(
- StringPiece16(symbolName.type, symbolName.typeLen));
- assert(type);
-
- entry.attr->symbols.push_back(Attribute::Symbol{
- Reference(ResourceNameRef(
- StringPiece16(symbolName.package, symbolName.packageLen),
- *type,
- StringPiece16(symbolName.name, symbolName.nameLen))),
- bagBegin[i].map.value.data
- });
- }
- }
-
- entry.attr->typeMask |= attrTypeMask;
- table.unlockBag(bagBegin);
- return &entry;
+ return nullptr;
}
} // namespace aapt
diff --git a/tools/aapt2/ResourceTableResolver.h b/tools/aapt2/ResourceTableResolver.h
index c8e8ab7..8f6b0b5 100644
--- a/tools/aapt2/ResourceTableResolver.h
+++ b/tools/aapt2/ResourceTableResolver.h
@@ -24,7 +24,6 @@
#include "ResourceValues.h"
#include <androidfw/AssetManager.h>
-#include <androidfw/ResourceTypes.h>
#include <memory>
#include <vector>
#include <unordered_set>
@@ -40,8 +39,9 @@
* Creates a resolver with a local ResourceTable and an AssetManager
* loaded with library packages.
*/
- ResourceTableResolver(std::shared_ptr<const ResourceTable> table,
- std::shared_ptr<const android::AssetManager> sources);
+ ResourceTableResolver(
+ std::shared_ptr<const ResourceTable> table,
+ const std::vector<std::shared_ptr<const android::AssetManager>>& sources);
ResourceTableResolver(const ResourceTableResolver&) = delete; // Not copyable.
@@ -51,8 +51,6 @@
virtual Maybe<ResourceName> findName(ResourceId resId) override;
- const android::ResTable& getResTable() const;
-
private:
struct CacheEntry {
ResourceId id;
@@ -62,15 +60,11 @@
const CacheEntry* buildCacheEntry(const ResourceName& name);
std::shared_ptr<const ResourceTable> mTable;
- std::shared_ptr<const android::AssetManager> mSources;
+ std::vector<std::shared_ptr<const android::AssetManager>> mSources;
std::map<ResourceName, CacheEntry> mCache;
std::unordered_set<std::u16string> mIncludedPackages;
};
-inline const android::ResTable& ResourceTableResolver::getResTable() const {
- return mSources->getResources(false);
-}
-
} // namespace aapt
#endif // AAPT_RESOURCE_TABLE_RESOLVER_H
diff --git a/tools/aapt2/ResourceValues.cpp b/tools/aapt2/ResourceValues.cpp
index 2bf38e4..aabb375 100644
--- a/tools/aapt2/ResourceValues.cpp
+++ b/tools/aapt2/ResourceValues.cpp
@@ -101,8 +101,8 @@
}
bool Id::flatten(android::Res_value& out) const {
- out.dataType = android::Res_value::TYPE_NULL;
- out.data = android::Res_value::DATA_NULL_UNDEFINED;
+ out.dataType = android::Res_value::TYPE_INT_BOOLEAN;
+ out.data = 0;
return true;
}
@@ -231,17 +231,15 @@
return attr;
}
-void Attribute::print(std::ostream& out) const {
- out << "(attr)";
+void Attribute::printMask(std::ostream& out) const {
if (typeMask == android::ResTable_map::TYPE_ANY) {
- out << " any";
+ out << "any";
return;
}
bool set = false;
if ((typeMask & android::ResTable_map::TYPE_REFERENCE) != 0) {
if (!set) {
- out << " ";
set = true;
} else {
out << "|";
@@ -251,7 +249,6 @@
if ((typeMask & android::ResTable_map::TYPE_STRING) != 0) {
if (!set) {
- out << " ";
set = true;
} else {
out << "|";
@@ -261,7 +258,6 @@
if ((typeMask & android::ResTable_map::TYPE_INTEGER) != 0) {
if (!set) {
- out << " ";
set = true;
} else {
out << "|";
@@ -271,7 +267,6 @@
if ((typeMask & android::ResTable_map::TYPE_BOOLEAN) != 0) {
if (!set) {
- out << " ";
set = true;
} else {
out << "|";
@@ -281,7 +276,6 @@
if ((typeMask & android::ResTable_map::TYPE_COLOR) != 0) {
if (!set) {
- out << " ";
set = true;
} else {
out << "|";
@@ -291,7 +285,6 @@
if ((typeMask & android::ResTable_map::TYPE_FLOAT) != 0) {
if (!set) {
- out << " ";
set = true;
} else {
out << "|";
@@ -301,7 +294,6 @@
if ((typeMask & android::ResTable_map::TYPE_DIMENSION) != 0) {
if (!set) {
- out << " ";
set = true;
} else {
out << "|";
@@ -311,7 +303,6 @@
if ((typeMask & android::ResTable_map::TYPE_FRACTION) != 0) {
if (!set) {
- out << " ";
set = true;
} else {
out << "|";
@@ -321,7 +312,6 @@
if ((typeMask & android::ResTable_map::TYPE_ENUM) != 0) {
if (!set) {
- out << " ";
set = true;
} else {
out << "|";
@@ -331,13 +321,17 @@
if ((typeMask & android::ResTable_map::TYPE_FLAGS) != 0) {
if (!set) {
- out << " ";
set = true;
} else {
out << "|";
}
out << "flags";
}
+}
+
+void Attribute::print(std::ostream& out) const {
+ out << "(attr) ";
+ printMask(out);
out << " ["
<< util::joiner(symbols.begin(), symbols.end(), ", ")
@@ -348,20 +342,10 @@
}
}
-static ::std::ostream& operator<<(::std::ostream& out, const Attribute::Symbol& s) {
- return out << s.symbol.name.entry << "=" << s.value;
-}
-
-Style::Style(bool weak) : weak(weak) {
-}
-
-bool Style::isWeak() const {
- return weak;
-}
-
Style* Style::clone(StringPool* newPool) const {
- Style* style = new Style(weak);
+ Style* style = new Style();
style->parent = parent;
+ style->parentInferred = parentInferred;
for (auto& entry : entries) {
style->entries.push_back(Entry{
entry.key,
diff --git a/tools/aapt2/ResourceValues.h b/tools/aapt2/ResourceValues.h
index f8ece6f..ef6594e 100644
--- a/tools/aapt2/ResourceValues.h
+++ b/tools/aapt2/ResourceValues.h
@@ -222,6 +222,7 @@
bool isWeak() const override;
virtual Attribute* clone(StringPool* newPool) const override;
+ void printMask(std::ostream& out) const;
virtual void print(std::ostream& out) const override;
};
@@ -231,12 +232,16 @@
std::unique_ptr<Item> value;
};
- bool weak;
Reference parent;
+
+ /**
+ * If set to true, the parent was auto inferred from the
+ * style's name.
+ */
+ bool parentInferred = false;
+
std::vector<Entry> entries;
- Style(bool weak);
- bool isWeak() const override;
Style* clone(StringPool* newPool) const override;
void print(std::ostream& out) const override;
};
@@ -280,6 +285,10 @@
return out;
}
+inline ::std::ostream& operator<<(::std::ostream& out, const Attribute::Symbol& s) {
+ return out << s.symbol.name.entry << "=" << s.value;
+}
+
/**
* The argument object that gets passed through the value
* back to the ValueVisitor. Subclasses of ValueVisitor should
diff --git a/tools/aapt2/TableFlattener.cpp b/tools/aapt2/TableFlattener.cpp
index aa0f1d5..539c48f 100644
--- a/tools/aapt2/TableFlattener.cpp
+++ b/tools/aapt2/TableFlattener.cpp
@@ -79,6 +79,7 @@
// Write the key.
if (!Res_INTERNALID(key.id.id) && !key.id.isValid()) {
+ assert(key.name.isValid());
mSymbols->push_back(std::make_pair(ResourceNameRef(key.name),
mOut->size() - sizeof(*outMapEntry)));
}
@@ -96,6 +97,23 @@
outMapEntry->value.size = sizeof(outMapEntry->value);
}
+ void flattenValueOnly(const Item& value) {
+ mMap->count++;
+
+ android::ResTable_map* outMapEntry = mOut->nextBlock<android::ResTable_map>();
+
+ // Write the value.
+ value.flatten(outMapEntry->value);
+
+ if (outMapEntry->value.data == 0x0) {
+ visitFunc<Reference>(value, [&](const Reference& reference) {
+ mSymbols->push_back(std::make_pair(ResourceNameRef(reference.name),
+ mOut->size() - sizeof(outMapEntry->value.data)));
+ });
+ }
+ outMapEntry->value.size = sizeof(outMapEntry->value);
+ }
+
static bool compareStyleEntries(const Style::Entry* lhs, const Style::Entry* rhs) {
return lhs->key.id < rhs->key.id;
}
@@ -139,7 +157,7 @@
void visit(const Array& array, ValueVisitorArgs&) override {
for (const auto& item : array.items) {
- flattenEntry({}, *item);
+ flattenValueOnly(*item);
}
}
@@ -334,6 +352,10 @@
spec->id = type->typeId;
spec->entryCount = type->entries.size();
+ if (type->entries.empty()) {
+ continue;
+ }
+
// Reserve space for the masks of each resource in this type. These
// show for which configuration axis the resource changes.
uint32_t* configMasks = typeBlock.nextBlock<uint32_t>(type->entries.size());
diff --git a/tools/aapt2/XmlFlattener.cpp b/tools/aapt2/XmlFlattener.cpp
index 650e624..f78e38d 100644
--- a/tools/aapt2/XmlFlattener.cpp
+++ b/tools/aapt2/XmlFlattener.cpp
@@ -300,6 +300,7 @@
elem->attributeCount = sortedAttributes.size();
// Flatten the sorted attributes.
+ uint16_t attributeIndex = 1;
for (auto entry : sortedAttributes) {
android::ResXMLTree_attribute* attr =
out.nextBlock<android::ResXMLTree_attribute>();
@@ -310,44 +311,65 @@
attr->ns.index = -1;
}
- stringRefs.emplace_back(entry.nameRef, &attr->name);
- attr->rawValue.index = -1;
-
StringPool::Ref rawValueRef = pool.makeRef(entry.xmlAttr->value, lowPriority);
- if (entry.attr) {
- std::unique_ptr<Item> value = ResourceParser::parseItemForAttribute(
- entry.xmlAttr->value, *entry.attr);
- if (value) {
- AttributeValueFlattener flattener(
- mResolver,
- &logger,
- &attr->typedValue,
- parser,
- &error,
- rawValueRef,
- &options.defaultPackage,
- &stringRefs);
- value->accept(flattener, {});
- } else if (!(entry.attr->typeMask & android::ResTable_map::TYPE_STRING)) {
- logger.error(parser->getLineNumber())
- << "'"
- << *rawValueRef
- << "' is not compatible with attribute "
- << *entry.attr
- << "."
- << std::endl;
- error = true;
- } else {
- attr->typedValue.dataType = android::Res_value::TYPE_STRING;
- stringRefs.emplace_back(rawValueRef, &attr->rawValue);
- stringRefs.emplace_back(rawValueRef,
- reinterpret_cast<android::ResStringPool_ref*>(
- &attr->typedValue.data));
+ stringRefs.emplace_back(entry.nameRef, &attr->name);
+
+ if (options.keepRawValues) {
+ stringRefs.emplace_back(rawValueRef, &attr->rawValue);
+ } else {
+ attr->rawValue.index = -1;
+ }
+
+ // Assign the indices for specific attributes.
+ if (entry.xmlAttr->namespaceUri == kSchemaAndroid &&
+ entry.xmlAttr->name == u"id") {
+ elem->idIndex = attributeIndex;
+ } else if (entry.xmlAttr->namespaceUri.empty()) {
+ if (entry.xmlAttr->name == u"class") {
+ elem->classIndex = attributeIndex;
+ } else if (entry.xmlAttr->name == u"style") {
+ elem->styleIndex = attributeIndex;
}
+ }
+ attributeIndex++;
+
+ std::unique_ptr<Item> value;
+ if (entry.attr) {
+ value = ResourceParser::parseItemForAttribute(entry.xmlAttr->value,
+ *entry.attr);
+ } else {
+ bool create = false;
+ value = ResourceParser::tryParseReference(entry.xmlAttr->value, &create);
+ }
+
+ if (mResolver && value) {
+ AttributeValueFlattener flattener(
+ mResolver,
+ &logger,
+ &attr->typedValue,
+ parser,
+ &error,
+ rawValueRef,
+ &options.defaultPackage,
+ &stringRefs);
+ value->accept(flattener, {});
+ } else if (!value && entry.attr &&
+ !(entry.attr->typeMask & android::ResTable_map::TYPE_STRING)) {
+ logger.error(parser->getLineNumber())
+ << "'"
+ << *rawValueRef
+ << "' is not compatible with attribute "
+ << *entry.attr
+ << "."
+ << std::endl;
+ error = true;
} else {
attr->typedValue.dataType = android::Res_value::TYPE_STRING;
- stringRefs.emplace_back(rawValueRef, &attr->rawValue);
+ if (!options.keepRawValues) {
+ // Don't set the string twice.
+ stringRefs.emplace_back(rawValueRef, &attr->rawValue);
+ }
stringRefs.emplace_back(rawValueRef,
reinterpret_cast<android::ResStringPool_ref*>(
&attr->typedValue.data));
@@ -440,6 +462,9 @@
header->header.type = android::RES_XML_TYPE;
header->header.headerSize = sizeof(*header);
+ // Flatten the StringPool.
+ StringPool::flattenUtf16(outBuffer, pool);
+
// Write the array of resource IDs, indexed by StringPool order.
const size_t beforeResIdMapIndex = outBuffer->size();
android::ResChunk_header* resIdMapChunk = outBuffer->nextBlock<android::ResChunk_header>();
@@ -458,10 +483,7 @@
}
resIdMapChunk->size = outBuffer->size() - beforeResIdMapIndex;
- // Flatten the StringPool.
- StringPool::flattenUtf16(outBuffer, pool);
-
- // Move the temporary BigBuffer into outBuffer->
+ // Move the temporary BigBuffer into outBuffer.
outBuffer->appendBuffer(std::move(out));
header->header.size = outBuffer->size() - beforeXmlTreeIndex;
diff --git a/tools/aapt2/XmlFlattener.h b/tools/aapt2/XmlFlattener.h
index 60a500e..2cfcc16 100644
--- a/tools/aapt2/XmlFlattener.h
+++ b/tools/aapt2/XmlFlattener.h
@@ -47,6 +47,12 @@
* max SDK.
*/
Maybe<size_t> maxSdkAttribute;
+
+ /**
+ * Setting this to true will keep the raw string value of
+ * an attribute's value when it has been resolved.
+ */
+ bool keepRawValues = false;
};
/**
diff --git a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
index f5ef01b..0c8c0d6 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
@@ -1137,7 +1137,7 @@
}
private void reset() {
- mFlags = Paint.DEFAULT_PAINT_FLAGS | Paint.HIDDEN_DEFAULT_PAINT_FLAGS;
+ mFlags = Paint.HIDDEN_DEFAULT_PAINT_FLAGS;
mColor = 0xFF000000;
mStyle = Paint.Style.FILL.nativeInt;
mCap = Paint.Cap.BUTT.nativeInt;
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java
index 4c4454d..66092fc 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java
@@ -91,7 +91,11 @@
}
@Override
- public void doneAnimating() {
+ public void onAnimationStarted(int remainingFrameCount) {
+ }
+
+ @Override
+ public void onAnimationStopped() {
}
@Override