19c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray/* 29c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray * Copyright (C) 2014 The Android Open Source Project 39c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray * 49c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray * Licensed under the Apache License, Version 2.0 (the "License"); 59c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray * you may not use this file except in compliance with the License. 69c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray * You may obtain a copy of the License at 79c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray * 89c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray * http://www.apache.org/licenses/LICENSE-2.0 99c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray * 109c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray * Unless required by applicable law or agreed to in writing, software 119c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray * distributed under the License is distributed on an "AS IS" BASIS, 129c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 139c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray * See the License for the specific language governing permissions and 149c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray * limitations under the License. 159c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray */ 169c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray 179c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffraypublic class Main { 189c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray public static void main(String[] args) { 199c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray System.out.println( 209c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray "Has oat is " + hasOat() + ", is dex2oat enabled is " + isDex2OatEnabled() + "."); 219c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray 229c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray if (hasOat() && !isDex2OatEnabled()) { 239c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray throw new Error("Application with dex2oat disabled runs with an oat file"); 249c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray } else if (!hasOat() && isDex2OatEnabled()) { 259c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray throw new Error("Application with dex2oat enabled runs without an oat file"); 269c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray } 279c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray } 289c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray 299c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray static { 309c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray System.loadLibrary("arttest"); 319c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray } 329c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray 339c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray private native static boolean hasOat(); 349c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray 359c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray private native static boolean isDex2OatEnabled(); 369c290012b7f505ae1943ab87236f775b97a46e2dNicolas Geoffray} 37