13d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel/*
23d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel * Copyright (C) 2014 The Android Open Source Project
33d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel *
43d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel * Licensed under the Apache License, Version 2.0 (the "License"); you may not
53d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel * use this file except in compliance with the License. You may obtain a copy of
63d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel * the License at
73d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel *
83d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel * http://www.apache.org/licenses/LICENSE-2.0
93d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel *
103d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel * Unless required by applicable law or agreed to in writing, software
113d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
123d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
133d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel * License for the specific language governing permissions and limitations under
143d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel * the License.
153d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel */
163d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel
173d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Rousselpackage com.android.multidexlegacyandexception;
183d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel
193d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Rousselimport android.support.multidex.MultiDexApplication;
203d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel
213d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Rousselpublic class TestApplication extends MultiDexApplication {
223d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel
233d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel    private static void canThrow1(boolean condition) throws ExceptionInMainDex {
243d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel        if (condition) {
253d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel            throw new ExceptionInMainDex();
263d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel        }
273d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel    }
283d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel
293d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel
303d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel    public static int get(boolean condition) {
313d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel        try {
323d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel            canThrow1(condition);
333d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel            return 1;
343d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel        } catch (ExceptionInMainDex e) {
353d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel            return 10;
363d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel        } catch (OutOfMemoryError e) {
373d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel            return 12;
383d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel        } catch (CaughtOnlyException e) {
393d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel            return 17;
403d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel        } catch (SuperExceptionInMainDex e) {
413d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel            return 27;
423d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel      }
433d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel    }
443d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel
453d736bc13c9d3d4f87e1295a215bbe13af49e7b4Yohann Roussel}
46